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: fix bug with POST /v1/agents/messages route returning empty LettaMessage base objects #1966

Merged
merged 3 commits into from
Oct 31, 2024

Conversation

cpacker
Copy link
Collaborator

@cpacker cpacker commented Oct 31, 2024

Before:

% curl --request POST \
  --url http://localhost:8283/v1/agents/agent-95e54e09-f18b-4bf8-b795-50d86130456e/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "messages": [
    {
      "role": "user",
      "text": "hi again"
    }
  ]
}'
{
  "messages":[
    {"id":"message-8c0b79c3-224b-46ac-ac8a-3bf2c8130144","date":"2024-10-31T22:51:35+00:00"},
    {"id":"message-8c0b79c3-224b-46ac-ac8a-3bf2c8130144","date":"2024-10-31T22:51:35+00:00"},
    {"id":"message-a9fccc74-6ada-4d13-ac8f-06f628f7c65c","date":"2024-10-31T22:51:35+00:00"}
  ],
  "usage":{"completion_tokens":53,"prompt_tokens":3106,"total_tokens":3159,"step_count":1}
}

After:

% curl --request POST \
  --url http://localhost:8283/v1/agents/agent-95e54e09-f18b-4bf8-b795-50d86130456e/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "messages": [
    {
      "role": "user",
      "text": "hi again"
    }
  ]
}'
{
  "messages":[
    {"id":"message-ebb31345-bc00-4480-8a5f-b4d6cf875ec8","date":"2024-10-31T23:23:01+00:00","message_type":"internal_monologue","internal_monologue":"The user just sent another greeting. Replying with a question to facilitate the conversation."},
    {"id":"message-ebb31345-bc00-4480-8a5f-b4d6cf875ec8","date":"2024-10-31T23:23:01+00:00","message_type":"function_call","function_call":{"name":"send_message","arguments":"{\n  \"message\": \"Hi! Anything fun you want to talk about?\"\n}","function_call_id":"call_P4JH1VdVUpP30YIqKFIH8s4S"}},
    {"id":"message-e4456e9d-61ca-4ce0-a878-4a822fc0917c","date":"2024-10-31T23:23:01+00:00","message_type":"function_return","function_return":"None","status":"success","function_call_id":"call_P4JH1VdVUpP30YIqKFIH8s4S"}
  ],
  "usage":{"completion_tokens":48,"prompt_tokens":3251,"total_tokens":3299,"step_count":1}
}

After (with use_assistant_message == true):

% curl --request POST \
  --url http://localhost:8283/v1/agents/agent-95e54e09-f18b-4bf8-b795-50d86130456e/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "messages": [
    {
      "role": "user",
      "text": "hi again"
    }
  ], 
  "use_assistant_message": true
}'
{
  "messages":[
    {"id":"message-5b3f8da3-2329-4945-b7e0-ca76cfa375a4","date":"2024-10-31T23:30:49+00:00","message_type":"internal_monologue","internal_monologue":"The user greeted me again. Responding with a friendly question to engage them in the conversation."},
    {"id":"message-5b3f8da3-2329-4945-b7e0-ca76cfa375a4","date":"2024-10-31T23:30:49+00:00","message_type":"assistant_message","assistant_message":"Hello! What brings you here today?"},
    {"id":"message-bfb392c4-bfc6-4a28-86cc-17125b1d3114","date":"2024-10-31T23:30:49+00:00","message_type":"function_return","function_return":"None","status":"success","function_call_id":"call_j4MWxybVBc7CICOg9lYqmscj"}
  ],
  "usage":{"completion_tokens":48,"prompt_tokens":3391,"total_tokens":3439,"step_count":1}
}

@cpacker cpacker changed the title fix: patch method in RESTClient.send_message that was hiding a server-side bug fix: fix bug with POST /v1/agents/messages route returning empty LettaMessage base objects Oct 31, 2024
… type, instead of the base LettaMessage type
@cpacker cpacker requested a review from sarahwooders October 31, 2024 23:48
@sarahwooders sarahwooders merged commit e7b2c95 into main Oct 31, 2024
19 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