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: patch out-of-sync / missing tzinfo timestamps coming back from API server #1182

Merged
merged 13 commits into from
Mar 27, 2024

Conversation

cpacker
Copy link
Collaborator

@cpacker cpacker commented Mar 22, 2024

  1. Create an agent

agent_id = f30a410d-f4d2-4e18-bc0f-bdf5f6248144

  1. Get GET /api/agents/f30a410d-f4d2-4e18-bc0f-bdf5f6248144/messages-cursor?limit=10
% curl --request GET \
     --url 'http://localhost:8283/api/agents/f30a410d-f4d2-4e18-bc0f-bdf5f6248144/messages-cursor?limit=10' \
     --header 'accept: application/json' \
     --header 'authorization: Bearer banana'
{
  "messages":[
  {"id":"70df5474-596c-4e5d-86b7-e344d3ec7820","user_id":"00000000-0000-0000-0000-a61b692e9d3b","agent_id":"f30a410d-f4d2-4e18-bc0f-bdf5f6248144","text":"{\"type\": \"login\", \"last_login\": \"Never (first login)\", \"time\": \"2024-03-21 09:44:09 PM PDT-0700\"}","model":"gpt-4","created_at":"2024-03-22T04:44:09.959669","role":"user","name":null,"embedding":null,"embedding_dim":null,"embedding_model":null,"tool_calls":null,"tool_call_id":null},
  {"id":"e386ddca-8584-46be-ac65-7d8527bdc4c9","user_id":"00000000-0000-0000-0000-a61b692e9d3b","agent_id":"f30a410d-f4d2-4e18-bc0f-bdf5f6248144","text":"{\"status\": \"OK\", \"message\": null, \"time\": \"2024-03-21 09:44:09 PM PDT-0700\"}","model":"gpt-4","created_at":"2024-03-22T04:44:09.959664","role":"tool","name":"send_message","embedding":null,"embedding_dim":null,"embedding_model":null,"tool_calls":null,"tool_call_id":"9ebb5bff-8ff9-41c0-bae9-db6b831de147"},
  {"id":"b2b2d2a0-723d-4655-b9dc-6d4556e0e1f4","user_id":"00000000-0000-0000-0000-a61b692e9d3b","agent_id":"f30a410d-f4d2-4e18-bc0f-bdf5f6248144","text":"Bootup sequence complete. Persona activated. Testing messaging functionality.","model":"gpt-4","created_at":"2024-03-22T04:44:09.959659","role":"assistant","name":null,"embedding":null,"embedding_dim":null,"embedding_model":null,"tool_calls":[{"id":"9ebb5bff-8ff9-41c0-bae9-db6b831de147","tool_call_type":"function","function":{"name":"send_message","arguments":"{\n  \"message\": \"More human than human is our motto.\"\n}"}}],"tool_call_id":null},
  {"id":"ffa02213-5cf3-4650-bdb6-97a86a662444","user_id":"00000000-0000-0000-0000-a61b692e9d3b","agent_id":"f30a410d-f4d2-4e18-bc0f-bdf5f6248144","text":"You are MemGPT, t...\n\n</human>","model":"gpt-4","created_at":"2024-03-22T04:44:09.959642","role":"system","name":null,"embedding":null,"embedding_dim":null,"embedding_model":null,"tool_calls":null,"tool_call_id":null}
  ]
}

Stripped timestamps:

{
  "messages":[
"created_at":"2024-03-22T04:44:09.959669",
"created_at":"2024-03-22T04:44:09.959664",
"created_at":"2024-03-22T04:44:09.959659"
"created_at":"2024-03-22T04:44:09.959642",
  ]
}
  1. Send a message "hi what's up"
curl --request POST \
     --url http://localhost:8283/api/agents/f30a410d-f4d2-4e18-bc0f-bdf5f6248144/messages \
     --header 'accept: application/json' \
     --header 'authorization: Bearer banana' \
     --header 'content-type: application/json' \
     --data @- <<EOF
{
  "message": "hey what's up",
  "stream": true,
  "role": "user"
}
EOF
data: {"internal_monologue": "User Chad has greeted me. Considering my persona as Anna, calm and empathetic, I'll respond in a gentle and caring manner. I'll also try to connect with him based on his interest or work.", "id": "6fb63e8c-5b1b-463f-8b8c-c788a96f31f0", "date": "2024-03-22T04:50:27.515337+00:00"}

