1408 lines
No EOL
38 KiB
JSON
1408 lines
No EOL
38 KiB
JSON
{
|
|
"openapi": "3.1.0",
|
|
"info": {
|
|
"title": "Agent Memory API",
|
|
"description": "\nA temporal-semantic memory system for AI agents that stores, retrieves, and reasons over memories.\n\n## Features\n\n* **Batch Memory Storage**: Store multiple memories efficiently with automatic fact extraction\n* **Semantic Search**: Find relevant memories using natural language queries\n* **Fact Type Filtering**: Search across world facts, agent actions, and opinions separately\n* **Think Endpoint**: Generate contextual answers based on agent identity and memories\n* **Graph Visualization**: Interactive memory graph visualization\n* **Document Tracking**: Track and manage memory documents with upsert support\n\n## Architecture\n\nThe system uses:\n- **Temporal Links**: Connect memories that are close in time\n- **Semantic Links**: Connect semantically similar memories\n- **Entity Links**: Connect memories that mention the same entities\n- **Spreading Activation**: Intelligent traversal for memory retrieval\n ",
|
|
"contact": {
|
|
"name": "Memory System"
|
|
},
|
|
"license": {
|
|
"name": "Apache 2.0",
|
|
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
|
|
},
|
|
"version": "1.0.0"
|
|
},
|
|
"paths": {
|
|
"/api/graph": {
|
|
"get": {
|
|
"tags": [
|
|
"Visualization"
|
|
],
|
|
"summary": "Get memory graph data",
|
|
"description": "Retrieve graph data for visualization, optionally filtered by agent_id and fact_type (world/agent/opinion). Limited to 1000 most recent items.",
|
|
"operationId": "api_graph_api_graph_get",
|
|
"parameters": [
|
|
{
|
|
"name": "agent_id",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Agent Id"
|
|
}
|
|
},
|
|
{
|
|
"name": "fact_type",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Fact Type"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/GraphDataResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/list": {
|
|
"get": {
|
|
"tags": [
|
|
"Visualization"
|
|
],
|
|
"summary": "List memory units",
|
|
"description": "List memory units with pagination and optional full-text search. Supports filtering by agent_id and fact_type.",
|
|
"operationId": "api_list_api_list_get",
|
|
"parameters": [
|
|
{
|
|
"name": "agent_id",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Agent Id"
|
|
}
|
|
},
|
|
{
|
|
"name": "fact_type",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Fact Type"
|
|
}
|
|
},
|
|
{
|
|
"name": "q",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Q"
|
|
}
|
|
},
|
|
{
|
|
"name": "limit",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "integer",
|
|
"default": 100,
|
|
"title": "Limit"
|
|
}
|
|
},
|
|
{
|
|
"name": "offset",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "integer",
|
|
"default": 0,
|
|
"title": "Offset"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ListMemoryUnitsResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/search": {
|
|
"post": {
|
|
"tags": [
|
|
"Search"
|
|
],
|
|
"summary": "Search memory",
|
|
"description": "Search memory using semantic similarity and spreading activation.\n\n The fact_type parameter is required and must be one of:\n - 'world': General knowledge about people, places, events, and things that happen\n - 'agent': Memories about what the AI agent did, actions taken, and tasks performed\n - 'opinion': The agent's formed beliefs, perspectives, and viewpoints",
|
|
"operationId": "api_search_api_search_post",
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/SearchRequest"
|
|
}
|
|
}
|
|
},
|
|
"required": true
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/SearchResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/think": {
|
|
"post": {
|
|
"tags": [
|
|
"Reasoning"
|
|
],
|
|
"summary": "Think and generate answer",
|
|
"description": "Think and formulate an answer using agent identity, world facts, and opinions.\n\n This endpoint:\n 1. Retrieves agent facts (agent's identity)\n 2. Retrieves world facts relevant to the query\n 3. Retrieves existing opinions (agent's perspectives)\n 4. Uses LLM to formulate a contextual answer\n 5. Extracts and stores any new opinions formed\n 6. Returns plain text answer, the facts used, and new opinions",
|
|
"operationId": "api_think_api_think_post",
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ThinkRequest"
|
|
}
|
|
}
|
|
},
|
|
"required": true
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ThinkResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/agents": {
|
|
"get": {
|
|
"tags": [
|
|
"Management"
|
|
],
|
|
"summary": "List all agents",
|
|
"description": "Get a list of all agent IDs that have stored memories in the system",
|
|
"operationId": "api_agents_api_agents_get",
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/AgentsResponse"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/stats/{agent_id}": {
|
|
"get": {
|
|
"tags": [
|
|
"Memory Statistics"
|
|
],
|
|
"summary": "Get memory statistics for an agent",
|
|
"description": "Get statistics about nodes and links for a specific agent",
|
|
"operationId": "api_stats_api_stats__agent_id__get",
|
|
"parameters": [
|
|
{
|
|
"name": "agent_id",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"title": "Agent Id"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/documents": {
|
|
"get": {
|
|
"tags": [
|
|
"Documents"
|
|
],
|
|
"summary": "List documents",
|
|
"description": "List documents with pagination and optional search. Documents are the source content from which memory units are extracted.",
|
|
"operationId": "api_list_documents_api_documents_get",
|
|
"parameters": [
|
|
{
|
|
"name": "agent_id",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Agent Id"
|
|
}
|
|
},
|
|
{
|
|
"name": "q",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Q"
|
|
}
|
|
},
|
|
{
|
|
"name": "limit",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "integer",
|
|
"default": 100,
|
|
"title": "Limit"
|
|
}
|
|
},
|
|
{
|
|
"name": "offset",
|
|
"in": "query",
|
|
"required": false,
|
|
"schema": {
|
|
"type": "integer",
|
|
"default": 0,
|
|
"title": "Offset"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ListDocumentsResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/documents/{document_id}": {
|
|
"get": {
|
|
"tags": [
|
|
"Documents"
|
|
],
|
|
"summary": "Get document details",
|
|
"description": "Get a specific document including its original text",
|
|
"operationId": "api_get_document_api_documents__document_id__get",
|
|
"parameters": [
|
|
{
|
|
"name": "document_id",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"title": "Document Id"
|
|
}
|
|
},
|
|
{
|
|
"name": "agent_id",
|
|
"in": "query",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"title": "Agent Id"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/DocumentResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/memories/batch": {
|
|
"post": {
|
|
"tags": [
|
|
"Memory Storage"
|
|
],
|
|
"summary": "Store multiple memories",
|
|
"description": "Store multiple memory items in batch with automatic fact extraction.\n\n Features:\n - Efficient batch processing\n - Automatic fact extraction from natural language\n - Entity recognition and linking\n - Document tracking with optional upsert\n - Temporal and semantic linking\n\n The system automatically:\n 1. Extracts semantic facts from the content\n 2. Generates embeddings\n 3. Deduplicates similar facts\n 4. Creates temporal, semantic, and entity links\n 5. Tracks document metadata",
|
|
"operationId": "api_batch_put_api_memories_batch_post",
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/BatchPutRequest"
|
|
}
|
|
}
|
|
},
|
|
"required": true
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/BatchPutResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/memories/batch_async": {
|
|
"post": {
|
|
"tags": [
|
|
"Memory Storage"
|
|
],
|
|
"summary": "Store multiple memories asynchronously",
|
|
"description": "Store multiple memory items in batch asynchronously using the task backend.\n\n This endpoint returns immediately after queuing the task, without waiting for completion.\n The actual processing happens in the background.\n\n Features:\n - Immediate response (non-blocking)\n - Background processing via task queue\n - Efficient batch processing\n - Automatic fact extraction from natural language\n - Entity recognition and linking\n - Document tracking with optional upsert\n - Temporal and semantic linking\n\n The system automatically:\n 1. Queues the batch put task\n 2. Returns immediately with success=True, queued=True\n 3. Processes in background: extracts facts, generates embeddings, creates links",
|
|
"operationId": "api_batch_put_async_api_memories_batch_async_post",
|
|
"requestBody": {
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/BatchPutRequest"
|
|
}
|
|
}
|
|
},
|
|
"required": true
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/BatchPutAsyncResponse"
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/operations/{agent_id}": {
|
|
"get": {
|
|
"tags": [
|
|
"Memory Storage"
|
|
],
|
|
"summary": "List async operations",
|
|
"description": "Get a list of all async operations (pending and failed) for a specific agent, including error messages for failed operations",
|
|
"operationId": "api_list_operations_api_operations__agent_id__get",
|
|
"parameters": [
|
|
{
|
|
"name": "agent_id",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"title": "Agent Id"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/operations/{operation_id}": {
|
|
"delete": {
|
|
"tags": [
|
|
"Memory Storage"
|
|
],
|
|
"summary": "Cancel a pending async operation",
|
|
"description": "Cancel a pending async operation by removing it from the queue",
|
|
"operationId": "api_cancel_operation_api_operations__operation_id__delete",
|
|
"parameters": [
|
|
{
|
|
"name": "operation_id",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"title": "Operation Id"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/memory/{unit_id}": {
|
|
"delete": {
|
|
"tags": [
|
|
"Memory Storage"
|
|
],
|
|
"summary": "Delete a memory unit",
|
|
"description": "Delete a single memory unit and all its associated links (temporal, semantic, and entity links)",
|
|
"operationId": "api_delete_memory_unit_api_memory__unit_id__delete",
|
|
"parameters": [
|
|
{
|
|
"name": "unit_id",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"title": "Unit Id"
|
|
}
|
|
}
|
|
],
|
|
"responses": {
|
|
"200": {
|
|
"description": "Successful Response",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {}
|
|
}
|
|
}
|
|
},
|
|
"422": {
|
|
"description": "Validation Error",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/HTTPValidationError"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"components": {
|
|
"schemas": {
|
|
"AgentsResponse": {
|
|
"properties": {
|
|
"agents": {
|
|
"items": {
|
|
"type": "string"
|
|
},
|
|
"type": "array",
|
|
"title": "Agents"
|
|
}
|
|
},
|
|
"type": "object",
|
|
"required": [
|
|
"agents"
|
|
],
|
|
"title": "AgentsResponse",
|
|
"description": "Response model for agents list endpoint.",
|
|
"example": {
|
|
"agents": [
|
|
"user123",
|
|
"agent_alice",
|
|
"agent_bob"
|
|
]
|
|
}
|
|
},
|
|
"BatchPutAsyncResponse": {
|
|
"properties": {
|
|
"success": {
|
|
"type": "boolean",
|
|
"title": "Success"
|
|
},
|
|
"message": {
|
|
"type": "string",
|
|
"title": "Message"
|
|
},
|
|
"agent_id": {
|
|
"type": "string",
|
|
"title": "Agent Id"
|
|
},
|
|
"document_id": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Document Id"
|
|
},
|
|
"items_count": {
|
|
"type": "integer",
|
|
"title": "Items Count"
|
|
},
|
|
"queued": {
|
|
"type": "boolean",
|
|
"title": "Queued"
|
|
}
|
|
},
|
|
"type": "object",
|
|
"required": [
|
|
"success",
|
|
"message",
|
|
"agent_id",
|
|
"items_count",
|
|
"queued"
|
|
],
|
|
"title": "BatchPutAsyncResponse",
|
|
"description": "Response model for async batch put endpoint.",
|
|
"example": {
|
|
"agent_id": "user123",
|
|
"document_id": "conversation_123",
|
|
"items_count": 2,
|
|
"message": "Batch put task queued for background processing",
|
|
"queued": true,
|
|
"success": true
|
|
}
|
|
},
|
|
"BatchPutRequest": {
|
|
"properties": {
|
|
"agent_id": {
|
|
"type": "string",
|
|
"title": "Agent Id"
|
|
},
|
|
"items": {
|
|
"items": {
|
|
"$ref": "#/components/schemas/MemoryItem"
|
|
},
|
|
"type": "array",
|
|
"title": "Items"
|
|
},
|
|
"document_id": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Document Id"
|
|
},
|
|
"document_metadata": {
|
|
"anyOf": [
|
|
{
|
|
"additionalProperties": true,
|
|
"type": "object"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Document Metadata"
|
|
},
|
|
"upsert": {
|
|
"type": "boolean",
|
|
"title": "Upsert",
|
|
"default": false
|
|
}
|
|
},
|
|
"type": "object",
|
|
"required": [
|
|
"agent_id",
|
|
"items"
|
|
],
|
|
"title": "BatchPutRequest",
|
|
"description": "Request model for batch put endpoint.",
|
|
"example": {
|
|
"agent_id": "user123",
|
|
"document_id": "conversation_123",
|
|
"items": [
|
|
{
|
|
"content": "Alice works at Google",
|
|
"context": "work"
|
|
},
|
|
{
|
|
"content": "Bob went hiking yesterday",
|
|
"event_date": "2024-01-15T10:00:00Z"
|
|
}
|
|
],
|
|
"upsert": false
|
|
}
|
|
},
|
|
"BatchPutResponse": {
|
|
"properties": {
|
|
"success": {
|
|
"type": "boolean",
|
|
"title": "Success"
|
|
},
|
|
"message": {
|
|
"type": "string",
|
|
"title": "Message"
|
|
},
|
|
"agent_id": {
|
|
"type": "string",
|
|
"title": "Agent Id"
|
|
},
|
|
"document_id": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Document Id"
|
|
},
|
|
"items_count": {
|
|
"type": "integer",
|
|
"title": "Items Count"
|
|
}
|
|
},
|
|
"type": "object",
|
|
"required": [
|
|
"success",
|
|
"message",
|
|
"agent_id",
|
|
"items_count"
|
|
],
|
|
"title": "BatchPutResponse",
|
|
"description": "Response model for batch put endpoint.",
|
|
"example": {
|
|
"agent_id": "user123",
|
|
"document_id": "conversation_123",
|
|
"items_count": 2,
|
|
"message": "Successfully stored 2 memory items",
|
|
"success": true
|
|
}
|
|
},
|
|
"DocumentResponse": {
|
|
"properties": {
|
|
"id": {
|
|
"type": "string",
|
|
"title": "Id"
|
|
},
|
|
"agent_id": {
|
|
"type": "string",
|
|
"title": "Agent Id"
|
|
},
|
|
"original_text": {
|
|
"type": "string",
|
|
"title": "Original Text"
|
|
},
|
|
"content_hash": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Content Hash"
|
|
},
|
|
"metadata": {
|
|
"additionalProperties": true,
|
|
"type": "object",
|
|
"title": "Metadata"
|
|
},
|
|
"created_at": {
|
|
"type": "string",
|
|
"title": "Created At"
|
|
},
|
|
"updated_at": {
|
|
"type": "string",
|
|
"title": "Updated At"
|
|
},
|
|
"memory_unit_count": {
|
|
"type": "integer",
|
|
"title": "Memory Unit Count"
|
|
}
|
|
},
|
|
"type": "object",
|
|
"required": [
|
|
"id",
|
|
"agent_id",
|
|
"original_text",
|
|
"content_hash",
|
|
"metadata",
|
|
"created_at",
|
|
"updated_at",
|
|
"memory_unit_count"
|
|
],
|
|
"title": "DocumentResponse",
|
|
"description": "Response model for get document endpoint.",
|
|
"example": {
|
|
"agent_id": "user123",
|
|
"content_hash": "abc123",
|
|
"created_at": "2024-01-15T10:30:00Z",
|
|
"id": "session_1",
|
|
"memory_unit_count": 15,
|
|
"metadata": {
|
|
"source": "conversation"
|
|
},
|
|
"original_text": "Full document text here...",
|
|
"updated_at": "2024-01-15T10:30:00Z"
|
|
}
|
|
},
|
|
"GraphDataResponse": {
|
|
"properties": {
|
|
"nodes": {
|
|
"items": {
|
|
"additionalProperties": true,
|
|
"type": "object"
|
|
},
|
|
"type": "array",
|
|
"title": "Nodes"
|
|
},
|
|
"edges": {
|
|
"items": {
|
|
"additionalProperties": true,
|
|
"type": "object"
|
|
},
|
|
"type": "array",
|
|
"title": "Edges"
|
|
},
|
|
"table_rows": {
|
|
"items": {
|
|
"additionalProperties": true,
|
|
"type": "object"
|
|
},
|
|
"type": "array",
|
|
"title": "Table Rows"
|
|
},
|
|
"total_units": {
|
|
"type": "integer",
|
|
"title": "Total Units"
|
|
}
|
|
},
|
|
"type": "object",
|
|
"required": [
|
|
"nodes",
|
|
"edges",
|
|
"table_rows",
|
|
"total_units"
|
|
],
|
|
"title": "GraphDataResponse",
|
|
"description": "Response model for graph data endpoint.",
|
|
"example": {
|
|
"edges": [
|
|
{
|
|
"from": "1",
|
|
"to": "2",
|
|
"type": "semantic",
|
|
"weight": 0.8
|
|
}
|
|
],
|
|
"nodes": [
|
|
{
|
|
"id": "1",
|
|
"label": "Alice works at Google",
|
|
"type": "world"
|
|
},
|
|
{
|
|
"id": "2",
|
|
"label": "Bob went hiking",
|
|
"type": "world"
|
|
}
|
|
],
|
|
"table_rows": [
|
|
{
|
|
"context": "Work info",
|
|
"date": "2024-01-15 10:30",
|
|
"entities": "Alice (PERSON), Google (ORGANIZATION)",
|
|
"id": "abc12345...",
|
|
"text": "Alice works at Google"
|
|
}
|
|
],
|
|
"total_units": 2
|
|
}
|
|
},
|
|
"HTTPValidationError": {
|
|
"properties": {
|
|
"detail": {
|
|
"items": {
|
|
"$ref": "#/components/schemas/ValidationError"
|
|
},
|
|
"type": "array",
|
|
"title": "Detail"
|
|
}
|
|
},
|
|
"type": "object",
|
|
"title": "HTTPValidationError"
|
|
},
|
|
"ListDocumentsResponse": {
|
|
"properties": {
|
|
"items": {
|
|
"items": {
|
|
"additionalProperties": true,
|
|
"type": "object"
|
|
},
|
|
"type": "array",
|
|
"title": "Items"
|
|
},
|
|
"total": {
|
|
"type": "integer",
|
|
"title": "Total"
|
|
},
|
|
"limit": {
|
|
"type": "integer",
|
|
"title": "Limit"
|
|
},
|
|
"offset": {
|
|
"type": "integer",
|
|
"title": "Offset"
|
|
}
|
|
},
|
|
"type": "object",
|
|
"required": [
|
|
"items",
|
|
"total",
|
|
"limit",
|
|
"offset"
|
|
],
|
|
"title": "ListDocumentsResponse",
|
|
"description": "Response model for list documents endpoint.",
|
|
"example": {
|
|
"items": [
|
|
{
|
|
"agent_id": "user123",
|
|
"content_hash": "abc123",
|
|
"created_at": "2024-01-15T10:30:00Z",
|
|
"id": "session_1",
|
|
"memory_unit_count": 15,
|
|
"metadata": {
|
|
"source": "conversation"
|
|
},
|
|
"text_length": 5420,
|
|
"updated_at": "2024-01-15T10:30:00Z"
|
|
}
|
|
],
|
|
"limit": 100,
|
|
"offset": 0,
|
|
"total": 50
|
|
}
|
|
},
|
|
"ListMemoryUnitsResponse": {
|
|
"properties": {
|
|
"items": {
|
|
"items": {
|
|
"additionalProperties": true,
|
|
"type": "object"
|
|
},
|
|
"type": "array",
|
|
"title": "Items"
|
|
},
|
|
"total": {
|
|
"type": "integer",
|
|
"title": "Total"
|
|
},
|
|
"limit": {
|
|
"type": "integer",
|
|
"title": "Limit"
|
|
},
|
|
"offset": {
|
|
"type": "integer",
|
|
"title": "Offset"
|
|
}
|
|
},
|
|
"type": "object",
|
|
"required": [
|
|
"items",
|
|
"total",
|
|
"limit",
|
|
"offset"
|
|
],
|
|
"title": "ListMemoryUnitsResponse",
|
|
"description": "Response model for list memory units endpoint.",
|
|
"example": {
|
|
"items": [
|
|
{
|
|
"context": "Work conversation",
|
|
"date": "2024-01-15T10:30:00Z",
|
|
"entities": "Alice (PERSON), Google (ORGANIZATION)",
|
|
"fact_type": "world",
|
|
"id": "550e8400-e29b-41d4-a716-446655440000",
|
|
"text": "Alice works at Google on the AI team"
|
|
}
|
|
],
|
|
"limit": 100,
|
|
"offset": 0,
|
|
"total": 150
|
|
}
|
|
},
|
|
"MemoryItem": {
|
|
"properties": {
|
|
"content": {
|
|
"type": "string",
|
|
"title": "Content"
|
|
},
|
|
"event_date": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string",
|
|
"format": "date-time"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Event Date"
|
|
},
|
|
"context": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Context"
|
|
}
|
|
},
|
|
"type": "object",
|
|
"required": [
|
|
"content"
|
|
],
|
|
"title": "MemoryItem",
|
|
"description": "Single memory item for batch put.",
|
|
"example": {
|
|
"content": "Alice mentioned she's working on a new ML model",
|
|
"context": "team meeting",
|
|
"event_date": "2024-01-15T10:30:00Z"
|
|
}
|
|
},
|
|
"OpinionItem": {
|
|
"properties": {
|
|
"text": {
|
|
"type": "string",
|
|
"title": "Text"
|
|
},
|
|
"confidence": {
|
|
"type": "number",
|
|
"title": "Confidence"
|
|
}
|
|
},
|
|
"type": "object",
|
|
"required": [
|
|
"text",
|
|
"confidence"
|
|
],
|
|
"title": "OpinionItem",
|
|
"description": "Model for an opinion with confidence score."
|
|
},
|
|
"SearchRequest": {
|
|
"properties": {
|
|
"query": {
|
|
"type": "string",
|
|
"title": "Query"
|
|
},
|
|
"fact_type": {
|
|
"type": "string",
|
|
"title": "Fact Type"
|
|
},
|
|
"agent_id": {
|
|
"type": "string",
|
|
"title": "Agent Id",
|
|
"default": "default"
|
|
},
|
|
"thinking_budget": {
|
|
"type": "integer",
|
|
"title": "Thinking Budget",
|
|
"default": 100
|
|
},
|
|
"max_tokens": {
|
|
"type": "integer",
|
|
"title": "Max Tokens",
|
|
"default": 4096
|
|
},
|
|
"reranker": {
|
|
"type": "string",
|
|
"title": "Reranker",
|
|
"default": "heuristic"
|
|
},
|
|
"trace": {
|
|
"type": "boolean",
|
|
"title": "Trace",
|
|
"default": false
|
|
}
|
|
},
|
|
"type": "object",
|
|
"required": [
|
|
"query",
|
|
"fact_type"
|
|
],
|
|
"title": "SearchRequest",
|
|
"description": "Request model for search endpoint.",
|
|
"example": {
|
|
"agent_id": "user123",
|
|
"fact_type": "world",
|
|
"max_tokens": 4096,
|
|
"query": "What did Alice say about machine learning?",
|
|
"reranker": "heuristic",
|
|
"thinking_budget": 100,
|
|
"trace": true
|
|
}
|
|
},
|
|
"SearchResponse": {
|
|
"properties": {
|
|
"results": {
|
|
"items": {
|
|
"additionalProperties": true,
|
|
"type": "object"
|
|
},
|
|
"type": "array",
|
|
"title": "Results"
|
|
},
|
|
"trace": {
|
|
"anyOf": [
|
|
{
|
|
"additionalProperties": true,
|
|
"type": "object"
|
|
},
|
|
{
|
|
"type": "null"
|
|
}
|
|
],
|
|
"title": "Trace"
|
|
}
|
|
},
|
|
"type": "object",
|
|
"required": [
|
|
"results"
|
|
],
|
|
"title": "SearchResponse",
|
|
"description": "Response model for search endpoints.",
|
|
"example": {
|
|
"results": [
|
|
{
|
|
"id": "123e4567-e89b-12d3-a456-426614174000",
|
|
"score": 0.95,
|
|
"text": "Alice works at Google on the AI team"
|
|
}
|
|
],
|
|
"trace": {
|
|
"num_results": 1,
|
|
"query": "What did Alice say about machine learning?",
|
|
"time_seconds": 0.123
|
|
}
|
|
}
|
|
},
|
|
"ThinkRequest": {
|
|
"properties": {
|
|
"query": {
|
|
"type": "string",
|
|
"title": "Query"
|
|
},
|
|
"agent_id": {
|
|
"type": "string",
|
|
"title": "Agent Id",
|
|
"default": "default"
|
|
},
|
|
"thinking_budget": {
|
|
"type": "integer",
|
|
"title": "Thinking Budget",
|
|
"default": 50
|
|
}
|
|
},
|
|
"type": "object",
|
|
"required": [
|
|
"query"
|
|
],
|
|
"title": "ThinkRequest",
|
|
"description": "Request model for think endpoint.",
|
|
"example": {
|
|
"agent_id": "user123",
|
|
"query": "What do you think about artificial intelligence?",
|
|
"thinking_budget": 50
|
|
}
|
|
},
|
|
"ThinkResponse": {
|
|
"properties": {
|
|
"text": {
|
|
"type": "string",
|
|
"title": "Text"
|
|
},
|
|
"based_on": {
|
|
"additionalProperties": {
|
|
"items": {
|
|
"additionalProperties": true,
|
|
"type": "object"
|
|
},
|
|
"type": "array"
|
|
},
|
|
"type": "object",
|
|
"title": "Based On"
|
|
},
|
|
"new_opinions": {
|
|
"items": {
|
|
"$ref": "#/components/schemas/OpinionItem"
|
|
},
|
|
"type": "array",
|
|
"title": "New Opinions",
|
|
"default": []
|
|
}
|
|
},
|
|
"type": "object",
|
|
"required": [
|
|
"text",
|
|
"based_on"
|
|
],
|
|
"title": "ThinkResponse",
|
|
"description": "Response model for think endpoint.",
|
|
"example": {
|
|
"based_on": {
|
|
"agent": [
|
|
{
|
|
"score": 0.85,
|
|
"text": "I discussed AI applications last week"
|
|
}
|
|
],
|
|
"opinion": [
|
|
{
|
|
"score": 0.8,
|
|
"text": "I believe AI should be used ethically"
|
|
}
|
|
],
|
|
"world": [
|
|
{
|
|
"score": 0.9,
|
|
"text": "AI is used in healthcare"
|
|
}
|
|
]
|
|
},
|
|
"new_opinions": [
|
|
{
|
|
"confidence": 0.95,
|
|
"text": "AI has great potential when used responsibly"
|
|
}
|
|
],
|
|
"text": "Based on my understanding, AI is a transformative technology..."
|
|
}
|
|
},
|
|
"ValidationError": {
|
|
"properties": {
|
|
"loc": {
|
|
"items": {
|
|
"anyOf": [
|
|
{
|
|
"type": "string"
|
|
},
|
|
{
|
|
"type": "integer"
|
|
}
|
|
]
|
|
},
|
|
"type": "array",
|
|
"title": "Location"
|
|
},
|
|
"msg": {
|
|
"type": "string",
|
|
"title": "Message"
|
|
},
|
|
"type": {
|
|
"type": "string",
|
|
"title": "Error Type"
|
|
}
|
|
},
|
|
"type": "object",
|
|
"required": [
|
|
"loc",
|
|
"msg",
|
|
"type"
|
|
],
|
|
"title": "ValidationError"
|
|
}
|
|
}
|
|
}
|
|
} |