mirror of
https://github.com/tcsenpai/agenticSeek.git
synced 2025-06-01 16:50:10 +00:00
fix : errors related to API based LLMs
This commit is contained in:
parent
68d471bfc6
commit
68ed1834a9
@ -159,9 +159,9 @@ Set the desired provider in the `config.ini`. See below for a list of API provid
|
||||
```sh
|
||||
[MAIN]
|
||||
is_local = False
|
||||
provider_name = openai
|
||||
provider_model = gpt-4o
|
||||
provider_server_address = 127.0.0.1:5000
|
||||
provider_name = google
|
||||
provider_model = gemini-2.0-flash
|
||||
provider_server_address = 127.0.0.1:5000 # doesn't matter
|
||||
```
|
||||
Warning: Make sure there is not trailing space in the config.
|
||||
|
||||
@ -179,6 +179,8 @@ Example: export `TOGETHER_API_KEY="xxxxx"`
|
||||
| togetherAI | No | Use together AI API (non-private) |
|
||||
| google | No | Use google gemini API (non-private) |
|
||||
|
||||
*We advice against using gpt-4o or other closedAI models*, performance are poor for web browsing and task planning.
|
||||
|
||||
Next step: [Start services and run AgenticSeek](#Start-services-and-Run)
|
||||
|
||||
*See the **Known issues** section if you are having issues*
|
||||
|
@ -151,7 +151,7 @@ class PlannerAgent(Agent):
|
||||
return []
|
||||
agents_tasks = self.parse_agent_tasks(answer)
|
||||
if agents_tasks == []:
|
||||
prompt = f"Failed to parse the tasks. Please make a plan within ```json. Do not ask for clarification.\n"
|
||||
prompt = f"Failed to parse the tasks. Please write down your task followed by a json plan within ```json. Do not ask for clarification.\n"
|
||||
pretty_print("Failed to make plan. Retrying...", color="warning")
|
||||
continue
|
||||
self.show_plan(agents_tasks, answer)
|
||||
|
@ -72,6 +72,8 @@ class Provider:
|
||||
except ModuleNotFoundError as e:
|
||||
raise ModuleNotFoundError(f"{str(e)}\nA import related to provider {self.provider_name} was not found. Is it installed ?")
|
||||
except Exception as e:
|
||||
if "try again later" in str(e).lower():
|
||||
return f"{self.provider_name} server is overloaded. Please try again later."
|
||||
if "refused" in str(e):
|
||||
return f"Server {self.server_ip} seem offline. Unable to answer."
|
||||
raise Exception(f"Provider {self.provider_name} failed: {str(e)}") from e
|
||||
@ -214,7 +216,7 @@ class Provider:
|
||||
"""
|
||||
base_url = self.server_ip
|
||||
if self.is_local:
|
||||
raise Exception("Google Gemini is not available for local use.")
|
||||
raise Exception("Google Gemini is not available for local use. Change config.ini")
|
||||
|
||||
client = OpenAI(api_key=self.api_key, base_url="https://generativelanguage.googleapis.com/v1beta/openai/")
|
||||
try:
|
||||
@ -237,6 +239,8 @@ class Provider:
|
||||
"""
|
||||
from together import Together
|
||||
client = Together(api_key=self.api_key)
|
||||
if self.is_local:
|
||||
raise Exception("Together AI is not available for local use. Change config.ini")
|
||||
|
||||
try:
|
||||
response = client.chat.completions.create(
|
||||
@ -257,6 +261,8 @@ class Provider:
|
||||
Use deepseek api to generate text.
|
||||
"""
|
||||
client = OpenAI(api_key=self.api_key, base_url="https://api.deepseek.com")
|
||||
if self.is_local:
|
||||
raise Exception("Deepseek (API) is not available for local use. Change config.ini")
|
||||
try:
|
||||
response = client.chat.completions.create(
|
||||
model="deepseek-chat",
|
||||
|
@ -14,7 +14,7 @@ For example:
|
||||
print("Hello world")
|
||||
```
|
||||
This is then executed by the tool with its own class implementation of execute().
|
||||
A tool is not just for code tool but also API, internet, etc..
|
||||
A tool is not just for code tool but also API, internet search, MCP, etc..
|
||||
"""
|
||||
|
||||
import sys
|
||||
|
@ -17,13 +17,13 @@ class TestBrowserAgentParsing(unittest.TestCase):
|
||||
# Test various link formats
|
||||
test_text = """
|
||||
Check this out: https://thriveonai.com/15-ai-startups-in-japan-to-take-note-of, and www.google.com!
|
||||
Also try https://test.org/about?page=1, hey this one as well bro https://weatherstack.com/documentation.
|
||||
Also try https://test.org/about?page=1, hey this one as well bro https://weatherstack.com/documentation/.
|
||||
"""
|
||||
expected = [
|
||||
"https://thriveonai.com/15-ai-startups-in-japan-to-take-note-of",
|
||||
"www.google.com",
|
||||
"https://test.org/about?page=1",
|
||||
"https://weatherstack.com/documentation"
|
||||
"https://weatherstack.com/documentation",
|
||||
]
|
||||
result = self.agent.extract_links(test_text)
|
||||
self.assertEqual(result, expected)
|
||||
|
Loading…
x
Reference in New Issue
Block a user