Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add a special error type for configuration errors #2198

Merged
merged 3 commits into from
Dec 9, 2024

Conversation

cpacker
Copy link
Collaborator

@cpacker cpacker commented Dec 8, 2024

Cleans up some common error triggers on the server side:

  • When the server is configured with a model but the API key doesn't exist, the client gets a confusing retry error instead of an API key error
  • ADE constantly hits /agents routes for .../context, .../archival, but gets a 500 instead of the correct 404

Before:

Server-side:

INFO:     ::1:56137 - "GET /v1/agents/agent-bbd31eda-8b95-46d3-957e-312ef4fe2911/context HTTP/1.1" 200 OK
...
Exception: Retries exhausted and no valid response received.
None
Retries exhausted and no valid response received.
...
  File "/Users/loaner/miniconda3/envs/letta/lib/python3.12/site-packages/letta/agent.py", line 641, in _get_ai_reply
    raise Exception("Retries exhausted and no valid response received.")
Exception: Retries exhausted and no valid response received.

Client-side:

Traceback (most recent call last):
  File "/Users/loaner/miniconda3/envs/letta/lib/python3.12/site-packages/letta/client/client.py", line 975, in send_message
    raise ValueError(f"Failed to send message: {response.text}")
ValueError: Failed to send message: {"detail":"Retries exhausted and no valid response received."}

After:

Server-side:

INFO:     Finished server process [65818]
letta-py3.10(base) loaner@MacBook-Pro-8 MemGPT-fresh % letta server

[[ Letta server // v0.6.1 ]]
▶ View using ADE at: https://app.letta.com/development-servers/local/dashboard
▶ Server running at: http://localhost:8283

INFO:     Started server process [65971]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://localhost:8283 (Press CTRL+C to quit)
INFO:     ::1:59716 - "GET /v1/jobs/active HTTP/1.1" 200 OK
INFO:     ::1:59716 - "GET /v1/agents/agent-bbd31eda-8b95-46d3-957e-312ef4fe2911/context HTTP/1.1" 404 Not Found
INFO:     ::1:59716 - "GET /v1/agents/agent-bbd31eda-8b95-46d3-957e-312ef4fe2911/context HTTP/1.1" 404 Not Found
INFO:     ::1:59716 - "GET /v1/agents/agent-bbd31eda-8b95-46d3-957e-312ef4fe2911/archival HTTP/1.1" 404 Not Found
INFO:     ::1:59716 - "GET /v1/jobs/active HTTP/1.1" 200 OK
INFO:     ::1:59716 - "GET /v1/agents/agent-bbd31eda-8b95-46d3-957e-312ef4fe2911/context HTTP/1.1" 404 Not Found
INFO:     ::1:59716 - "GET /v1/jobs/active HTTP/1.1" 200 OK
INFO:     ::1:59716 - "GET /v1/agents/agent-bbd31eda-8b95-46d3-957e-312ef4fe2911/archival HTTP/1.1" 404 Not Found
INFO:     ::1:59716 - "GET /v1/agents/agent-bbd31eda-8b95-46d3-957e-312ef4fe2911/context HTTP/1.1" 404 Not Found
INFO:     ::1:59716 - "GET /v1/agents/agent-bbd31eda-8b95-46d3-957e-312ef4fe2911/archival HTTP/1.1" 404 Not Found
INFO:     ::1:59716 - "GET /v1/jobs/active HTTP/1.1" 200 OK
INFO:     ::1:59716 - "GET /v1/agents/agent-bbd31eda-8b95-46d3-957e-312ef4fe2911/context HTTP/1.1" 404 Not Found
INFO:     ::1:59716 - "GET /v1/agents/agent-bbd31eda-8b95-46d3-957e-312ef4fe2911/archival HTTP/1.1" 404 Not Found
INFO:     ::1:59716 - "GET /v1/agents/agent-bbd31eda-8b95-46d3-957e-312ef4fe2911/context HTTP/1.1" 404 Not Found
^CINFO:     Shutting down
INFO:     Waiting for application shutdown.

@sarahwooders sarahwooders merged commit b1015c0 into main Dec 9, 2024
30 of 33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants