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

Make platform and OSS output format same #1977

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 43 additions & 20 deletions docs/platform/quickstart.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,21 @@ curl -X POST "https://api.mem0.ai/v1/memories/" \
{
"results": [
{
"memory": "Name is Alex",
"data": {
"memory": "Name is Alex"
},
"event": "ADD"
},
{
"memory": "Is a vegetarian",
"data": {
"memory": "Is a vegetarian"
},
"event": "ADD"
},
{
"memory": "Is allergic to nuts",
"data": {
"memory": "Is allergic to nuts"
},
"event": "ADD"
}
]
Expand Down Expand Up @@ -173,11 +179,15 @@ curl -X POST "https://api.mem0.ai/v1/memories/" \
{
"results": [
{
"memory": "Planning a trip to Japan next month",
"data": {
"memory": "Planning a trip to Japan next month"
},
"event": "ADD"
},
{
"memory": "Interested in vegetarian restaurants in Tokyo",
"data": {
"memory": "Interested in vegetarian restaurants in Tokyo"
},
"event": "ADD"
}
]
Expand Down Expand Up @@ -241,15 +251,21 @@ curl -X POST "https://api.mem0.ai/v1/memories/" \
{
"results": [
{
"memory": "Name is Alex",
"data": {
"memory": "Name is Alex"
},
"event": "ADD"
},
{
"memory": "Is a vegetarian",
"data": {
"memory": "Is a vegetarian"
},
"event": "ADD"
},
{
"memory": "Is allergic to nuts",
"data": {
"memory": "Is allergic to nuts"
},
"event": "ADD"
}
]
Expand Down Expand Up @@ -320,6 +336,7 @@ curl -X POST "https://api.mem0.ai/v1/memories/search/" \
"user_id": "alex",
"hash": "9ee7e1455e84d1dab700ed8749aed75a",
"metadata": null,
"categories": ["food_preferences"],
"created_at": "2024-07-20T01:30:36.275141-07:00",
"updated_at": "2024-07-20T01:30:36.275172-07:00"
}
Expand All @@ -345,6 +362,7 @@ curl -X POST "https://api.mem0.ai/v1/memories/search/" \
"user_id": "alex",
"hash": "9ee7e1455e84d1dab700ed8749aed75a",
"metadata": null,
"categories": ["food_preferences"],
"created_at": "2024-07-20T01:30:36.275141-07:00",
"updated_at": "2024-07-20T01:30:36.275172-07:00"
}
Expand Down Expand Up @@ -445,6 +463,7 @@ curl -X POST "https://api.mem0.ai/v1/memories/search/?version=v2" \
"user_id": "alex",
"hash": "9ee7e1455e84d1dab700ed8749aed75a",
"metadata": null,
"categories": ["food_preferences"],
"created_at": "2024-07-20T01:30:36.275141-07:00",
"updated_at": "2024-07-20T01:30:36.275172-07:00"
}
Expand Down Expand Up @@ -519,6 +538,7 @@ curl -X POST "https://api.mem0.ai/v1/memories/search/?version=v2" \
"user_id": "alex",
"hash": "9ee7e1455e84d1dab700ed8749aed75a",
"metadata": null,
"categories": ["food_preferences"],
"created_at": "2024-07-20T01:30:36.275141-07:00",
"updated_at": "2024-07-20T01:30:36.275172-07:00"
}
Expand Down Expand Up @@ -558,7 +578,6 @@ curl -X GET "https://api.mem0.ai/v1/entities/" \
"updated_at": "2024-07-17T16:47:23.899918-07:00",
"total_memories": 5,
"owner": "alex",
"organization": "alex-org",
"metadata": {"foo": "bar"},
"type": "user"
},
Expand All @@ -569,7 +588,6 @@ curl -X GET "https://api.mem0.ai/v1/entities/" \
"updated_at": "2024-07-01T17:59:08.187266-07:00",
"total_memories": 10,
"owner": "alex",
"organization": "alex-org",
"metadata": {"agent_id": "123"},
"type": "agent"
}
Expand Down Expand Up @@ -694,7 +712,7 @@ curl -X GET "https://api.mem0.ai/v1/memories/?agent_id=travel-assistant&output_f
"metadata":None,
"created_at":"2024-07-25T23:57:00.108347-07:00",
"updated_at":"2024-07-25T23:57:00.108367-07:00",
"custom_categories":None
"categories":None
},
{
"id":"0a14d8f0-e364-4f5c-b305-10da1f0d0878",
Expand All @@ -704,7 +722,7 @@ curl -X GET "https://api.mem0.ai/v1/memories/?agent_id=travel-assistant&output_f
"metadata":None,
"created_at":"2024-07-26T00:31:03.543759-07:00",
"updated_at":"2024-07-26T00:31:03.543778-07:00",
"custom_categories":None
"categories":None
}
]
```
Expand Down Expand Up @@ -768,7 +786,7 @@ curl -X GET "https://api.mem0.ai/v1/memories/?user_id=alex123&run_id=trip-planni
"metadata":None,
"created_at":"2024-07-26T00:25:16.566471-07:00",
"updated_at":"2024-07-26T00:25:16.566492-07:00",
"custom_categories":None
"categories":None
},
{
"id":"b4229775-d860-4ccb-983f-0f628ca112f5",
Expand All @@ -778,7 +796,7 @@ curl -X GET "https://api.mem0.ai/v1/memories/?user_id=alex123&run_id=trip-planni
"metadata":None,
"created_at":"2024-07-26T00:33:20.350542-07:00",
"updated_at":"2024-07-26T00:33:20.350560-07:00",
"custom_categories":None
"categories":None
},
{
"id":"df1aca24-76cf-4b92-9f58-d03857efcb64",
Expand All @@ -788,7 +806,7 @@ curl -X GET "https://api.mem0.ai/v1/memories/?user_id=alex123&run_id=trip-planni
"metadata":None,
"created_at":"2024-07-26T00:51:09.642275-07:00",
"updated_at":"2024-07-26T00:51:09.642295-07:00",
"custom_categories":None
"categories":None
}
]
```
Expand All @@ -803,7 +821,8 @@ curl -X GET "https://api.mem0.ai/v1/memories/?user_id=alex123&run_id=trip-planni
"hash": "d2088c936e259f2f5d2d75543d31401c",
"metadata":None,
"created_at": "2024-07-26T00:25:16.566471-07:00",
"updated_at": "2024-07-26T00:25:16.566492-07:00"
"updated_at": "2024-07-26T00:25:16.566492-07:00",
"categories":None
},
{
"id": "b4229775-d860-4ccb-983f-0f628ca112f5",
Expand All @@ -812,7 +831,8 @@ curl -X GET "https://api.mem0.ai/v1/memories/?user_id=alex123&run_id=trip-planni
"hash": "d2088c936e259f2f5d2d75543d31401c",
"metadata":None,
"created_at": "2024-07-26T00:33:20.350542-07:00",
"updated_at": "2024-07-26T00:33:20.350560-07:00"
"updated_at": "2024-07-26T00:33:20.350560-07:00",
"categories":None
},
{
"id": "df1aca24-76cf-4b92-9f58-d03857efcb64",
Expand All @@ -821,7 +841,8 @@ curl -X GET "https://api.mem0.ai/v1/memories/?user_id=alex123&run_id=trip-planni
"hash": "d2088c936e259f2f5d2d75543d31401c",
"metadata":None,
"created_at": "2024-07-26T00:51:09.642275-07:00",
"updated_at": "2024-07-26T00:51:09.642295-07:00"
"updated_at": "2024-07-26T00:51:09.642295-07:00",
"categories":None
}
]
}
Expand Down Expand Up @@ -856,7 +877,8 @@ curl -X GET "https://api.mem0.ai/v1/memories/582bbe6d-506b-48c6-a4c6-5df3b1e6342
"hash":"d2088c936e259f2f5d2d75543d31401c",
"metadata":"None",
"created_at":"2024-07-26T00:25:16.566471-07:00",
"updated_at":"2024-07-26T00:25:16.566492-07:00"
"updated_at":"2024-07-26T00:25:16.566492-07:00",
"categories":["travel"]
}
```
</CodeGroup>
Expand Down Expand Up @@ -937,7 +959,8 @@ curl -X GET "https://api.mem0.ai/v1/memories/?version=v2" \
"hash":"62bc074f56d1f909f1b4c2b639f56f6a",
"metadata":null,
"created_at":"2024-07-25T23:57:00.108347-07:00",
"updated_at":"2024-07-25T23:57:00.108367-07:00"
"updated_at":"2024-07-25T23:57:00.108367-07:00",
"categories":["travel"]
}
]
```
Expand Down
8 changes: 4 additions & 4 deletions mem0/memory/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def add(
category=DeprecationWarning,
stacklevel=2,
)
return {"message": "ok"}
return vector_store_result

def _add_to_vector_store(self, messages, metadata, filters):
parsed_messages = parse_messages(messages)
Expand Down Expand Up @@ -190,7 +190,7 @@ def _add_to_vector_store(self, messages, metadata, filters):
returned_memories.append(
{
"id": memory_id,
"memory": resp["text"],
"data": {"memory": resp["text"]},
"event": resp["event"],
}
)
Expand All @@ -199,7 +199,7 @@ def _add_to_vector_store(self, messages, metadata, filters):
returned_memories.append(
{
"id": resp["id"],
"memory": resp["text"],
"data": {"memory": resp["text"]},
"event": resp["event"],
"previous_memory": resp["old_memory"],
}
Expand All @@ -209,7 +209,7 @@ def _add_to_vector_store(self, messages, metadata, filters):
returned_memories.append(
{
"id": resp["id"],
"memory": resp["text"],
"data": {"memory": resp["text"]},
"event": resp["event"],
}
)
Expand Down
Loading