diff --git a/README.md b/README.md index db4ec52..b2df0a7 100644 --- a/README.md +++ b/README.md @@ -552,8 +552,8 @@ We’re looking for developers to improve AgenticSeek! Check out open issues or ## Maintainers: - > [Fosowl](https://github.com/Fosowl) | Paris Time | (Sometime busy) + > [Fosowl](https://github.com/Fosowl) | Paris Time - > [https://github.com/antoineVIVIES](antoineVIVIES) | Taipei Time | (Often busy) + > [antoineVIVIES](https://github.com/antoineVIVIES) | Taipei Time - > [steveh8758](https://github.com/steveh8758) | Taipei Time | (Always busy) \ No newline at end of file + > [steveh8758](https://github.com/steveh8758) | Taipei Time \ No newline at end of file diff --git a/README_CHS.md b/README_CHS.md index 92b87bd..e5caeca 100644 --- a/README_CHS.md +++ b/README_CHS.md @@ -564,8 +564,8 @@ DeepSeek R1 天生会说中文 ## 维护者: - > [Fosowl](https://github.com/Fosowl) | 巴黎时间 | (有时很忙) + > [Fosowl](https://github.com/Fosowl) | 巴黎时间 - > [https://github.com/antoineVIVIES](https://github.com/antoineVIVIES) | 台北时间 | (经常很忙) + > [antoineVIVIES](https://github.com/antoineVIVIES) | Taipei Time - > [steveh8758](https://github.com/steveh8758) | 台北时间 | (总是很忙) + > [steveh8758](https://github.com/steveh8758) | 台北时间 diff --git a/README_CHT.md b/README_CHT.md index fd0f301..27de4fd 100644 --- a/README_CHT.md +++ b/README_CHT.md @@ -556,8 +556,8 @@ DeepSeek R1 天生会说中文 ## 维护者: - > [Fosowl](https://github.com/Fosowl) | 巴黎时间 | (有时很忙) + > [Fosowl](https://github.com/Fosowl) | 巴黎时间 - > [https://github.com/antoineVIVIES](https://github.com/antoineVIVIES) | 台北时间 | (经常很忙) + > [antoineVIVIES](https://github.com/antoineVIVIES) | Taipei Time - > [steveh8758](https://github.com/steveh8758) | 台北时间 | (总是很忙) \ No newline at end of file + > [steveh8758](https://github.com/steveh8758) | 台北时间 \ No newline at end of file diff --git a/README_FR.md b/README_FR.md index 6bb948f..1123bf5 100644 --- a/README_FR.md +++ b/README_FR.md @@ -495,4 +495,4 @@ Nous recherchons des développeurs pour améliorer AgenticSeek ! Consultez la se ## Mainteneurs: > [Fosowl](https://github.com/Fosowl) > [steveh8758](https://github.com/steveh8758) - > [https://github.com/antoineVIVIES](https://github.com/antoineVIVIES) + > [antoineVIVIES](https://github.com/antoineVIVIES) | Taipei Time diff --git a/README_JP.md b/README_JP.md index 83c0f30..240a39f 100644 --- a/README_JP.md +++ b/README_JP.md @@ -565,6 +565,6 @@ AgenticSeekを改善するための開発者を募集しています!オープ > [Fosowl](https://github.com/Fosowl) | パリ時間 - > [https://github.com/antoineVIVIES](antoineVIVIES) | 台北時間 + > [antoineVIVIES](https://github.com/antoineVIVIES) | Taipei Time > [steveh8758](https://github.com/steveh8758) | 台北時間 |(常に忙しい) \ No newline at end of file diff --git a/sources/llm_provider.py b/sources/llm_provider.py index d12cc72..08b819a 100644 --- a/sources/llm_provider.py +++ b/sources/llm_provider.py @@ -14,7 +14,6 @@ from openai import OpenAI from sources.logger import Logger from sources.utility import pretty_print, animate_thinking - class Provider: def __init__(self, provider_name, model, server_address="127.0.0.1:5000", is_local=False): self.provider_name = provider_name.lower() @@ -58,38 +57,6 @@ class Provider: exit(1) return api_key - def anthropic_fn(self, history, verbose=False): - """ - Use Anthropic to generate text. - """ - from anthropic import Anthropic - - client = Anthropic(api_key=self.api_key) - system_message = None - messages = [] - for message in history: - clean_message = {'role': message['role'], 'content': message['content']} - if message['role'] == 'system': - system_message = message['content'] - else: - messages.append(clean_message) - - try: - response = client.messages.create( - model=self.model, - max_tokens=1024, - messages=messages, - system=system_message - ) - if response is None: - raise Exception("Anthropic response is empty.") - thought = response.content[0].text - if verbose: - print(thought) - return thought - except Exception as e: - raise Exception(f"Anthropic API error: {str(e)}") from e - def respond(self, history, verbose=True): """ Use the choosen provider to generate text. @@ -255,6 +222,38 @@ class Provider: except Exception as e: raise Exception(f"OpenAI API error: {str(e)}") from e + def anthropic_fn(self, history, verbose=False): + """ + Use Anthropic to generate text. + """ + from anthropic import Anthropic + + client = Anthropic(api_key=self.api_key) + system_message = None + messages = [] + for message in history: + clean_message = {'role': message['role'], 'content': message['content']} + if message['role'] == 'system': + system_message = message['content'] + else: + messages.append(clean_message) + + try: + response = client.messages.create( + model=self.model, + max_tokens=1024, + messages=messages, + system=system_message + ) + if response is None: + raise Exception("Anthropic response is empty.") + thought = response.content[0].text + if verbose: + print(thought) + return thought + except Exception as e: + raise Exception(f"Anthropic API error: {str(e)}") from e + def google_fn(self, history, verbose=False): """ Use google gemini to generate text.