data: {"function_call": "send_message({'message': \"Hello Chad! It's a pleasure to connect with you. Are there any interesting Computer Science research topics or perhaps some Formula 1 updates you'd like to talk about today?\"})", "id": "6fb63e8c-5b1b-463f-8b8c-c788a96f31f0", "date": "2024-03-22T04:50:27.515337+00:00"}

data: {"assistant_message": "Hello Chad! It's a pleasure to connect with you. Are there any interesting Computer Science research topics or perhaps some Formula 1 updates you'd like to talk about today?", "id": "6fb63e8c-5b1b-463f-8b8c-c788a96f31f0", "date": "2024-03-22T04:50:27.515337+00:00"}

data: {"function_return": "None", "status": "success", "id": "4dbff0be-b452-4cd4-aea0-ff1369ec3e58", "date": "2024-03-22T04:50:27.515791+00:00"}

Stripped timestamps:

"id": "6fb63e8c-5b1b-463f-8b8c-c788a96f31f0", "date": "2024-03-22T04:50:27.515337+00:00"
"id": "6fb63e8c-5b1b-463f-8b8c-c788a96f31f0", "date": "2024-03-22T04:50:27.515337+00:00"
"id": "6fb63e8c-5b1b-463f-8b8c-c788a96f31f0", "date": "2024-03-22T04:50:27.515337+00:00"
"id": "4dbff0be-b452-4cd4-aea0-ff1369ec3e58", "date": "2024-03-22T04:50:27.515791+00:00"
  1. Get messages again
{
  "messages":[
    {"id":"4dbff0be-b452-4cd4-aea0-ff1369ec3e58","user_id":"00000000-0000-0000-0000-a61b692e9d3b","agent_id":"f30a410d-f4d2-4e18-bc0f-bdf5f6248144","text":"{\"status\": \"OK\", \"message\": \"None\", \"time\": \"2024-03-21 09:50:27 PM PDT-0700\"}","model":"gpt-4","created_at":"2024-03-22T04:50:27.515791","role":"tool","name":"send_message","embedding":null,"embedding_dim":null,"embedding_model":null,"tool_calls":null,"tool_call_id":"14f100aa-623e-410a-bc7a-e4cee"},
    {"id":"6fb63e8c-5b1b-463f-8b8c-c788a96f31f0","user_id":"00000000-0000-0000-0000-a61b692e9d3b","agent_id":"f30a410d-f4d2-4e18-bc0f-bdf5f6248144","text":"User Chad has greeted me. Considering my persona as Anna, calm and empathetic, I'll respond in a gentle and caring manner. I'll also try to connect with him based on his interest or work.","model":"gpt-4","created_at":"2024-03-22T04:50:27.515337","role":"assistant","name":null,"embedding":null,"embedding_dim":null,"embedding_model":null,"tool_calls":[{"id":"14f100aa-623e-410a-bc7a-e4cee","tool_call_type":"function","function":{"arguments":"{\n  \"message\": \"Hello Chad! It's a pleasure to connect with you. Are there any interesting Computer Science research topics or perhaps some Formula 1 updates you'd like to talk about today?\"\n}","name":"send_message"}}],"tool_call_id":null},
    {"id":"7fca6481-c818-4c61-bba5-4a61eb17682a","user_id":"00000000-0000-0000-0000-a61b692e9d3b","agent_id":"f30a410d-f4d2-4e18-bc0f-bdf5f6248144","text":"{\"type\": \"user_message\", \"message\": \"hey what's up\", \"time\": \"2024-03-21 09:50:23 PM PDT-0700\"}","model":"gpt-4","created_at":"2024-03-22T04:50:23.484165","role":"user","name":null,"embedding":null,"embedding_dim":null,"embedding_model":null,"tool_calls":null,"tool_call_id":null},{"id":"70df5474-596c-4e5d-86b7-e344d3ec7820","user_id":"00000000-0000-0000-0000-a61b692e9d3b","agent_id":"f30a410d-f4d2-4e18-bc0f-bdf5f6248144","text":"{\"type\": \"login\", \"last_login\": \"Never (first login)\", \"time\": \"2024-03-21 09:44:09 PM PDT-0700\"}","model":"gpt-4","created_at":"2024-03-22T04:44:09.959669","role":"user","name":null,"embedding":null,"embedding_dim":null,"embedding_model":null,"tool_calls":null,"tool_call_id":null},
    {"id":"e386ddca-8584-46be-ac65-7d8527bdc4c9","user_id":"00000000-0000-0000-0000-a61b692e9d3b","agent_id":"f30a410d-f4d2-4e18-bc0f-bdf5f6248144","text":"{\"status\": \"OK\", \"message\": null, \"time\": \"2024-03-21 09:44:09 PM PDT-0700\"}","model":"gpt-4","created_at":"2024-03-22T04:44:09.959664","role":"tool","name":"send_message","embedding":null,"embedding_dim":null,"embedding_model":null,"tool_calls":null,"tool_call_id":"9ebb5bff-8ff9-41c0-bae9-db6b831de147"},
    {"id":"b2b2d2a0-723d-4655-b9dc-6d4556e0e1f4","user_id":"00000000-0000-0000-0000-a61b692e9d3b","agent_id":"f30a410d-f4d2-4e18-bc0f-bdf5f6248144","text":"Bootup sequence complete. Persona activated. Testing messaging functionality.","model":"gpt-4","created_at":"2024-03-22T04:44:09.959659","role":"assistant","name":null,"embedding":null,"embedding_dim":null,"embedding_model":null,"tool_calls":[{"id":"9ebb5bff-8ff9-41c0-bae9-db6b831de147","tool_call_type":"function","function":{"name":"send_message","arguments":"{\n  \"message\": \"More human than human is our motto.\"\n}"}}],"tool_call_id":null},
    {"id":"ffa02213-5cf3-4650-bdb6-97a86a662444","user_id":"00000000-0000-0000-0000-a61b692e9d3b","agent_id":"f30a410d-f4d2-4e18-bc0f-bdf5f6248144","text":"You are MemGPT, t...O\n\n</human>","model":"gpt-4","created_at":"2024-03-22T04:44:09.959642","role":"system","name":null,"embedding":null,"embedding_dim":null,"embedding_model":null,"tool_calls":null,"tool_call_id":null}
  ]
} 

