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

Add support: MemoryExport API #2129

Merged
merged 8 commits into from
Jan 9, 2025
Merged
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
6 changes: 6 additions & 0 deletions docs/api-reference/memory/create-memory-export.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: 'Create Memory Export'
openapi: post /v1/exports/
---

Submit a job to create a structured export of memories using a customizable Pydantic schema. This process may take some time to complete, especially if you’re exporting a large number of memories. You can tailor the export by applying various filters (e.g., user_id, agent_id, run_id, or session_id) and by modifying the Pydantic schema to ensure the final data matches your exact needs.
6 changes: 6 additions & 0 deletions docs/api-reference/memory/get-memory-export.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: 'Get Memory Export'
openapi: get /v1/exports/
---

Retrieve the latest structured memory export after submitting an export job. You can filter the export by `user_id`, `run_id`, `session_id`, or `app_id` to get the most recent export matching your filters.
4 changes: 3 additions & 1 deletion docs/mint.json
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,9 @@
"api-reference/memory/v2-search-memories",
"api-reference/memory/history-memory",
"api-reference/memory/batch-update",
"api-reference/memory/batch-delete"
"api-reference/memory/batch-delete",
"api-reference/memory/create-memory-export",
"api-reference/memory/get-memory-export"
]
},
{
Expand Down
194 changes: 194 additions & 0 deletions docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,200 @@
}
}
},
"/v1/exports/": {
"get": {
"tags": [
"exports"
],
"summary": "Export data based on filters",
"description": "Get the latest memory export.",
"operationId": "exports_list",
"parameters": [
{
"name": "user_id",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter exports by user ID"
},
{
"name": "run_id",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter exports by run ID"
},
{
"name": "session_id",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter exports by session ID"
},
{
"name": "app_id",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter exports by app ID"
},
{
"name": "org_id",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter exports by organization ID"
},
{
"name": "project_id",
"in": "query",
"schema": {
"type": "string"
},
"description": "Filter exports by project ID"
}
],
"responses": {
"200": {
"description": "Successful export",
"content": {
"application/json": {
"schema": {
"type": "object",
"description": "Export data response"
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "One of the filters: app_id, user_id, agent_id, run_id is required!"
}
}
}
}
}
},
"404": {
"description": "Not Found",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"error": {
"type": "string",
"example": "No memory export request found"
}
}
}
}
}
}
}
},
"post": {
"tags": [
"exports"
],
"summary": "Create an export job with schema",
"description": "Create a structured export of memories based on a provided schema.",
"operationId": "exports_create",
"requestBody": {
"content": {
"application/json": {
"schema": {
"type": "object",
"required": ["schema"],
"properties": {
"schema": {
"type": "object",
"description": "Schema definition for the export"
},
"user_id": {
"type": "string",
"description": "Filter exports by user ID"
},
"run_id": {
"type": "string",
"description": "Filter exports by run ID"
},
"session_id": {
"type": "string",
"description": "Filter exports by session ID"
},
"app_id": {
"type": "string",
"description": "Filter exports by app ID"
},
"org_id": {
"type": "string",
"description": "Filter exports by organization ID"
},
"project_id": {
"type": "string",
"description": "Filter exports by project ID"
}
}
}
}
},
"required": true
},
"responses": {
"201": {
"description": "Export created successfully",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Memory export request received. The export will be ready in a few seconds."
},
"id": {
"type": "string",
"format": "uuid",
"example": "550e8400-e29b-41d4-a716-446655440000"
}
},
"required": ["message", "id"]
}
}
}
},
"400": {
"description": "Bad Request",
"content": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Schema is required and must be a valid object"
}
}
}
}
}
}
}
}
},
"/v1/memories/": {
"get": {
"tags": [
Expand Down
Loading
Loading