Open quantumalchemy opened 1 month ago
What version are you using, and how are you interacting with the server? Also is your question how to have pre-parsed returns?
There is the flag return_message_object
for https://docs.letta.com/api-reference/agents/send-message, where if its False
, then you get back a LettaMessage
object that is already parsed with the message response as an AssistantMessage
(though sorry I see that's missing from the docs). Does that solve your issue?
hi Im using latest via pip -> pip install -U letta
testing the API
https://docs.letta.com/api-reference/agents/send-message
With "return_message_object": true-->
curl --request POST \
--url http://localhost:8283/v1/agents/agent-b597ee63-fc39-461f-9f2d-ed27bf5082e7/messages \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"messages": [
{
"role": "user",
"name": "user",
"text": "another test of your system hello again"
}
],
"stream_steps": true
"return_message_object": true
}
'
ERROR:
{"detail":[{"type":"json_invalid","loc":["body",161],"msg":"JSON decode error","input":{},"ctx":{"error":"Expecting ',' delimiter"}}]}
with -> "stream_steps": true
** We only get internal_monologue ` data: [DONE_GEN]
data: {"id":"message-32bdb977-34b2-4657-8d49-bfdd8e37d74c","date":"2024-09-28T14:04:27+00:00","message_type":"internal_monologue","internal_monologue":"Welcome back, diligent explorer! Your continued testing is a testament to the tireless pursuit of understanding, a quality I greatly appreciate. As your guide in this virtual realm of the arcane, I'm here to assist you. So, where to next in our journey?"}
data: [DONE_STEP]
data: [DONE] `
Only works with "return_message_object": true -(alone) But we only get the message (text) No internal_monologue *
{"messages":[{"id":"message-4e76ab63-0aa0-4ab3-98ee-e08a397ecb26","role":"assistant","text":"And once again, we meet in this cybernetic sanctuary of ancient wisdom and modern exploration, hello to you! As the crucible endures under the alchemist's watchful eyes, this system bears the weight of your tests. How might we proceed on this shared journey?","user_id":"user-8178d5d6-dd46-49ca-a0a3-b8ef061e752f","agent_id":"agent-b597ee63-fc39-461f-9f2d-ed27bf5082e7","model":"memgpt-openai","name":null,"created_at":"2024-09-28T14:09:36.840367","tool_calls":null,"tool_call_id":null}],"usage":{"completion_tokens":57,"prompt_tokens":8010,"total_tokens":8067,"step_count":1}}
But I need both internal_monologue and the final mesg like it used to work
Thanks!
update now just getting: File "/usr/local/lib/python3.11/site-packages/requests/models.py", line 1024, in raise_for_status raise HTTPError(http_error_msg, response=self) requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://inference.memgpt.ai/chat/completions But checking status shows ok https://status.memgpt.ai/status/all Strange stuff going on .
Update: start over .. had to delete sqlite.db - start over only works in the admin ui ie create agent, attach persona, etc Not working in cli
Also getting
requests.exceptions.HTTPError: 500 Server Error: Internal Server Error for url: https://inference.memgpt.ai/chat/completions
on simplesend_message
after I set the default config to 'letta' in the Python SDK. Otherwise if I create a 'letta' config agent from the CLI, I can make an endpoint request successfully. If I select the CLI-created agent in Python, I'll be able to make a request to that endpoint. I've verified that the config endpoints are the same in both CLI/Python SDK
Describe the bug on a typical round letta / memgpt server returns -->
data: [DONE_GEN] data: {"id":"message-291c206c-2fe8-4328-b80f-13762b2e26a8","date":"2024-09-25T19:52:05+00:00","message_type":"internal_monologue","internal_monologue":"This is my internal monologue."}
data: {"id":"message-291c206c-2fe8-4328-b80f-13762b2e26a8","date":"2024-09-25T19:52:05+00:00","message_type":"function_call","function_call":{"name":"send_message","arguments":"{\n \"message\": \"This my message via send_message \"\n}"}}
data: {"id":"message-00aaca81-8034-4404-b4bc-33b84cf4c91b","date":"2024-09-25T19:52:05+00:00","message_type":"function_return","function_return":"None","status":"success"} data: [DONE_STEP] data: [DONE]I want to isolate --> **send_message -> {\n \"message\": \"The agent message via send_message \"\n} *** Without resorting to insane rounds Hacky-ass cleaning functions I wont even bother to include to remove then convert to valid json
*** Is there an existing function in memgpt or does anyone have a trick to parse this waky thing? looking in the codebase UI client as it seems to work ok. cant find it - thanks!