Stripped timestamps:

{
  "messages":[
"created_at":"2024-03-22T04:50:27.515791",
"created_at":"2024-03-22T04:50:27.515337"
"created_at":"2024-03-22T04:50:23.484165",
"created_at":"2024-03-22T04:44:09.959669",
"created_at":"2024-03-22T04:44:09.959664"
"created_at":"2024-03-22T04:44:09.959659",
"created_at":"2024-03-22T04:44:09.959642",
  ]
} 

Please describe the purpose of this pull request.
Is it to add a new feature? Is it to fix a bug?

How to test
How can we test your PR during review? What commands should we run? What outcomes should we expect?

Have you tested this PR?
Have you tested the latest commit on the PR? If so please provide outputs from your tests.

Related issues or PRs
Please link any related GitHub issues or PRs.

Is your PR over 500 lines of code?
If so, please break up your PR into multiple smaller PRs so that we can review them quickly, or provide justification for its length.

Additional context
Add any other context or screenshots about the PR here.

@cpacker cpacker added the API Related to MemGPT API label Mar 22, 2024
@cpacker cpacker marked this pull request as ready for review March 22, 2024 05:00
@cpacker cpacker requested a review from sarahwooders March 22, 2024 05:03
Copy link
Collaborator

@sarahwooders sarahwooders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

@cpacker cpacker merged commit 15a1492 into main Mar 27, 2024
4 checks passed
@cpacker cpacker deleted the another-timestamp-patch branch March 27, 2024 03:37
mattzh72 pushed a commit that referenced this pull request Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Related to MemGPT API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants