From c4255ad2fc39acd9fdb24d69ad8127ba7298222c Mon Sep 17 00:00:00 2001 From: emrgnt-cmplxty Date: Mon, 4 Nov 2024 08:29:57 -0800 Subject: [PATCH] checkin progress --- docs/api-reference/openapi.json | 2 +- py/core/main/api/v3/chunks_router.py | 239 ++++++++- py/core/main/api/v3/documents_router.py | 254 +++++++++- py/core/main/api/v3/indices_router.py | 361 +++++++++++++- py/core/main/api/v3/retrieval_router.py | 353 +++++++++++++- py/core/main/api/v3/users_router.py | 512 ++++++++++++++++++-- py/core/main/app.py | 10 +- py/shared/api/models/retrieval/responses.py | 90 ++-- 8 files changed, 1657 insertions(+), 164 deletions(-) diff --git a/docs/api-reference/openapi.json b/docs/api-reference/openapi.json index 5fcba70cc..bc10edafd 100644 --- a/docs/api-reference/openapi.json +++ b/docs/api-reference/openapi.json @@ -1 +1 @@ -{"openapi":"3.1.0","info":{"title":"R2R Application API","version":"1.0.0"},"paths":{"/v2/ingest_files":{"post":{"summary":"Ingest Files App","description":"Ingest files into the system.\n\nThis endpoint supports multipart/form-data requests, enabling you to ingest files and their associated metadatas into R2R.\n\nA valid user authentication token is required to access this endpoint, as regular users can only ingest files for their own access. More expansive collection permissioning is under development.","operationId":"ingest_files_app_v2_ingest_files_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_ingest_files_app_v2_ingest_files_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_list_IngestionResponse__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}],"x-codeSamples":[{"lang":"Python","source":"from r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n# when using auth, do client.login(...)\n\nresult = client.ingest_files(\n file_paths=[\"pg_essay_1.html\", \"got.txt\"],\n metadatas=[{\"metadata_1\":\"some random metadata\"}, {\"metadata_2\": \"some other random metadata\"}],\n document_ids=None\n)\n"},{"lang":"Shell","source":"curl -X POST \"https://api.example.com/ingest_files\" \\\n -H \"Content-Type: multipart/form-data\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -F \"file=@pg_essay_1.html;type=text/html\" \\\n -F \"file=@got.txt;type=text/plain\" \\\n -F 'metadatas=[{},{}]' \\\n -F 'document_ids=null'\n"}]}},"/v2/update_files":{"post":{"summary":"Update Files App","description":"Update existing files in the system.\n\nThis endpoint supports multipart/form-data requests, enabling you to update files and their associated metadatas into R2R.\n\nA valid user authentication token is required to access this endpoint, as regular users can only update their own files. More expansive collection permissioning is under development.","operationId":"update_files_app_v2_update_files_post","requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_update_files_app_v2_update_files_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_UpdateResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}],"x-codeSamples":[{"lang":"Python","source":"from r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n# when using auth, do client.login(...)\n\nresult = client.update_files(\n file_paths=[\"pg_essay_1_v2.txt\"],\n document_ids=[\"b4ac4dd6-5f27-596e-a55b-7cf242ca30aa\"]\n)\n"},{"lang":"Shell","source":"curl -X POST \"https://api.example.com/update_files\" \\\n -H \"Content-Type: multipart/form-data\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -F \"file=@pg_essay_1_v2.txt;type=text/plain\" \\\n -F 'document_ids=[\"b4ac4dd6-5f27-596e-a55b-7cf242ca30aa\"]'\n"}]}},"/v2/ingest_chunks":{"post":{"summary":"Ingest Chunks App","description":"Ingest text chunks into the system.\n\nThis endpoint supports multipart/form-data requests, enabling you to ingest pre-parsed text chunks into R2R.\n\nA valid user authentication token is required to access this endpoint, as regular users can only ingest chunks for their own access. More expansive collection permissioning is under development.","operationId":"ingest_chunks_app_v2_ingest_chunks_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_ingest_chunks_app_v2_ingest_chunks_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_list_IngestionResponse__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}],"x-codeSamples":[{"lang":"Python","source":"from r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n# when using auth, do client.login(...)\n\nresult = client.ingest_chunks(\n chunks=[\n {\n \"text\": \"Another chunk of text\",\n },\n {\n \"text\": \"Yet another chunk of text\",\n },\n {\n \"text\": \"A chunk of text\",\n },\n ],\n)\n"},{"lang":"Shell","source":"curl -X POST \"https://api.example.com/ingest_chunks\" \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -d '{\n \"chunks\": [\n {\n \"text\": \"Another chunk of text\"\n },\n {\n \"text\": \"Yet another chunk of text\"\n },\n {\n \"text\": \"A chunk of text\"\n }\n ],\n \"document_id\": \"b4ac4dd6-5f27-596e-a55b-7cf242ca30aa\",\n \"metadata\": {}\n }'\n"}]}},"/v2/update_chunk/{document_id}/{chunk_id}":{"put":{"summary":"Update Chunk App","operationId":"update_chunk_app_v2_update_chunk__document_id___extraction_id__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"The document ID of the chunk to update","title":"Document Id"},"description":"The document ID of the chunk to update"},{"name":"chunk_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"The extraction ID of the chunk to update","title":"Extraction Id"},"description":"The extraction ID of the chunk to update"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_update_chunk_app_v2_update_chunk__document_id___extraction_id__put"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_UpdateResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/create_vector_index":{"post":{"summary":"Create Vector Index App","description":"Create a vector index for a given table.","operationId":"create_vector_index_app_v2_create_vector_index_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_create_vector_index_app_v2_create_vector_index_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_CreateVectorIndexResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}],"x-codeSamples":[{"lang":"Python","source":"from r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n# when using auth, do client.login(...)\n\nresult = client.create_vector_index(\n table_name=\"vectors\",\n index_method=\"hnsw\",\n index_measure=\"cosine_distance\",\n index_arguments={\"m\": 16, \"ef_construction\": 64},\n concurrently=True\n)\n"},{"lang":"Shell","source":"curl -X POST \"http://localhost:7276/v2/create_vector_index\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"table_name\": \"vectors\",\n \"index_method\": \"hnsw\",\n \"index_measure\": \"cosine_distance\",\n \"index_arguments\": {\n \"m\": 16,\n \"ef_construction\": 64\n },\n \"concurrently\": true\n }'\n"}]}},"/v2/list_vector_indices":{"get":{"summary":"List Vector Indices App","operationId":"list_vector_indices_app_v2_list_vector_indices_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"table_name","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/VectorTableName"},{"type":"null"}],"description":"The table to create the index on. Default: vectors","default":"vectors","title":"Table Name"},"description":"The table to create the index on. Default: vectors"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_ListVectorIndicesResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-codeSamples":[{"lang":"Python","source":"from r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n# when using auth, do client.login(...)\n\nresult = client.create_vector_index(\n table_name=\"vectors\",\n index_method=\"hnsw\",\n index_measure=\"cosine_distance\",\n index_arguments={\"m\": 16, \"ef_construction\": 64},\n concurrently=True\n)\n"},{"lang":"Shell","source":"curl -X POST \"http://localhost:7276/v2/create_vector_index\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"table_name\": \"vectors\",\n \"index_method\": \"hnsw\",\n \"index_measure\": \"cosine_distance\",\n \"index_arguments\": {\n \"m\": 16,\n \"ef_construction\": 64\n },\n \"concurrently\": true\n }'\n"}]}},"/v2/delete_vector_index":{"delete":{"summary":"Delete Vector Index App","operationId":"delete_vector_index_app_v2_delete_vector_index_delete","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_delete_vector_index_app_v2_delete_vector_index_delete"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_DeleteVectorIndexResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}],"x-codeSamples":[{"lang":"Python","source":"from r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n# when using auth, do client.login(...)\n\nresult = client.delete_vector_index(\n index_name=\"ix_vector_cosine_ops_hnsw__20241021211541\",\n table_name=\"vectors\",\n concurrently=True\n)\n"},{"lang":"Shell","source":"curl -X DELETE \"http://localhost:7276/v2/delete_vector_index\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\n \"index_name\": \"ix_vector_cosine_ops_hnsw__20241021211541\",\n \"table_name\": \"vectors\",\n \"concurrently\": true\n }'\n"}]}},"/v2/health":{"get":{"summary":"Health Check","operationId":"health_check_v2_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}},"/v2/server_stats":{"get":{"summary":"Server Stats","operationId":"server_stats_v2_server_stats_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_ServerStats_"}}}}},"security":[{"HTTPBearer":[]}]}},"/v2/update_prompt":{"post":{"summary":"Update Prompt App","operationId":"update_prompt_app_v2_update_prompt_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_update_prompt_app_v2_update_prompt_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_UpdatePromptResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/v2/add_prompt":{"post":{"summary":"Add Prompt App","operationId":"add_prompt_app_v2_add_prompt_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_add_prompt_app_v2_add_prompt_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_UpdatePromptResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/v2/get_prompt/{prompt_name}":{"get":{"summary":"Get Prompt App","operationId":"get_prompt_app_v2_get_prompt__prompt_name__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"prompt_name","in":"path","required":true,"schema":{"type":"string","description":"Prompt name","title":"Prompt Name"},"description":"Prompt name"},{"name":"inputs","in":"query","required":false,"schema":{"anyOf":[{"type":"string","contentMediaType":"application/json","contentSchema":{"type":"object"}},{"type":"null"}],"description":"JSON-encoded prompt inputs","title":"Inputs"},"description":"JSON-encoded prompt inputs"},{"name":"prompt_override","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Prompt override","title":"Prompt Override"},"description":"Prompt override"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_UpdatePromptResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/get_all_prompts":{"get":{"summary":"Get All Prompts App","operationId":"get_all_prompts_app_v2_get_all_prompts_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_AllPromptsResponse_"}}}}},"security":[{"HTTPBearer":[]}]}},"/v2/delete_prompt/{prompt_name}":{"delete":{"summary":"Delete Prompt App","operationId":"delete_prompt_app_v2_delete_prompt__prompt_name__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"prompt_name","in":"path","required":true,"schema":{"type":"string","description":"Prompt name","title":"Prompt Name"},"description":"Prompt name"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_NoneType_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/analytics":{"get":{"summary":"Get Analytics App","operationId":"get_analytics_app_v2_analytics_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"filter_criteria","in":"query","required":false,"schema":{"anyOf":[{"type":"string","contentMediaType":"application/json","contentSchema":{"type":"object"}},{"type":"null"}],"default":{},"title":"Filter Criteria"}},{"name":"analysis_types","in":"query","required":false,"schema":{"anyOf":[{"type":"string","contentMediaType":"application/json","contentSchema":{"type":"object"}},{"type":"null"}],"default":{},"title":"Analysis Types"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_AnalyticsResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/logs":{"get":{"summary":"Logs App","operationId":"logs_app_v2_logs_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"run_type_filter","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"default":"","title":"Run Type Filter"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_list_LogResponse__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/app_settings":{"get":{"summary":"App Settings","operationId":"app_settings_v2_app_settings_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_AppSettingsResponse_"}}}}},"security":[{"HTTPBearer":[]}]}},"/v2/users_overview":{"get":{"summary":"Users Overview App","operationId":"users_overview_app_v2_users_overview_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"user_ids","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"default":[],"title":"User Ids"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResultsWrapper_list_UserOverviewResponse__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/delete":{"delete":{"summary":"Delete App","operationId":"delete_app_v2_delete_delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"filters","in":"query","required":true,"schema":{"type":"string","description":"JSON-encoded filters","title":"Filters"},"description":"JSON-encoded filters"}],"responses":{"204":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/download_file/{document_id}":{"get":{"summary":"Download File App","description":"Download a file by its document ID as a stream.","operationId":"download_file_app_v2_download_file__document_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","description":"Document ID","title":"Document Id"},"description":"Document ID"}],"responses":{"200":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/documents_overview":{"get":{"summary":"Documents Overview App","operationId":"documents_overview_app_v2_documents_overview_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"document_ids","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"},"default":[],"title":"Document Ids"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","minimum":-1,"description":"Number of items to return. Use -1 to return all items.","default":100,"title":"Limit"},"description":"Number of items to return. Use -1 to return all items."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResultsWrapper_list_DocumentOverviewResponse__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/document_chunks/{document_id}":{"get":{"summary":"Document Chunks App","operationId":"document_chunks_app_v2_document_chunks__document_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","title":"Document Id"}},{"name":"offset","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}],"default":0,"title":"Offset"}},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}],"default":100,"title":"Limit"}},{"name":"include_vectors","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":"null"}],"default":false,"title":"Include Vectors"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResultsWrapper_list_DocumentChunkResponse__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/collections_overview":{"get":{"summary":"Collections Overview App","operationId":"collections_overview_app_v2_collections_overview_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"collection_ids","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"title":"Collection Ids"}},{"name":"offset","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":0},{"type":"null"}],"default":0,"title":"Offset"}},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":1000,"minimum":1},{"type":"null"}],"default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_list_CollectionOverviewResponse__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/create_collection":{"post":{"summary":"Create Collection App","operationId":"create_collection_app_v2_create_collection_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_create_collection_app_v2_create_collection_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_CollectionResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/v2/get_collection/{collection_id}":{"get":{"summary":"Get Collection App","operationId":"get_collection_app_v2_get_collection__collection_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"collection_id","in":"path","required":true,"schema":{"type":"string","description":"Collection ID","title":"Collection Id"},"description":"Collection ID"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_CollectionResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/update_collection":{"put":{"summary":"Update Collection App","operationId":"update_collection_app_v2_update_collection_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_update_collection_app_v2_update_collection_put"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_CollectionResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/v2/delete_collection/{collection_id}":{"delete":{"summary":"Delete Collection App","operationId":"delete_collection_app_v2_delete_collection__collection_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"collection_id","in":"path","required":true,"schema":{"type":"string","description":"Collection ID","title":"Collection Id"},"description":"Collection ID"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_NoneType_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/list_collections":{"get":{"summary":"List Collections App","operationId":"list_collections_app_v2_list_collections_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_list_CollectionResponse__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/add_user_to_collection":{"post":{"summary":"Add User To Collection App","operationId":"add_user_to_collection_app_v2_add_user_to_collection_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_add_user_to_collection_app_v2_add_user_to_collection_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_NoneType_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/v2/remove_user_from_collection":{"post":{"summary":"Remove User From Collection App","operationId":"remove_user_from_collection_app_v2_remove_user_from_collection_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_remove_user_from_collection_app_v2_remove_user_from_collection_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/v2/get_users_in_collection/{collection_id}":{"get":{"summary":"Get Users In Collection App","operationId":"get_users_in_collection_app_v2_get_users_in_collection__collection_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"collection_id","in":"path","required":true,"schema":{"type":"string","description":"Collection ID","title":"Collection Id"},"description":"Collection ID"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Pagination offset","default":0,"title":"Offset"},"description":"Pagination offset"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"description":"Pagination limit","default":100,"title":"Limit"},"description":"Pagination limit"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResultsWrapper_list_UserResponse__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/user_collections/{user_id}":{"get":{"summary":"Get Collections For User App","operationId":"get_collections_for_user_app_v2_user_collections__user_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","description":"User ID","title":"User Id"},"description":"User ID"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Pagination offset","default":0,"title":"Offset"},"description":"Pagination offset"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"description":"Pagination limit","default":100,"title":"Limit"},"description":"Pagination limit"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResultsWrapper_list_CollectionResponse__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/assign_document_to_collection":{"post":{"summary":"Assign Document To Collection App","operationId":"assign_document_to_collection_app_v2_assign_document_to_collection_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_assign_document_to_collection_app_v2_assign_document_to_collection_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/v2/remove_document_from_collection":{"post":{"summary":"Remove Document From Collection App","operationId":"remove_document_from_collection_app_v2_remove_document_from_collection_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_remove_document_from_collection_app_v2_remove_document_from_collection_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_NoneType_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/v2/document_collections/{document_id}":{"get":{"summary":"Document Collections App","operationId":"document_collections_app_v2_document_collections__document_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"document_id","in":"path","required":true,"schema":{"type":"string","description":"Document ID","title":"Document Id"},"description":"Document ID"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_list_CollectionResponse__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/collection/{collection_id}/documents":{"get":{"summary":"Documents In Collection App","operationId":"documents_in_collection_app_v2_collection__collection_id__documents_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"collection_id","in":"path","required":true,"schema":{"type":"string","description":"Collection ID","title":"Collection Id"},"description":"Collection ID"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResultsWrapper_list_DocumentOverviewResponse__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/conversations_overview":{"get":{"summary":"Conversations Overview App","operationId":"conversations_overview_app_v2_conversations_overview_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"conversation_ids","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"},"default":[],"title":"Conversation Ids"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResultsWrapper_list_ConversationOverviewResponse__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/get_conversation/{conversation_id}":{"get":{"summary":"Get Conversation","operationId":"get_conversation_v2_get_conversation__conversation_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","description":"Conversation ID","title":"Conversation Id"},"description":"Conversation ID"},{"name":"branch_id","in":"query","required":false,"schema":{"type":"string","description":"Branch ID","title":"Branch Id"},"description":"Branch ID"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_list_Tuple_str__Message___"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/create_conversation":{"post":{"summary":"Create Conversation","operationId":"create_conversation_v2_create_conversation_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Create Conversation V2 Create Conversation Post"}}}}},"security":[{"HTTPBearer":[]}]}},"/v2/add_message/{conversation_id}":{"post":{"summary":"Add Message","operationId":"add_message_v2_add_message__conversation_id__post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","description":"Conversation ID","title":"Conversation Id"},"description":"Conversation ID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_add_message_v2_add_message__conversation_id__post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Add Message V2 Add Message Conversation Id Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/update_message/{message_id}":{"put":{"summary":"Edit Message","operationId":"edit_message_v2_update_message__message_id__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"message_id","in":"path","required":true,"schema":{"type":"string","description":"Message ID","title":"Message Id"},"description":"Message ID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"string","description":"New content","title":"Message"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Edit Message V2 Update Message Message Id Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/branches_overview/{conversation_id}":{"get":{"summary":"Branches Overview","operationId":"branches_overview_v2_branches_overview__conversation_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","description":"Conversation ID","title":"Conversation Id"},"description":"Conversation ID"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Branches Overview V2 Branches Overview Conversation Id Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/delete_conversation/{conversation_id}":{"delete":{"summary":"Delete Conversation","operationId":"delete_conversation_v2_delete_conversation__conversation_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"conversation_id","in":"path","required":true,"schema":{"type":"string","description":"Conversation ID","title":"Conversation Id"},"description":"Conversation ID"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_NoneType_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/search":{"post":{"summary":"Search App","description":"Perform a search query on the vector database and knowledge graph.\n\nThis endpoint allows for complex filtering of search results using PostgreSQL-based queries.\nFilters can be applied to various fields such as document_id, and internal metadata values.\n\n\nAllowed operators include `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `like`, `ilike`, `in`, and `nin`.","operationId":"search_app_v2_search_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_search_app_v2_search_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_SearchResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}],"x-codeSamples":[{"lang":"Python","source":"from r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n# when using auth, do client.login(...)\n\nresult = client.search(\n query=\"Who is Aristotle?\",\n vector_search_settings={\n \"use_vector_search\": True,\n \"filters\": {\"document_id\": {\"$eq\": \"3e157b3a-8469-51db-90d9-52e7d896b49b\"}},\n \"search_limit\": 20,\n \"use_hybrid_search\": True\n },\n kg_search_settings={\n \"use_kg_search\": True, # graph needs to be constructed first\n \"kg_search_type\": \"local\",\n \"kg_search_level\": \"0\",\n \"generation_config\": {\n \"model\": \"gpt-4o-mini\",\n \"temperature\": 0.7,\n },\n \"local_search_limits\": {\n \"__Entity__\": 20,\n \"__Relationship__\": 20,\n \"__Community__\": 20,\n },\n \"max_community_description_length\": 65536,\n \"max_llm_queries_for_global_search\": 250\n }\n)\n"},{"lang":"Shell","source":"curl -X POST \"https://api.example.com/search\" \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -d '{\n \"query\": \"Who is Aristotle?\",\n \"vector_search_settings\": {\n \"use_vector_search\": true,\n \"filters\": {\"document_id\": {\"$eq\": \"3e157b3a-8469-51db-90d9-52e7d896b49b\"}},\n \"search_limit\": 20,\n \"use_hybrid_search\": true\n },\n \"kg_search_settings\": {\n \"use_kg_search\": true, # graph needs to be constructed first\n \"kg_search_type\": \"local\",\n \"kg_search_level\": \"0\",\n \"generation_config\": {\n \"model\": \"gpt-4o-mini\",\n \"temperature\": 0.7\n },\n \"local_search_limits\": {\n \"__Entity__\": 20,\n \"__Relationship__\": 20,\n \"__Community__\": 20,\n },\n \"max_community_description_length\": 65536,\n \"max_llm_queries_for_global_search\": 250\n }\n }'\n"}]}},"/v2/rag":{"post":{"summary":"Rag App","description":"Execute a RAG (Retrieval-Augmented Generation) query.\n\nThis endpoint combines search results with language model generation.\nIt supports the same filtering capabilities as the search endpoint,\nallowing for precise control over the retrieved context.\n\nThe generation process can be customized using the rag_generation_config parameter.","operationId":"rag_app_v2_rag_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_rag_app_v2_rag_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_RAGResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}],"x-codeSamples":[{"lang":"Python","source":"from r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n# when using auth, do client.login(...)\n\nresult = client.rag(\n query=\"Who is Aristotle?\",\n vector_search_settings={\n \"use_vector_search\": True,\n \"filters\": {\"document_id\": {\"$eq\": \"3e157b3a-8469-51db-90d9-52e7d896b49b\"}},\n \"search_limit\": 20,\n \"use_hybrid_search\": True\n },\n kg_search_settings={\n \"use_kg_search\": True,\n \"kg_search_type\": \"local\",\n \"kg_search_level\": \"0\",\n \"generation_config\": {\n \"model\": \"gpt-4o-mini\",\n \"temperature\": 0.7,\n },\n \"local_search_limits\": {\n \"__Entity__\": 20,\n \"__Relationship__\": 20,\n \"__Community__\": 20,\n },\n \"max_community_description_length\": 65536,\n \"max_llm_queries_for_global_search\": 250\n },\n rag_generation_config={\n \"stream\": False,\n \"temperature\": 0.7,\n \"max_tokens\": 150\n }\n)\n"},{"lang":"Shell","source":"curl -X POST \"https://api.example.com/rag\" \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -d '{\n \"query\": \"Who is Aristotle?\",\n \"vector_search_settings\": {\n \"use_vector_search\": true,\n \"filters\": {\"document_id\": {\"$eq\": \"3e157b3a-8469-51db-90d9-52e7d896b49b\"}},\n \"search_limit\": 20,\n \"use_hybrid_search\": True\n },\n \"kg_search_settings\": {\n \"use_kg_search\": true, # graph needs to be constructed first\n \"kg_search_type\": \"local\",\n \"kg_search_level\": \"0\",\n \"generation_config\": {\n \"model\": \"gpt-4o-mini\",\n \"temperature\": 0.7\n },\n \"local_search_limits\": {\n \"__Entity__\": 20,\n \"__Relationship__\": 20,\n \"__Community__\": 20,\n },\n \"max_community_description_length\": 65536,\n \"max_llm_queries_for_global_search\": 250\n },\n \"rag_generation_config\": {\n \"stream\": false,\n \"temperature\": 0.7,\n \"max_tokens\": 150\n }\n }'\n"}]}},"/v2/agent":{"post":{"summary":"Agent App","description":"Implement an agent-based interaction for complex query processing.\n\nThis endpoint supports multi-turn conversations and can handle complex queries\nby breaking them down into sub-tasks. It uses the same filtering capabilities\nas the search and RAG endpoints for retrieving relevant information.\n\nThe agent's behavior can be customized using the rag_generation_config and\ntask_prompt_override parameters.","operationId":"agent_app_v2_agent_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_agent_app_v2_agent_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_RAGAgentResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}],"x-codeSamples":[{"lang":"Python","source":"from r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n# when using auth, do client.login(...)\n\nresult = client.agent(\n messages=[\n {\"role\": \"user\", \"content\": \"Who is the greatest philospher of all time?\"},\n {\"role\": \"assistant\", \"content\": \"Aristotle is widely considered the greatest philospher of all time.\"},\n {\"role\": \"user\", \"content\": \"Can you tell me more about him?\"}\n ],\n vector_search_settings={\n \"use_vector_search\": True,\n \"filters\": {\"document_id\": {\"$eq\": \"5e157b3a-8469-51db-90d9-52e7d896b49b\"}},\n \"search_limit\": 20,\n \"use_hybrid_search\": True\n },\n rag_generation_config={\n \"stream\": False,\n \"temperature\": 0.7,\n \"max_tokens\": 200\n },\n include_title_if_available=True\n)\n"},{"lang":"Shell","source":"curl -X POST \"https://api.example.com/agent\" \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -d '{\n \"messages\": [\n {\"role\": \"user\", \"content\": \"Who is the greatest philospher of all time?\"},\n {\"role\": \"assistant\", \"content\": \"Aristotle is widely considered the greatest philospher of all time.\"},\n {\"role\": \"user\", \"content\": \"Can you tell me more about him?\"}\n ],\n \"vector_search_settings\": {\n \"use_vector_search\": true,\n \"filters\": {\"document_id\": {\"$eq\": \"5e157b3a-8469-51db-90d9-52e7d896b49b\"}},\n \"search_limit\": 20,\n \"use_hybrid_search\": true\n },\n \"kg_search_settings\": {\n \"use_kg_search\": false # to enable this, please read the graphrag cookbook\n },\n \"rag_generation_config\": {\n \"stream\": false,\n \"temperature\": 0.7,\n \"max_tokens\": 200\n },\n \"include_title_if_available\": true\n }'\n"}]}},"/v2/completion":{"post":{"summary":"Completion","description":"Generate completions for a list of messages.\n\nThis endpoint uses the language model to generate completions for the provided messages.\nThe generation process can be customized using the generation_config parameter.","operationId":"completion_v2_completion_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"response_model","in":"query","required":false,"schema":{"title":"Response Model"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_completion_v2_completion_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/register":{"post":{"summary":"Register App","description":"Register a new user with the given email and password.","operationId":"register_app_v2_register_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_register_app_v2_register_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_UserResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/verify_email":{"post":{"summary":"Verify Email App","description":"Verify a user's email address.\n\nThis endpoint is used to confirm a user's email address using the verification code\nsent to their email after registration.","operationId":"verify_email_app_v2_verify_email_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_verify_email_app_v2_verify_email_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_GenericMessageResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/login":{"post":{"summary":"Login App","description":"Authenticate a user and provide access tokens.\n\nThis endpoint authenticates a user using their email (username) and password,\nand returns access and refresh tokens upon successful authentication.","operationId":"login_app_v2_login_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"$ref":"#/components/schemas/Body_login_app_v2_login_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_TokenResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/logout":{"post":{"summary":"Logout App","description":"Log out the current user.\n\nThis endpoint invalidates the user's current access token, effectively logging them out.","operationId":"logout_app_v2_logout_post","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_GenericMessageResponse_"}}}}},"security":[{"OAuth2PasswordBearer":[]},{"HTTPBearer":[]}]}},"/v2/user":{"get":{"summary":"Get User App","description":"Get the current user's profile information.\n\nThis endpoint returns the profile information of the currently authenticated user.","operationId":"get_user_app_v2_user_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_UserResponse_"}}}}},"security":[{"HTTPBearer":[]}]},"put":{"summary":"Put User App","description":"Update the current user's profile information.\n\nThis endpoint allows the authenticated user to update their profile information.","operationId":"put_user_app_v2_user_put","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_put_user_app_v2_user_put"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_UserResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/v2/refresh_access_token":{"post":{"summary":"Refresh Access Token App","description":"Refresh the access token using a refresh token.\n\nThis endpoint allows users to obtain a new access token using their refresh token.","operationId":"refresh_access_token_app_v2_refresh_access_token_post","requestBody":{"content":{"application/json":{"schema":{"type":"string","title":"Refresh Token","description":"Refresh token"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_TokenResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/change_password":{"post":{"summary":"Change Password App","description":"Change the authenticated user's password.\n\nThis endpoint allows users to change their password by providing their current password\nand a new password.","operationId":"change_password_app_v2_change_password_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_change_password_app_v2_change_password_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_GenericMessageResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/v2/request_password_reset":{"post":{"summary":"Request Password Reset App","description":"Request a password reset for a user.\n\nThis endpoint initiates the password reset process by sending a reset link\nto the specified email address.","operationId":"request_password_reset_app_v2_request_password_reset_post","requestBody":{"content":{"application/json":{"schema":{"type":"string","format":"email","title":"Email","description":"User's email address"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_GenericMessageResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/reset_password":{"post":{"summary":"Reset Password App","operationId":"reset_password_app_v2_reset_password_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_reset_password_app_v2_reset_password_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_GenericMessageResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/user/{user_id}":{"delete":{"summary":"Delete User App","description":"Delete a user account.\n\nThis endpoint allows users to delete their own account or, for superusers,\nto delete any user account.","operationId":"delete_user_app_v2_user__user_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","description":"ID of the user to delete","title":"User Id"},"description":"ID of the user to delete"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_delete_user_app_v2_user__user_id__delete"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_GenericMessageResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/create_graph":{"post":{"summary":"Create Graph","description":"Creating a graph on your documents. This endpoint takes input a list of document ids and KGCreationSettings.\nIf document IDs are not provided, the graph will be created on all documents in the system.\nThis step extracts the relevant entities and relationships from the documents and creates a graph based on the extracted information.\nIn order to do GraphRAG, you will need to run the enrich_graph endpoint.","operationId":"create_graph_v2_create_graph_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_create_graph_v2_create_graph_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/v2/enrich_graph":{"post":{"summary":"Enrich Graph","description":"This endpoint enriches the graph with additional information.\nIt creates communities of nodes based on their similarity and adds embeddings to the graph.\nThis step is necessary for GraphRAG to work.","operationId":"enrich_graph_v2_enrich_graph_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_enrich_graph_v2_enrich_graph_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/v2/entities":{"get":{"summary":"Get Entities","description":"Retrieve entities from the knowledge graph.","operationId":"get_entities_v2_entities_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"entity_level","in":"query","required":false,"schema":{"anyOf":[{"$ref":"#/components/schemas/EntityLevel"},{"type":"null"}],"description":"Type of entities to retrieve. Options are: raw, dedup_document, dedup_collection.","default":"document","title":"Entity Level"},"description":"Type of entities to retrieve. Options are: raw, dedup_document, dedup_collection."},{"name":"collection_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"description":"Collection ID to retrieve entities from.","title":"Collection Id"},"description":"Collection ID to retrieve entities from."},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Offset for pagination.","default":0,"title":"Offset"},"description":"Offset for pagination."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"description":"Limit for pagination.","default":100,"title":"Limit"},"description":"Limit for pagination."},{"name":"entity_ids","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Entity IDs to filter by.","title":"Entity Ids"},"description":"Entity IDs to filter by."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_KGEntitiesResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/triples":{"get":{"summary":"Get Triples","description":"Retrieve triples from the knowledge graph.","operationId":"get_triples_v2_triples_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"collection_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"description":"Collection ID to retrieve triples from.","title":"Collection Id"},"description":"Collection ID to retrieve triples from."},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Offset for pagination.","default":0,"title":"Offset"},"description":"Offset for pagination."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"description":"Limit for pagination.","default":100,"title":"Limit"},"description":"Limit for pagination."},{"name":"entity_names","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Entity names to filter by.","title":"Entity Names"},"description":"Entity names to filter by."},{"name":"triple_ids","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"string"}},{"type":"null"}],"description":"Triple IDs to filter by.","title":"Triple Ids"},"description":"Triple IDs to filter by."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_KGTriplesResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/communities":{"get":{"summary":"Get Communities","description":"Retrieve communities from the knowledge graph.","operationId":"get_communities_v2_communities_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"collection_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"description":"Collection ID to retrieve communities from.","title":"Collection Id"},"description":"Collection ID to retrieve communities from."},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Offset for pagination.","default":0,"title":"Offset"},"description":"Offset for pagination."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"description":"Limit for pagination.","default":100,"title":"Limit"},"description":"Limit for pagination."},{"name":"levels","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"integer"}},{"type":"null"}],"description":"Levels to filter by.","title":"Levels"},"description":"Levels to filter by."},{"name":"community_numbers","in":"query","required":false,"schema":{"anyOf":[{"type":"array","items":{"type":"integer"}},{"type":"null"}],"description":"Community numbers to filter by.","title":"Community Numbers"},"description":"Community numbers to filter by."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_KGCommunitiesResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/deduplicate_entities":{"post":{"summary":"Deduplicate Entities","description":"Deduplicate entities in the knowledge graph.","operationId":"deduplicate_entities_v2_deduplicate_entities_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_deduplicate_entities_v2_deduplicate_entities_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_Union_KGEntityDeduplicationResponse__KGDeduplicationEstimationResponse__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/v2/tuned_prompt":{"get":{"summary":"Get Tuned Prompt","description":"Auto-tune the prompt for a specific collection.","operationId":"get_tuned_prompt_v2_tuned_prompt_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"prompt_name","in":"query","required":true,"schema":{"type":"string","description":"The name of the prompt to tune. Valid options are 'kg_triples_extraction_prompt', 'kg_entity_description_prompt' and 'community_reports_prompt'.","title":"Prompt Name"},"description":"The name of the prompt to tune. Valid options are 'kg_triples_extraction_prompt', 'kg_entity_description_prompt' and 'community_reports_prompt'."},{"name":"collection_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"description":"Collection ID to retrieve communities from.","title":"Collection Id"},"description":"Collection ID to retrieve communities from."},{"name":"documents_offset","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Offset for document pagination.","default":0,"title":"Documents Offset"},"description":"Offset for document pagination."},{"name":"documents_limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Limit for document pagination.","default":100,"title":"Documents Limit"},"description":"Limit for document pagination."},{"name":"chunks_offset","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Offset for chunk pagination.","default":0,"title":"Chunks Offset"},"description":"Offset for chunk pagination."},{"name":"chunks_limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer"},{"type":"null"}],"description":"Limit for chunk pagination.","default":100,"title":"Chunks Limit"},"description":"Limit for chunk pagination."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_KGTunePromptResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v2/delete_graph_for_collection":{"delete":{"summary":"Delete Graph For Collection","description":"Delete the graph for a given collection. Note that this endpoint may delete a large amount of data created by the KG pipeline, this deletion is irreversible, and recreating the graph may be an expensive operation.\n\nNotes:\nThe endpoint deletes all communities for a given collection. If the cascade flag is set to true, the endpoint also deletes all the entities and triples associated with the collection.\n\nWARNING: Setting this flag to true will delete entities and triples for documents that are shared across multiple collections. Do not set this flag unless you are absolutely sure that you want to delete the entities and triples for all documents in the collection.","operationId":"delete_graph_for_collection_v2_delete_graph_for_collection_delete","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_delete_graph_for_collection_v2_delete_graph_for_collection_delete"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/v2/openapi_spec":{"get":{"summary":"Openapi Spec","operationId":"openapi_spec_v2_openapi_spec_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}}}}}},"components":{"schemas":{"AllPromptsResponse":{"properties":{"prompts":{"additionalProperties":{"$ref":"#/components/schemas/PromptResponse"},"type":"object","title":"Prompts"}},"type":"object","required":["prompts"],"title":"AllPromptsResponse"},"AnalyticsResponse":{"properties":{"analytics_data":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Analytics Data"},"filtered_logs":{"type":"object","title":"Filtered Logs"}},"type":"object","required":["filtered_logs"],"title":"AnalyticsResponse"},"AppSettingsResponse":{"properties":{"config":{"type":"object","title":"Config"},"prompts":{"type":"object","title":"Prompts"}},"type":"object","required":["config","prompts"],"title":"AppSettingsResponse"},"BaseModel":{"properties":{},"type":"object","title":"BaseModel"},"Body_add_message_v2_add_message__conversation_id__post":{"properties":{"message":{"$ref":"#/components/schemas/Message","description":"Message content"},"parent_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Parent Id","description":"Parent message ID"},"metadata":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Metadata","description":"Metadata"}},"type":"object","required":["message"],"title":"Body_add_message_v2_add_message__conversation_id__post"},"Body_add_prompt_app_v2_add_prompt_post":{"properties":{"name":{"type":"string","title":"Name","description":"Prompt name"},"template":{"type":"string","title":"Template","description":"Prompt template"},"input_types":{"additionalProperties":{"type":"string"},"type":"object","title":"Input Types","description":"Input types","default":{}}},"type":"object","required":["name","template"],"title":"Body_add_prompt_app_v2_add_prompt_post"},"Body_add_user_to_collection_app_v2_add_user_to_collection_post":{"properties":{"user_id":{"type":"string","title":"User Id","description":"User ID"},"collection_id":{"type":"string","title":"Collection Id","description":"Collection ID"}},"type":"object","required":["user_id","collection_id"],"title":"Body_add_user_to_collection_app_v2_add_user_to_collection_post"},"Body_agent_app_v2_agent_post":{"properties":{"message":{"anyOf":[{"$ref":"#/components/schemas/Message"},{"type":"null"}],"description":"Message object"},"messages":{"anyOf":[{"items":{"$ref":"#/components/schemas/Message"},"type":"array"},{"type":"null"}],"title":"Messages","description":"List of message objects (deprecated, use message instead)","deprecated":true},"vector_search_settings":{"$ref":"#/components/schemas/VectorSearchSettings","description":"Vector search settings"},"kg_search_settings":{"$ref":"#/components/schemas/KGSearchSettings","description":"Knowledge graph search settings"},"rag_generation_config":{"$ref":"#/components/schemas/GenerationConfig","description":"RAG generation configuration"},"task_prompt_override":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Task Prompt Override","description":"Task prompt override"},"include_title_if_available":{"type":"boolean","title":"Include Title If Available","description":"Includes document title in chunk response, if available.","default":true},"conversation_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Conversation Id","description":"The ID of the conversation, a new ID is assigned if not provided"},"branch_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Branch Id","description":"The ID of the branch"}},"type":"object","title":"Body_agent_app_v2_agent_post"},"Body_assign_document_to_collection_app_v2_assign_document_to_collection_post":{"properties":{"document_id":{"type":"string","title":"Document Id","description":"Document ID"},"collection_id":{"type":"string","title":"Collection Id","description":"Collection ID"}},"type":"object","required":["document_id","collection_id"],"title":"Body_assign_document_to_collection_app_v2_assign_document_to_collection_post"},"Body_change_password_app_v2_change_password_post":{"properties":{"current_password":{"type":"string","title":"Current Password","description":"Current password"},"new_password":{"type":"string","title":"New Password","description":"New password"}},"type":"object","required":["current_password","new_password"],"title":"Body_change_password_app_v2_change_password_post"},"Body_completion_v2_completion_post":{"properties":{"messages":{"items":{"$ref":"#/components/schemas/Message"},"type":"array","title":"Messages","description":"The messages to complete"},"generation_config":{"$ref":"#/components/schemas/GenerationConfig","description":"The generation config"}},"type":"object","required":["messages"],"title":"Body_completion_v2_completion_post"},"Body_create_collection_app_v2_create_collection_post":{"properties":{"name":{"type":"string","title":"Name","description":"Collection name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Collection description","default":""}},"type":"object","required":["name"],"title":"Body_create_collection_app_v2_create_collection_post"},"Body_create_graph_v2_create_graph_post":{"properties":{"collection_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Collection Id","description":"Collection ID to create graph for."},"run_type":{"anyOf":[{"$ref":"#/components/schemas/KGRunType"},{"type":"null"}],"description":"Run type for the graph creation process."},"kg_creation_settings":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Kg Creation Settings","description":"Settings for the graph creation process."}},"type":"object","title":"Body_create_graph_v2_create_graph_post"},"Body_create_vector_index_app_v2_create_vector_index_post":{"properties":{"table_name":{"anyOf":[{"$ref":"#/components/schemas/VectorTableName"},{"type":"null"}],"description":"The table to create the index on. Default: vectors","default":"vectors"},"index_method":{"$ref":"#/components/schemas/IndexMethod","description":"The indexing method to use. Options: hnsw, ivfflat, auto. Default: hnsw","default":"hnsw"},"index_measure":{"$ref":"#/components/schemas/IndexMeasure","description":"Distance measure for vector comparisons. Options: cosine_distance, l2_distance, max_inner_product. Default: cosine_distance","default":"cosine_distance"},"index_arguments":{"anyOf":[{"$ref":"#/components/schemas/IndexArgsIVFFlat"},{"$ref":"#/components/schemas/IndexArgsHNSW"},{"type":"null"}],"title":"Index Arguments","description":"Configuration parameters for the chosen index method. For HNSW: {m: int, ef_construction: int}. For IVFFlat: {n_lists: int}"},"index_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Index Name","description":"Optional custom name for the index. If not provided, one will be auto-generated"},"index_column":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Index Column","description":"The column containing the vectors to index. Default: `vec`, or `vec_binary` when using hamming or jaccard distance."},"concurrently":{"type":"boolean","title":"Concurrently","description":"Whether to create the index concurrently. Default: true","default":true}},"type":"object","title":"Body_create_vector_index_app_v2_create_vector_index_post"},"Body_deduplicate_entities_v2_deduplicate_entities_post":{"properties":{"collection_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Collection Id","description":"Collection ID to deduplicate entities for."},"run_type":{"anyOf":[{"$ref":"#/components/schemas/KGRunType"},{"type":"null"}],"description":"Run type for the deduplication process."},"deduplication_settings":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Deduplication Settings","description":"Settings for the deduplication process."}},"type":"object","title":"Body_deduplicate_entities_v2_deduplicate_entities_post"},"Body_delete_graph_for_collection_v2_delete_graph_for_collection_delete":{"properties":{"collection_id":{"type":"string","format":"uuid","title":"Collection Id","description":"Collection ID to delete graph for."},"cascade":{"type":"boolean","title":"Cascade","description":"Whether to cascade the deletion, and delete entities and triples belonging to the collection.","default":false}},"type":"object","required":["collection_id"],"title":"Body_delete_graph_for_collection_v2_delete_graph_for_collection_delete"},"Body_delete_user_app_v2_user__user_id__delete":{"properties":{"password":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Password","description":"User's current password"},"delete_vector_data":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Delete Vector Data","description":"Whether to delete the user's vector data","default":false}},"type":"object","title":"Body_delete_user_app_v2_user__user_id__delete"},"Body_delete_vector_index_app_v2_delete_vector_index_delete":{"properties":{"index_name":{"type":"string","title":"Index Name","description":"The name of the index to delete"},"table_name":{"anyOf":[{"$ref":"#/components/schemas/VectorTableName"},{"type":"null"}],"description":"The name of the table containing the index. Default: vectors","default":"vectors"},"concurrently":{"type":"boolean","title":"Concurrently","description":"Whether to delete the index concurrently. Default: true","default":true}},"type":"object","required":["index_name"],"title":"Body_delete_vector_index_app_v2_delete_vector_index_delete"},"Body_enrich_graph_v2_enrich_graph_post":{"properties":{"collection_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Collection Id","description":"Collection ID to enrich graph for."},"run_type":{"anyOf":[{"$ref":"#/components/schemas/KGRunType"},{"type":"null"}],"description":"Run type for the graph enrichment process.","default":"estimate"},"kg_enrichment_settings":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Kg Enrichment Settings","description":"Settings for the graph enrichment process."}},"type":"object","title":"Body_enrich_graph_v2_enrich_graph_post"},"Body_ingest_chunks_app_v2_ingest_chunks_post":{"properties":{"chunks":{"items":{"$ref":"#/components/schemas/RawChunk"},"type":"array","title":"Chunks","description":"A list of text chunks to ingest into the system.","default":{}},"document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Id","description":"An optional document id to associate the chunks with. If not provided, a unique document id will be generated."},"metadata":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Metadata"},"run_with_orchestration":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Run With Orchestration","description":"Whether or not ingestion runs with orchestration, default is `True`. When set to `False`, the ingestion process will run synchronous and directly return the result.","default":true}},"type":"object","title":"Body_ingest_chunks_app_v2_ingest_chunks_post"},"Body_ingest_files_app_v2_ingest_files_post":{"properties":{"files":{"items":{"type":"string","format":"binary"},"type":"array","title":"Files","description":"The list of paths of input files to ingest into the system."},"document_ids":{"anyOf":[{"type":"string","contentMediaType":"application/json","contentSchema":{"items":{"type":"string","format":"uuid"},"type":"array"}},{"type":"null"}],"title":"Document Ids","description":"An optional list of document ids for each file. If not provided, the system will generate a unique document id via the `generate_document_id` method."},"metadatas":{"anyOf":[{"type":"string","contentMediaType":"application/json","contentSchema":{"items":{"type":"object"},"type":"array"}},{"type":"null"}],"title":"Metadatas","description":"An optional list of JSON metadata to affix to each file"},"ingestion_config":{"anyOf":[{"type":"string","contentMediaType":"application/json","contentSchema":{"type":"object"}},{"type":"null"}],"title":"Ingestion Config","description":"An optional dictionary to override the default chunking configuration for the ingestion process. If not provided, the system will use the default server-side chunking configuration."},"run_with_orchestration":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Run With Orchestration","description":"Whether or not ingestion runs with orchestration, default is `True`. When set to `False`, the ingestion process will run synchronous and directly return the result.","default":true}},"type":"object","required":["files"],"title":"Body_ingest_files_app_v2_ingest_files_post"},"Body_login_app_v2_login_post":{"properties":{"grant_type":{"anyOf":[{"type":"string","pattern":"password"},{"type":"null"}],"title":"Grant Type"},"username":{"type":"string","title":"Username"},"password":{"type":"string","title":"Password"},"scope":{"type":"string","title":"Scope","default":""},"client_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Id"},"client_secret":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Client Secret"}},"type":"object","required":["username","password"],"title":"Body_login_app_v2_login_post"},"Body_put_user_app_v2_user_put":{"properties":{"user_id":{"type":"string","format":"uuid","title":"User Id","description":"ID of the user to update"},"email":{"anyOf":[{"type":"string","format":"email"},{"type":"null"}],"title":"Email","description":"Updated email address"},"is_superuser":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Is Superuser","description":"Updated superuser status"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"Updated user name"},"bio":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Bio","description":"Updated user bio"},"profile_picture":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Profile Picture","description":"Updated profile picture URL"}},"type":"object","title":"Body_put_user_app_v2_user_put"},"Body_rag_app_v2_rag_post":{"properties":{"query":{"type":"string","title":"Query","description":"RAG query"},"vector_search_settings":{"$ref":"#/components/schemas/VectorSearchSettings","description":"Vector search settings"},"kg_search_settings":{"$ref":"#/components/schemas/KGSearchSettings","description":"Knowledge graph search settings"},"rag_generation_config":{"$ref":"#/components/schemas/GenerationConfig","description":"RAG generation configuration"},"task_prompt_override":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Task Prompt Override","description":"Task prompt override"},"include_title_if_available":{"type":"boolean","title":"Include Title If Available","description":"Includes document title in chunk response, if available.","default":false}},"type":"object","required":["query"],"title":"Body_rag_app_v2_rag_post"},"Body_register_app_v2_register_post":{"properties":{"email":{"type":"string","format":"email","title":"Email","description":"User's email address"},"password":{"type":"string","title":"Password","description":"User's password"}},"type":"object","required":["email","password"],"title":"Body_register_app_v2_register_post"},"Body_remove_document_from_collection_app_v2_remove_document_from_collection_post":{"properties":{"document_id":{"type":"string","title":"Document Id","description":"Document ID"},"collection_id":{"type":"string","title":"Collection Id","description":"Collection ID"}},"type":"object","required":["document_id","collection_id"],"title":"Body_remove_document_from_collection_app_v2_remove_document_from_collection_post"},"Body_remove_user_from_collection_app_v2_remove_user_from_collection_post":{"properties":{"user_id":{"type":"string","title":"User Id","description":"User ID"},"collection_id":{"type":"string","title":"Collection Id","description":"Collection ID"}},"type":"object","required":["user_id","collection_id"],"title":"Body_remove_user_from_collection_app_v2_remove_user_from_collection_post"},"Body_reset_password_app_v2_reset_password_post":{"properties":{"reset_token":{"type":"string","title":"Reset Token","description":"Password reset token"},"new_password":{"type":"string","title":"New Password","description":"New password"}},"type":"object","required":["reset_token","new_password"],"title":"Body_reset_password_app_v2_reset_password_post"},"Body_search_app_v2_search_post":{"properties":{"query":{"type":"string","title":"Query","description":"Search query"},"vector_search_settings":{"$ref":"#/components/schemas/VectorSearchSettings","description":"Vector search settings"},"kg_search_settings":{"$ref":"#/components/schemas/KGSearchSettings","description":"Knowledge graph search settings"}},"type":"object","required":["query"],"title":"Body_search_app_v2_search_post"},"Body_update_chunk_app_v2_update_chunk__document_id___extraction_id__put":{"properties":{"text":{"type":"string","title":"Text","description":"The new text content for the chunk"},"metadata":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Metadata","description":"Optional updated metadata"},"run_with_orchestration":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Run With Orchestration","default":true}},"type":"object","required":["text"],"title":"Body_update_chunk_app_v2_update_chunk__document_id___extraction_id__put"},"Body_update_collection_app_v2_update_collection_put":{"properties":{"collection_id":{"type":"string","title":"Collection Id","description":"Collection ID"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name","description":"Updated collection name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description","description":"Updated collection description"}},"type":"object","required":["collection_id"],"title":"Body_update_collection_app_v2_update_collection_put"},"Body_update_files_app_v2_update_files_post":{"properties":{"files":{"items":{"type":"string","format":"binary"},"type":"array","title":"Files","description":"The list of paths of input files to update in the system."},"document_ids":{"anyOf":[{"type":"string","contentMediaType":"application/json","contentSchema":{"items":{"type":"string","format":"uuid"},"type":"array"}},{"type":"null"}],"title":"Document Ids","description":"An optional list of document ids for each file. If not provided, the system will generate a unique document id via the `generate_document_id` method."},"metadatas":{"anyOf":[{"type":"string","contentMediaType":"application/json","contentSchema":{"items":{"type":"object"},"type":"array"}},{"type":"null"}],"title":"Metadatas","description":"An optional list of JSON metadata to affix to each file"},"ingestion_config":{"anyOf":[{"type":"string","contentMediaType":"application/json","contentSchema":{"type":"object"}},{"type":"null"}],"title":"Ingestion Config","description":"An optional dictionary to override the default chunking configuration for the ingestion process. If not provided, the system will use the default server-side chunking configuration."},"run_with_orchestration":{"anyOf":[{"type":"boolean"},{"type":"null"}],"title":"Run With Orchestration","description":"Whether or not ingestion runs with orchestration, default is `True`. When set to `False`, the ingestion process will run synchronous and directly return the result.","default":true}},"type":"object","required":["files"],"title":"Body_update_files_app_v2_update_files_post"},"Body_update_prompt_app_v2_update_prompt_post":{"properties":{"name":{"type":"string","title":"Name","description":"Prompt name"},"template":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Template","description":"Prompt template"},"input_types":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":"null"}],"title":"Input Types","description":"Input types","default":{}}},"type":"object","required":["name"],"title":"Body_update_prompt_app_v2_update_prompt_post"},"Body_verify_email_app_v2_verify_email_post":{"properties":{"email":{"type":"string","format":"email","title":"Email","description":"User's email address"},"verification_code":{"type":"string","title":"Verification Code","description":"Email verification code"}},"type":"object","required":["email","verification_code"],"title":"Body_verify_email_app_v2_verify_email_post"},"CollectionOverviewResponse":{"properties":{"collection_id":{"type":"string","format":"uuid","title":"Collection Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"user_count":{"type":"integer","title":"User Count"},"document_count":{"type":"integer","title":"Document Count"}},"type":"object","required":["collection_id","name","description","created_at","updated_at","user_count","document_count"],"title":"CollectionOverviewResponse"},"CollectionResponse":{"properties":{"collection_id":{"type":"string","format":"uuid","title":"Collection Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["collection_id","name","description","created_at","updated_at"],"title":"CollectionResponse"},"CommunityReport":{"properties":{"community_number":{"type":"integer","title":"Community Number"},"level":{"type":"integer","title":"Level"},"collection_id":{"type":"string","format":"uuid","title":"Collection Id"},"name":{"type":"string","title":"Name","default":""},"summary":{"type":"string","title":"Summary","default":""},"findings":{"items":{"type":"string"},"type":"array","title":"Findings","default":[]},"rating":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Rating"},"rating_explanation":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Rating Explanation"},"embedding":{"anyOf":[{"items":{"type":"number"},"type":"array"},{"type":"null"}],"title":"Embedding"},"attributes":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Attributes"}},"type":"object","required":["community_number","level","collection_id"],"title":"CommunityReport"},"ConversationOverviewResponse":{"properties":{"conversation_id":{"type":"string","format":"uuid","title":"Conversation Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["conversation_id","created_at"],"title":"ConversationOverviewResponse"},"CreateVectorIndexResponse":{"properties":{"message":{"type":"string","title":"Message","description":"Vector index creation queued successfully."}},"type":"object","required":["message"],"title":"CreateVectorIndexResponse"},"DeleteVectorIndexResponse":{"properties":{"message":{"type":"string","title":"Message"}},"type":"object","required":["message"],"title":"DeleteVectorIndexResponse"},"DocumentChunkResponse":{"properties":{"chunk_id":{"type":"string","format":"uuid","title":"Extraction Id"},"document_id":{"type":"string","format":"uuid","title":"Document Id"},"user_id":{"type":"string","format":"uuid","title":"User Id"},"collection_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Collection Ids"},"text":{"type":"string","title":"Text"},"metadata":{"type":"object","title":"Metadata"},"vector":{"anyOf":[{"items":{"type":"number"},"type":"array"},{"type":"null"}],"title":"Vector"}},"type":"object","required":["chunk_id","document_id","user_id","collection_ids","text","metadata"],"title":"DocumentChunkResponse"},"DocumentOverviewResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"title":{"type":"string","title":"Title"},"user_id":{"type":"string","format":"uuid","title":"User Id"},"document_type":{"type":"string","title":"Document Type"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"ingestion_status":{"type":"string","title":"Ingestion Status"},"kg_extraction_status":{"type":"string","title":"Kg Extraction Status"},"version":{"type":"string","title":"Version"},"collection_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Collection Ids"},"metadata":{"type":"object","title":"Metadata"}},"type":"object","required":["id","title","user_id","document_type","created_at","updated_at","ingestion_status","kg_extraction_status","version","collection_ids","metadata"],"title":"DocumentOverviewResponse"},"Entity":{"properties":{"name":{"type":"string","title":"Name"},"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"category":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Category"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"description_embedding":{"anyOf":[{"items":{"type":"number"},"type":"array"},{"type":"string"},{"type":"null"}],"title":"Description Embedding"},"community_numbers":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Community Numbers"},"extraction_ids":{"anyOf":[{"items":{"type":"string","format":"uuid"},"type":"array"},{"type":"null"}],"title":"Extraction Ids"},"collection_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Collection Id"},"document_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Document Id"},"document_ids":{"anyOf":[{"items":{"type":"string","format":"uuid"},"type":"array"},{"type":"null"}],"title":"Document Ids"},"attributes":{"anyOf":[{"type":"object"},{"type":"string"},{"type":"null"}],"title":"Attributes"}},"type":"object","required":["name"],"title":"Entity","description":"An entity extracted from a document."},"EntityLevel":{"type":"string","enum":["collection","document","chunk"],"title":"EntityLevel"},"GenerationConfig":{"properties":{"model":{"type":"string","title":"Model"},"temperature":{"type":"number","title":"Temperature"},"top_p":{"type":"number","title":"Top P"},"max_tokens_to_sample":{"type":"integer","title":"Max Tokens To Sample"},"stream":{"type":"boolean","title":"Stream"},"functions":{"anyOf":[{"items":{"type":"object"},"type":"array"},{"type":"null"}],"title":"Functions"},"tools":{"anyOf":[{"items":{"type":"object"},"type":"array"},{"type":"null"}],"title":"Tools"},"add_generation_kwargs":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Add Generation Kwargs"},"api_base":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Api Base"},"response_format":{"anyOf":[{"type":"object"},{"$ref":"#/components/schemas/BaseModel"},{"type":"null"}],"title":"Response Format"}},"type":"object","title":"GenerationConfig","max_tokens_to_sample":1024,"model":"openai/gpt-4o","stream":false,"temperature":0.1,"top_p":1.0},"GenericMessageResponse":{"properties":{"message":{"type":"string","title":"Message"}},"type":"object","required":["message"],"title":"GenericMessageResponse"},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HybridSearchSettings":{"properties":{"full_text_weight":{"type":"number","title":"Full Text Weight","description":"Weight to apply to full text search","default":1.0},"semantic_weight":{"type":"number","title":"Semantic Weight","description":"Weight to apply to semantic search","default":5.0},"full_text_limit":{"type":"integer","title":"Full Text Limit","description":"Maximum number of results to return from full text search","default":200},"rrf_k":{"type":"integer","title":"Rrf K","description":"K-value for RRF (Rank Reciprocal Fusion)","default":50}},"type":"object","title":"HybridSearchSettings"},"IndexArgsHNSW":{"properties":{"m":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"M","default":16},"ef_construction":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Ef Construction","default":64}},"type":"object","title":"IndexArgsHNSW","description":"A class for arguments that can optionally be supplied to the index creation\nmethod when building an HNSW type index.\n\nRef: https://github.com/pgvector/pgvector#index-options\n\nBoth attributes are Optional in case the user only wants to specify one and\nleave the other as default\n\nAttributes:\n m (int): Maximum number of connections per node per layer (default: 16)\n ef_construction (int): Size of the dynamic candidate list for\n constructing the graph (default: 64)"},"IndexArgsIVFFlat":{"properties":{"n_lists":{"type":"integer","title":"N Lists"}},"type":"object","required":["n_lists"],"title":"IndexArgsIVFFlat","description":"A class for arguments that can optionally be supplied to the index creation\nmethod when building an IVFFlat type index.\n\nAttributes:\n nlist (int): The number of IVF centroids that the index should use"},"IndexMeasure":{"type":"string","enum":["l2_distance","max_inner_product","cosine_distance","l1_distance","hamming_distance","jaccard_distance"],"title":"IndexMeasure","description":"An enum representing the types of distance measures available for indexing.\n\nAttributes:\n cosine_distance (str): The cosine distance measure for indexing.\n l2_distance (str): The Euclidean (L2) distance measure for indexing.\n max_inner_product (str): The maximum inner product measure for indexing."},"IndexMethod":{"type":"string","enum":["auto","ivfflat","hnsw"],"title":"IndexMethod","description":"An enum representing the index methods available.\n\nThis class currently only supports the 'ivfflat' method but may\nexpand in the future.\n\nAttributes:\n auto (str): Automatically choose the best available index method.\n ivfflat (str): The ivfflat index method.\n hnsw (str): The hnsw index method."},"IngestionResponse":{"properties":{"message":{"type":"string","title":"Message","description":"A message describing the result of the ingestion request."},"task_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Task Id","description":"The task ID of the ingestion request."},"document_id":{"type":"string","format":"uuid","title":"Document Id","description":"The ID of the document that was ingested."}},"type":"object","required":["message","document_id"],"title":"IngestionResponse","example":{"document_id":"9fbe403b-c11c-5aae-8ade-ef22980c3ad1","message":"Ingestion task queued successfully.","task_id":"c68dc72e-fc23-5452-8f49-d7bd46088a96"}},"KGCommunitiesResponse":{"properties":{"communities":{"items":{"$ref":"#/components/schemas/CommunityReport"},"type":"array","title":"Communities","description":"The list of communities in the graph for the collection."},"total_entries":{"type":"integer","title":"Total Entries","description":"The total number of communities in the graph."}},"type":"object","required":["communities","total_entries"],"title":"KGCommunitiesResponse","description":"Response for knowledge graph communities.","example":{"communities":[{"collection_ids":["122fdf6a-e116-546b-a8f6-e4cb2e2c0a09"],"community_number":1,"findings":["finding1","finding2"],"id":"1","level":0,"name":"community name","rating":"8","rating_explanation":"rating explanation","summary":"community summary"}],"total_count":1}},"KGCommunityResult":{"properties":{"name":{"type":"string","title":"Name"},"summary":{"type":"string","title":"Summary"},"rating":{"type":"number","title":"Rating"},"rating_explanation":{"type":"string","title":"Rating Explanation"},"findings":{"items":{"type":"string"},"type":"array","title":"Findings"},"metadata":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Metadata"}},"type":"object","required":["name","summary","rating","rating_explanation","findings"],"title":"KGCommunityResult","findings":["Finding 1","Finding 2"],"metadata":{},"name":"Community Name","rating":9,"rating_explanation":"Rating Explanation","summary":"Community Summary"},"KGDeduplicationEstimationResponse":{"properties":{"message":{"type":"string","title":"Message","description":"The message to display to the user.","default":""},"num_entities":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Num Entities","description":"The number of entities in the collection."},"estimated_llm_calls":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Estimated Llm Calls","description":"The estimated number of LLM calls."},"estimated_total_in_out_tokens_in_millions":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Estimated Total In Out Tokens In Millions","description":"The estimated total number of input and output tokens in millions."},"estimated_cost_in_usd":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Estimated Cost In Usd","description":"The estimated cost in USD."},"estimated_total_time_in_minutes":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Estimated Total Time In Minutes","description":"The estimated time in minutes."}},"type":"object","title":"KGDeduplicationEstimationResponse","description":"Response for knowledge graph deduplication estimation."},"KGEntitiesResponse":{"properties":{"entities":{"items":{"$ref":"#/components/schemas/Entity"},"type":"array","title":"Entities","description":"The list of entities in the graph."},"total_entries":{"type":"integer","title":"Total Entries","description":"The total number of entities in the graph for the collection or document."}},"type":"object","required":["entities","total_entries"],"title":"KGEntitiesResponse","description":"Response for knowledge graph entities.","example":{"entities":[{"description":"Description 1","id":"1","name":"Entity 1"},{"description":"Description 2","id":"2","name":"Entity 2"}],"total_entries":2}},"KGEntityDeduplicationResponse":{"properties":{"message":{"type":"string","title":"Message","description":"The message to display to the user."}},"type":"object","required":["message"],"title":"KGEntityDeduplicationResponse","description":"Response for knowledge graph entity deduplication.","example":{"message":"Entity deduplication queued successfully."}},"KGEntityResult":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"metadata":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Metadata"}},"type":"object","required":["name","description"],"title":"KGEntityResult","description":"Entity Description","metadata":{},"name":"Entity Name"},"KGGlobalResult":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"metadata":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Metadata"}},"type":"object","required":["name","description"],"title":"KGGlobalResult","description":"Global Result Description","metadata":{},"name":"Global Result Name"},"KGRelationshipResult":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"metadata":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Metadata"}},"type":"object","required":["name","description"],"title":"KGRelationshipResult","description":"Relationship Description","metadata":{},"name":"Relationship Name"},"KGRunType":{"type":"string","enum":["estimate","run"],"title":"KGRunType","description":"Type of KG run."},"KGSearchMethod":{"type":"string","enum":["local"],"const":"local","title":"KGSearchMethod"},"KGSearchResult":{"properties":{"method":{"$ref":"#/components/schemas/KGSearchMethod"},"content":{"anyOf":[{"$ref":"#/components/schemas/KGEntityResult"},{"$ref":"#/components/schemas/KGRelationshipResult"},{"$ref":"#/components/schemas/KGCommunityResult"},{"$ref":"#/components/schemas/KGGlobalResult"}],"title":"Content"},"result_type":{"anyOf":[{"$ref":"#/components/schemas/KGSearchResultType"},{"type":"null"}]},"extraction_ids":{"anyOf":[{"items":{"type":"string","format":"uuid"},"type":"array"},{"type":"null"}],"title":"Extraction Ids"},"metadata":{"type":"object","title":"Metadata","default":{}}},"type":"object","required":["method","content"],"title":"KGSearchResult","content":{"description":"Entity Description","metadata":{},"name":"Entity Name"},"extraction_ids":["c68dc72e-fc23-5452-8f49-d7bd46088a96"],"metadata":{"associated_query":"What is the capital of France?"},"method":"local","result_type":"entity"},"KGSearchResultType":{"type":"string","enum":["entity","relationship","community"],"title":"KGSearchResultType"},"KGSearchSettings":{"properties":{"entities_level":{"$ref":"#/components/schemas/EntityLevel","description":"The level of entities to search for","default":"document"},"filters":{"type":"object","title":"Filters","description":"Alias for search_filters","deprecated":true},"search_filters":{"type":"object","title":"Search Filters","description":"Filters to apply to the vector search. Allowed operators include `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `like`, `ilike`, `in`, and `nin`.\n\n Commonly seen filters include operations include the following:\n\n `{\"document_id\": {\"$eq\": \"9fbe403b-...\"}}`\n\n `{\"document_id\": {\"$in\": [\"9fbe403b-...\", \"3e157b3a-...\"]}}`\n\n `{\"collection_ids\": {\"$overlap\": [\"122fdf6a-...\", \"...\"]}}`\n\n `{\"$and\": {\"$document_id\": ..., \"collection_ids\": ...}}`"},"selected_collection_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Selected Collection Ids","description":"Collection IDs to search for"},"graphrag_map_system":{"type":"string","title":"Graphrag Map System","description":"The system prompt for the graphrag map prompt.","default":"graphrag_map_system"},"graphrag_reduce_system":{"type":"string","title":"Graphrag Reduce System","description":"The system prompt for the graphrag reduce prompt.","default":"graphrag_reduce_system"},"use_kg_search":{"type":"boolean","title":"Use Kg Search","description":"Whether to use KG search","default":false},"kg_search_type":{"type":"string","title":"Kg Search Type","description":"KG search type","default":"local"},"kg_search_level":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Kg Search Level","description":"KG search level"},"generation_config":{"$ref":"#/components/schemas/GenerationConfig","description":"Configuration for text generation during graph search."},"max_community_description_length":{"type":"integer","title":"Max Community Description Length","default":65536},"max_llm_queries_for_global_search":{"type":"integer","title":"Max Llm Queries For Global Search","default":250},"local_search_limits":{"additionalProperties":{"type":"integer"},"type":"object","title":"Local Search Limits","default":{"__Entity__":20,"__Relationship__":20,"__Community__":20}}},"type":"object","title":"KGSearchSettings","generation_config":{"max_tokens_to_sample":1024,"model":"openai/gpt-4o","stream":false,"temperature":0.1,"top_p":1.0},"kg_search_level":"0","kg_search_type":"local","local_search_limits":{"__Community__":20,"__Entity__":20,"__Relationship__":20},"max_community_description_length":65536,"max_llm_queries_for_global_search":250,"use_kg_search":true},"KGTriplesResponse":{"properties":{"triples":{"items":{"$ref":"#/components/schemas/Triple"},"type":"array","title":"Triples","description":"The list of triples in the graph."},"total_entries":{"type":"integer","title":"Total Entries","description":"The total number of triples in the graph for the collection or document."}},"type":"object","required":["triples","total_entries"],"title":"KGTriplesResponse","description":"Response for knowledge graph triples.","example":{"total_entries":2,"triples":[{"description":"Paris is the capital of France","object":"France","predicate":"is capital of","subject":"Paris"}]}},"KGTunePromptResponse":{"properties":{"tuned_prompt":{"type":"string","title":"Tuned Prompt","description":"The updated prompt."}},"type":"object","required":["tuned_prompt"],"title":"KGTunePromptResponse","description":"Response containing just the tuned prompt string.","example":{"tuned_prompt":"The updated prompt"}},"ListVectorIndicesResponse":{"properties":{"indices":{"items":{"type":"object"},"type":"array","title":"Indices"}},"type":"object","required":["indices"],"title":"ListVectorIndicesResponse"},"LogEntry":{"properties":{"key":{"type":"string","title":"Key"},"value":{"title":"Value"},"timestamp":{"type":"string","format":"date-time","title":"Timestamp"}},"type":"object","required":["key","value","timestamp"],"title":"LogEntry"},"LogResponse":{"properties":{"run_id":{"type":"string","format":"uuid","title":"Run Id"},"run_type":{"type":"string","title":"Run Type"},"entries":{"items":{"$ref":"#/components/schemas/LogEntry"},"type":"array","title":"Entries"},"timestamp":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Timestamp"},"user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"User Id"}},"type":"object","required":["run_id","run_type","entries","timestamp","user_id"],"title":"LogResponse"},"Message":{"properties":{"role":{"anyOf":[{"$ref":"#/components/schemas/MessageType"},{"type":"string"}],"title":"Role"},"content":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Content"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"function_call":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Function Call"},"tool_calls":{"anyOf":[{"items":{"type":"object"},"type":"array"},{"type":"null"}],"title":"Tool Calls"}},"type":"object","required":["role"],"title":"Message","content":"This is a test message.","role":"user"},"MessageType":{"type":"string","enum":["system","user","assistant","function","tool"],"title":"MessageType"},"PaginatedResultsWrapper_list_CollectionResponse__":{"properties":{"results":{"items":{"$ref":"#/components/schemas/CollectionResponse"},"type":"array","title":"Results"},"total_entries":{"type":"integer","title":"Total Entries"}},"type":"object","required":["results","total_entries"],"title":"PaginatedResultsWrapper[list[CollectionResponse]]"},"PaginatedResultsWrapper_list_ConversationOverviewResponse__":{"properties":{"results":{"items":{"$ref":"#/components/schemas/ConversationOverviewResponse"},"type":"array","title":"Results"},"total_entries":{"type":"integer","title":"Total Entries"}},"type":"object","required":["results","total_entries"],"title":"PaginatedResultsWrapper[list[ConversationOverviewResponse]]"},"PaginatedResultsWrapper_list_DocumentChunkResponse__":{"properties":{"results":{"items":{"$ref":"#/components/schemas/DocumentChunkResponse"},"type":"array","title":"Results"},"total_entries":{"type":"integer","title":"Total Entries"}},"type":"object","required":["results","total_entries"],"title":"PaginatedResultsWrapper[list[DocumentChunkResponse]]"},"PaginatedResultsWrapper_list_DocumentOverviewResponse__":{"properties":{"results":{"items":{"$ref":"#/components/schemas/DocumentOverviewResponse"},"type":"array","title":"Results"},"total_entries":{"type":"integer","title":"Total Entries"}},"type":"object","required":["results","total_entries"],"title":"PaginatedResultsWrapper[list[DocumentOverviewResponse]]"},"PaginatedResultsWrapper_list_UserOverviewResponse__":{"properties":{"results":{"items":{"$ref":"#/components/schemas/UserOverviewResponse"},"type":"array","title":"Results"},"total_entries":{"type":"integer","title":"Total Entries"}},"type":"object","required":["results","total_entries"],"title":"PaginatedResultsWrapper[list[UserOverviewResponse]]"},"PaginatedResultsWrapper_list_UserResponse__":{"properties":{"results":{"items":{"$ref":"#/components/schemas/shared__api__models__management__responses__UserResponse"},"type":"array","title":"Results"},"total_entries":{"type":"integer","title":"Total Entries"}},"type":"object","required":["results","total_entries"],"title":"PaginatedResultsWrapper[list[UserResponse]]"},"PromptResponse":{"properties":{"prompt_id":{"type":"string","format":"uuid","title":"Prompt Id"},"name":{"type":"string","title":"Name"},"template":{"type":"string","title":"Template"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"input_types":{"additionalProperties":{"type":"string"},"type":"object","title":"Input Types"}},"type":"object","required":["prompt_id","name","template","created_at","updated_at","input_types"],"title":"PromptResponse"},"RAGAgentResponse":{"properties":{"messages":{"items":{"$ref":"#/components/schemas/Message"},"type":"array","title":"Messages","description":"List of messages in the RAG agent response"},"conversation_id":{"type":"string","title":"Conversation Id","description":"The conversation ID for the RAG agent response"}},"type":"object","required":["messages","conversation_id"],"title":"RAGAgentResponse","example":[{"content":"## You are a helpful assistant that can search for information.\n\nWhen asked a question, perform a search to find relevant information and provide a response.\n\nThe response should contain line-item attributions to relevent search results, and be as informative if possible.\nIf no relevant results are found, then state that no results were found.\nIf no obvious question is present, then do not carry out a search, and instead ask for clarification.","role":"system"},{"content":"You are a helpful assistant.","role":"system"},{"content":"Who is the greatest philospher of all time?","role":"user"},{"content":"Aristotle is widely considered the greatest philospher of all time.","role":"assistant"},{"content":"Can you tell me more about him?","role":"user"},{"function_call":{"arguments":"{\"query\":\"Aristotle biography\"}","name":"search"},"role":"assistant"},{"content":"1. Aristotle[A] (Greek: Ἀριστοτέλης Aristotélēs, pronounced [aristotélɛːs]; 384–322 BC) was an Ancient Greek philosopher and polymath. His writings cover a broad range of subjects spanning the natural sciences, philosophy, linguistics, economics, politics, psychology, and the arts. As the founder of the Peripatetic school of philosophy in the Lyceum in Athens, he began the wider Aristotelian tradition that followed, which set the groundwork for the development of modern science.\n2. Aristotle[A] (Greek: Ἀριστοτέλης Aristotélēs, pronounced [aristotélɛːs]; 384–322 BC) was an Ancient Greek philosopher and polymath. His writings cover a broad range of subjects spanning the natural sciences, philosophy, linguistics, economics, politics, psychology, and the arts. As the founder of the Peripatetic school of philosophy in the Lyceum in Athens, he began the wider Aristotelian tradition that followed, which set the groundwork for the development of modern science.\n3. Aristotle was born in 384 BC[C] in Stagira, Chalcidice,[2] about 55 km (34 miles) east of modern-day Thessaloniki.[3][4] His father, Nicomachus, was the personal physician to King Amyntas of Macedon. While he was young, Aristotle learned about biology and medical information, which was taught by his father.[5] Both of Aristotle's parents died when he was about thirteen, and Proxenus of Atarneus became his guardian.[6] Although little information about Aristotle's childhood has survived, he probably spent\n4. Aristotle was born in 384 BC[C] in Stagira, Chalcidice,[2] about 55 km (34 miles) east of modern-day Thessaloniki.[3][4] His father, Nicomachus, was the personal physician to King Amyntas of Macedon. While he was young, Aristotle learned about biology and medical information, which was taught by his father.[5] Both of Aristotle's parents died when he was about thirteen, and Proxenus of Atarneus became his guardian.[6] Although little information about Aristotle's childhood has survived, he probably spent\n5. Life\nIn general, the details of Aristotle's life are not well-established. The biographies written in ancient times are often speculative and historians only agree on a few salient points.[B]\n","name":"search","role":"function"},{"content":"Aristotle (384–322 BC) was an Ancient Greek philosopher and polymath whose contributions have had a profound impact on various fields of knowledge. Here are some key points about his life and work:\n\n1. **Early Life**: Aristotle was born in 384 BC in Stagira, Chalcidice, which is near modern-day Thessaloniki, Greece. His father, Nicomachus, was the personal physician to King Amyntas of Macedon, which exposed Aristotle to medical and biological knowledge from a young age [C].\n\n2. **Education and Career**: After the death of his parents, Aristotle was sent to Athens to study at Plato's Academy, where he remained for about 20 years. After Plato's death, Aristotle left Athens and eventually became the tutor of Alexander the Great [C].\n\n3. **Philosophical Contributions**: Aristotle founded the Lyceum in Athens, where he established the Peripatetic school of philosophy. His works cover a wide range of subjects, including metaphysics, ethics, politics, logic, biology, and aesthetics. His writings laid the groundwork for many modern scientific and philosophical inquiries [A].\n\n4. **Legacy**: Aristotle's influence extends beyond philosophy to the natural sciences, linguistics, economics, and psychology. His method of systematic observation and analysis has been foundational to the development of modern science [A].\n\nAristotle's comprehensive approach to knowledge and his systematic methodology have earned him a lasting legacy as one of the greatest philosophers of all time.\n\nSources:\n- [A] Aristotle's broad range of writings and influence on modern science.\n- [C] Details about Aristotle's early life and education.","role":"assistant"}]},"RAGResponse":{"properties":{"completion":{"title":"Completion","description":"The generated completion from the RAG process"},"search_results":{"$ref":"#/components/schemas/CombinedSearchResponse","description":"The search results used for the RAG process"}},"type":"object","required":["completion","search_results"],"title":"RAGResponse","example":{"completion":{"choices":[{"finish_reason":"stop","index":0,"message":{"content":"Paris is the capital of France.","role":"assistant"}}],"id":"chatcmpl-example123"},"search_results":{"kg_search_results":[{"content":{"description":"Entity Description","metadata":{},"name":"Entity Name"},"extraction_ids":["c68dc72e-fc23-5452-8f49-d7bd46088a96"],"metadata":{"associated_query":"What is the capital of France?"},"method":"local","result_type":"entity"}],"vector_search_results":[{"collection_ids":[],"document_id":"3e157b3a-8469-51db-90d9-52e7d896b49b","chunk_id":"3f3d47f3-8baf-58eb-8bc2-0171fb1c6e09","metadata":{"associated_query":"What is the capital of France?","title":"example_document.pdf"},"score":0.23943702876567796,"text":"Example text from the document","user_id":"2acb499e-8428-543b-bd85-0d9098718220"}]}}},"RawChunk":{"properties":{"text":{"type":"string","title":"Text"}},"type":"object","required":["text"],"title":"RawChunk"},"ResultsWrapper_AllPromptsResponse_":{"properties":{"results":{"$ref":"#/components/schemas/AllPromptsResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[AllPromptsResponse]"},"ResultsWrapper_AnalyticsResponse_":{"properties":{"results":{"$ref":"#/components/schemas/AnalyticsResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[AnalyticsResponse]"},"ResultsWrapper_AppSettingsResponse_":{"properties":{"results":{"$ref":"#/components/schemas/AppSettingsResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[AppSettingsResponse]"},"ResultsWrapper_CollectionResponse_":{"properties":{"results":{"$ref":"#/components/schemas/CollectionResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[CollectionResponse]"},"ResultsWrapper_CreateVectorIndexResponse_":{"properties":{"results":{"$ref":"#/components/schemas/CreateVectorIndexResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[CreateVectorIndexResponse]"},"ResultsWrapper_DeleteVectorIndexResponse_":{"properties":{"results":{"$ref":"#/components/schemas/DeleteVectorIndexResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[DeleteVectorIndexResponse]"},"ResultsWrapper_GenericMessageResponse_":{"properties":{"results":{"$ref":"#/components/schemas/GenericMessageResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[GenericMessageResponse]"},"ResultsWrapper_KGCommunitiesResponse_":{"properties":{"results":{"$ref":"#/components/schemas/KGCommunitiesResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[KGCommunitiesResponse]"},"ResultsWrapper_KGEntitiesResponse_":{"properties":{"results":{"$ref":"#/components/schemas/KGEntitiesResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[KGEntitiesResponse]"},"ResultsWrapper_KGTriplesResponse_":{"properties":{"results":{"$ref":"#/components/schemas/KGTriplesResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[KGTriplesResponse]"},"ResultsWrapper_KGTunePromptResponse_":{"properties":{"results":{"$ref":"#/components/schemas/KGTunePromptResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[KGTunePromptResponse]"},"ResultsWrapper_ListVectorIndicesResponse_":{"properties":{"results":{"$ref":"#/components/schemas/ListVectorIndicesResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[ListVectorIndicesResponse]"},"ResultsWrapper_NoneType_":{"properties":{"results":{"type":"null","title":"Results"}},"type":"object","required":["results"],"title":"ResultsWrapper[NoneType]"},"ResultsWrapper_RAGAgentResponse_":{"properties":{"results":{"$ref":"#/components/schemas/RAGAgentResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[RAGAgentResponse]"},"ResultsWrapper_RAGResponse_":{"properties":{"results":{"$ref":"#/components/schemas/RAGResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[RAGResponse]"},"ResultsWrapper_SearchResponse_":{"properties":{"results":{"$ref":"#/components/schemas/CombinedSearchResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[CombinedSearchResponse]"},"ResultsWrapper_ServerStats_":{"properties":{"results":{"$ref":"#/components/schemas/ServerStats"}},"type":"object","required":["results"],"title":"ResultsWrapper[ServerStats]"},"ResultsWrapper_TokenResponse_":{"properties":{"results":{"$ref":"#/components/schemas/TokenResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[TokenResponse]"},"ResultsWrapper_Union_KGEntityDeduplicationResponse__KGDeduplicationEstimationResponse__":{"properties":{"results":{"anyOf":[{"$ref":"#/components/schemas/KGEntityDeduplicationResponse"},{"$ref":"#/components/schemas/KGDeduplicationEstimationResponse"}],"title":"Results"}},"type":"object","required":["results"],"title":"ResultsWrapper[Union[KGEntityDeduplicationResponse, KGDeduplicationEstimationResponse]]"},"ResultsWrapper_UpdatePromptResponse_":{"properties":{"results":{"$ref":"#/components/schemas/UpdatePromptResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[UpdatePromptResponse]"},"ResultsWrapper_UpdateResponse_":{"properties":{"results":{"$ref":"#/components/schemas/UpdateResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[UpdateResponse]"},"ResultsWrapper_UserResponse_":{"properties":{"results":{"$ref":"#/components/schemas/shared__api__models__auth__responses__UserResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[UserResponse]"},"ResultsWrapper_list_CollectionOverviewResponse__":{"properties":{"results":{"items":{"$ref":"#/components/schemas/CollectionOverviewResponse"},"type":"array","title":"Results"}},"type":"object","required":["results"],"title":"ResultsWrapper[list[CollectionOverviewResponse]]"},"ResultsWrapper_list_CollectionResponse__":{"properties":{"results":{"items":{"$ref":"#/components/schemas/CollectionResponse"},"type":"array","title":"Results"}},"type":"object","required":["results"],"title":"ResultsWrapper[list[CollectionResponse]]"},"ResultsWrapper_list_IngestionResponse__":{"properties":{"results":{"items":{"$ref":"#/components/schemas/IngestionResponse"},"type":"array","title":"Results"}},"type":"object","required":["results"],"title":"ResultsWrapper[list[IngestionResponse]]"},"ResultsWrapper_list_LogResponse__":{"properties":{"results":{"items":{"$ref":"#/components/schemas/LogResponse"},"type":"array","title":"Results"}},"type":"object","required":["results"],"title":"ResultsWrapper[list[LogResponse]]"},"ResultsWrapper_list_Tuple_str__Message___":{"properties":{"results":{"items":{"prefixItems":[{"type":"string"},{"$ref":"#/components/schemas/Message"}],"type":"array","maxItems":2,"minItems":2},"type":"array","title":"Results"}},"type":"object","required":["results"],"title":"ResultsWrapper[list[Tuple[str, Message]]]"},"CombinedSearchResponse":{"properties":{"vector_search_results":{"items":{"$ref":"#/components/schemas/VectorSearchResult"},"type":"array","title":"Vector Search Results","description":"List of vector search results"},"kg_search_results":{"anyOf":[{"items":{"$ref":"#/components/schemas/KGSearchResult"},"type":"array"},{"type":"null"}],"title":"Kg Search Results","description":"Knowledge graph search results, if applicable"}},"type":"object","required":["vector_search_results"],"title":"CombinedSearchResponse","example":{"kg_search_results":[{"content":{"description":"Entity Description","metadata":{},"name":"Entity Name"},"extraction_ids":["c68dc72e-fc23-5452-8f49-d7bd46088a96"],"metadata":{"associated_query":"What is the capital of France?"},"method":"local","result_type":"entity"}],"vector_search_results":[{"collection_ids":[],"document_id":"3e157b3a-8469-51db-90d9-52e7d896b49b","chunk_id":"3f3d47f3-8baf-58eb-8bc2-0171fb1c6e09","metadata":{"associated_query":"What is the capital of France?","title":"example_document.pdf"},"score":0.23943702876567796,"text":"Example text from the document","user_id":"2acb499e-8428-543b-bd85-0d9098718220"}]}},"ServerStats":{"properties":{"start_time":{"type":"string","format":"date-time","title":"Start Time"},"uptime_seconds":{"type":"number","title":"Uptime Seconds"},"cpu_usage":{"type":"number","title":"Cpu Usage"},"memory_usage":{"type":"number","title":"Memory Usage"}},"type":"object","required":["start_time","uptime_seconds","cpu_usage","memory_usage"],"title":"ServerStats"},"Token":{"properties":{"token":{"type":"string","title":"Token"},"token_type":{"type":"string","title":"Token Type"}},"type":"object","required":["token","token_type"],"title":"Token"},"TokenResponse":{"properties":{"access_token":{"$ref":"#/components/schemas/Token"},"refresh_token":{"$ref":"#/components/schemas/Token"}},"type":"object","required":["access_token","refresh_token"],"title":"TokenResponse"},"Triple":{"properties":{"id":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Id"},"subject":{"type":"string","title":"Subject"},"predicate":{"type":"string","title":"Predicate"},"object":{"type":"string","title":"Object"},"weight":{"anyOf":[{"type":"number"},{"type":"null"}],"title":"Weight","default":1.0},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"},"predicate_embedding":{"anyOf":[{"items":{"type":"number"},"type":"array"},{"type":"null"}],"title":"Predicate Embedding"},"extraction_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Extraction Ids","default":[]},"document_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Document Id"},"attributes":{"anyOf":[{"type":"object"},{"type":"string"}],"title":"Attributes","default":{}}},"type":"object","required":["subject","predicate","object"],"title":"Triple","description":"A relationship between two entities. This is a generic relationship, and can be used to represent any type of relationship between any two entities."},"UpdatePromptResponse":{"properties":{"message":{"type":"string","title":"Message"}},"type":"object","required":["message"],"title":"UpdatePromptResponse"},"UpdateResponse":{"properties":{"message":{"type":"string","title":"Message","description":"A message describing the result of the ingestion request."},"task_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"Task Id","description":"The task ID of the ingestion request."},"document_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Document Ids","description":"The ID of the document that was ingested."}},"type":"object","required":["message","document_ids"],"title":"UpdateResponse","example":{"document_ids":["9fbe403b-c11c-5aae-8ade-ef22980c3ad1"],"message":"Update task queued successfully.","task_id":"c68dc72e-fc23-5452-8f49-d7bd46088a96"}},"UserOverviewResponse":{"properties":{"user_id":{"type":"string","format":"uuid","title":"User Id"},"num_files":{"type":"integer","title":"Num Files"},"total_size_in_bytes":{"type":"integer","title":"Total Size In Bytes"},"document_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Document Ids"}},"type":"object","required":["user_id","num_files","total_size_in_bytes","document_ids"],"title":"UserOverviewResponse"},"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"},"VectorSearchResult":{"properties":{"chunk_id":{"type":"string","format":"uuid","title":"Extraction Id"},"document_id":{"type":"string","format":"uuid","title":"Document Id"},"user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":"null"}],"title":"User Id"},"collection_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Collection Ids"},"score":{"type":"number","title":"Score"},"text":{"type":"string","title":"Text"},"metadata":{"type":"object","title":"Metadata"}},"type":"object","required":["chunk_id","document_id","user_id","collection_ids","score","text","metadata"],"title":"VectorSearchResult","description":"Result of a search operation.","collection_ids":[],"document_id":"3e157b3a-8469-51db-90d9-52e7d896b49b","chunk_id":"3f3d47f3-8baf-58eb-8bc2-0171fb1c6e09","metadata":{"associated_query":"What is the capital of France?","title":"example_document.pdf"},"score":0.23943702876567796,"text":"Example text from the document","user_id":"2acb499e-8428-543b-bd85-0d9098718220"},"VectorSearchSettings":{"properties":{"use_vector_search":{"type":"boolean","title":"Use Vector Search","description":"Whether to use vector search","default":true},"use_hybrid_search":{"type":"boolean","title":"Use Hybrid Search","description":"Whether to perform a hybrid search (combining vector and keyword search)","default":false},"filters":{"type":"object","title":"Filters","description":"Alias for search_filters","deprecated":true},"search_filters":{"type":"object","title":"Search Filters","description":"Filters to apply to the vector search. Allowed operators include `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `like`, `ilike`, `in`, and `nin`.\n\n Commonly seen filters include operations include the following:\n\n `{\"document_id\": {\"$eq\": \"9fbe403b-...\"}}`\n\n `{\"document_id\": {\"$in\": [\"9fbe403b-...\", \"3e157b3a-...\"]}}`\n\n `{\"collection_ids\": {\"$overlap\": [\"122fdf6a-...\", \"...\"]}}`\n\n `{\"$and\": {\"$document_id\": ..., \"collection_ids\": ...}}`"},"search_limit":{"type":"integer","maximum":1000.0,"minimum":1.0,"title":"Search Limit","description":"Maximum number of results to return","default":10},"offset":{"type":"integer","minimum":0.0,"title":"Offset","description":"Offset to paginate search results","default":0},"selected_collection_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Selected Collection Ids","description":"Collection IDs to search for"},"index_measure":{"$ref":"#/components/schemas/IndexMeasure","description":"The distance measure to use for indexing","default":"cosine_distance"},"include_values":{"type":"boolean","title":"Include Values","description":"Whether to include search score values in the search results","default":true},"include_metadatas":{"type":"boolean","title":"Include Metadatas","description":"Whether to include element metadata in the search results","default":true},"probes":{"type":"integer","title":"Probes","description":"Number of ivfflat index lists to query. Higher increases accuracy but decreases speed.","default":10},"ef_search":{"type":"integer","title":"Ef Search","description":"Size of the dynamic candidate list for HNSW index search. Higher increases accuracy but decreases speed.","default":40},"hybrid_search_settings":{"$ref":"#/components/schemas/HybridSearchSettings","description":"Settings for hybrid search","default":{"full_text_weight":1.0,"semantic_weight":5.0,"full_text_limit":200,"rrf_k":50}},"search_strategy":{"type":"string","title":"Search Strategy","description":"Search strategy to use (e.g., 'default', 'query_fusion', 'hyde')","default":"vanilla"}},"type":"object","title":"VectorSearchSettings","ef_search":40,"filters":{"category":"technology"},"hybrid_search_settings":{"full_text_limit":200,"full_text_weight":1.0,"rrf_k":50,"semantic_weight":5.0},"include_metadata":true,"index_measure":"cosine_distance","limit":20,"offset":0,"probes":10,"selected_collection_ids":["2acb499e-8428-543b-bd85-0d9098718220","3e157b3a-8469-51db-90d9-52e7d896b49b"],"use_hybrid_search":true,"use_vector_search":true},"VectorTableName":{"type":"string","enum":["vectors","document_entity","collection_entity","community_report"],"title":"VectorTableName","description":"This enum represents the different tables where we store vectors."},"shared__api__models__auth__responses__UserResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"email":{"type":"string","title":"Email"},"is_active":{"type":"boolean","title":"Is Active","default":true},"is_superuser":{"type":"boolean","title":"Is Superuser","default":false},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-10-29T09:47:24.038501"},"updated_at":{"type":"string","format":"date-time","title":"Updated At","default":"2024-10-29T09:47:24.038510"},"is_verified":{"type":"boolean","title":"Is Verified","default":false},"collection_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Collection Ids","default":[]},"hashed_password":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hashed Password"},"verification_code_expiry":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Verification Code Expiry"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"bio":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Bio"},"profile_picture":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Profile Picture"}},"type":"object","required":["id","email"],"title":"UserResponse"},"shared__api__models__management__responses__UserResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"email":{"type":"string","title":"Email"},"is_active":{"type":"boolean","title":"Is Active","default":true},"is_superuser":{"type":"boolean","title":"Is Superuser","default":false},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-10-29T09:47:24.055195"},"updated_at":{"type":"string","format":"date-time","title":"Updated At","default":"2024-10-29T09:47:24.055198"},"is_verified":{"type":"boolean","title":"Is Verified","default":false},"collection_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Collection Ids","default":[]},"hashed_password":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Hashed Password"},"verification_code_expiry":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Verification Code Expiry"},"name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Name"},"bio":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Bio"},"profile_picture":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Profile Picture"}},"type":"object","required":["id","email"],"title":"UserResponse"}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"},"OAuth2PasswordBearer":{"type":"oauth2","flows":{"password":{"scopes":{},"tokenUrl":"token"}}}}}} +{"openapi":"3.1.0","info":{"title":"R2R Application API","version":"1.0.0"},"paths":{"/v3/documents":{"post":{"summary":"Create a new document","description":"Creates a new Document object from an input file or text content. The document will be processed\nto create chunks for vector indexing and search.\n\nEither a file or text content must be provided, but not both. Regular users can only create\ndocuments for themselves, while superusers can create documents for any user.\n\nThe ingestion process runs asynchronously and its progress can be tracked using the returned\ntask_id.","operationId":"create_document_v3_documents_post","security":[{"HTTPBearer":[]}],"requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_create_document_v3_documents_post"}}}},"responses":{"202":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_DocumentIngestionResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-codeSamples":[{"lang":"Python","source":"\nfrom r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n# when using auth, do client.login(...)\n\nresult = client.documents.create(\n file_path=\"pg_essay_1.html\",\n metadata={\"metadata_1\":\"some random metadata\"},\n id=None\n)"},{"lang":"cURL","source":"\ncurl -X POST \"https://api.example.com/v3/documents\" \\\n-H \"Content-Type: multipart/form-data\" \\\n-H \"Authorization: Bearer YOUR_API_KEY\" \\\n-F \"file=@pg_essay_1.html;type=text/html\" \\\n-F 'metadata={}' \\\n-F 'id=null'"}]},"get":{"summary":"List documents","description":"Returns a paginated list of documents the authenticated user has access to.\n\nResults can be filtered by providing specific document IDs. Regular users will only see\ndocuments they own or have access to through collections. Superusers can see all documents.\n\nThe documents are returned in order of last modification, with most recent first.","operationId":"get_documents_v3_documents_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"ids","in":"query","required":false,"schema":{"type":"array","items":{"type":"string"},"description":"A list of document IDs to retrieve. If not provided, all documents will be returned.","default":[],"title":"Ids"},"description":"A list of document IDs to retrieve. If not provided, all documents will be returned."},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"The offset of the first document to retrieve.","default":0,"title":"Offset"},"description":"The offset of the first document to retrieve."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":-1,"description":"The maximum number of documents to retrieve. If set to -1, all documents will be returned, otherwise up to 1,000 documents will be returned.","default":100,"title":"Limit"},"description":"The maximum number of documents to retrieve. If set to -1, all documents will be returned, otherwise up to 1,000 documents will be returned."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResultsWrapper_list_DocumentResponse__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-codeSamples":[{"lang":"Python","source":"\nfrom r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n# when using auth, do client.login(...)\n\nresult = client.documents.list(\n limit=10,\n offset=0\n)"},{"lang":"cURL","source":"\ncurl -X GET \"https://api.example.com/v3/documents\" -H \"Authorization: Bearer YOUR_API_KEY\" "}]}},"/v3/documents/{id}":{"post":{"summary":"Update a document","description":"Updates an existing document with new content and/or metadata. This will trigger\nreprocessing of the document's chunks and knowledge graph data.\n\nEither a new file or text content must be provided, but not both. The update process\nruns asynchronously and its progress can be tracked using the returned task_id.\n\nRegular users can only update their own documents. Superusers can update any document.\nAll previous document versions are preserved in the system.","operationId":"update_document_v3_documents__id__post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"The ID of the document. If not provided, a new ID will be generated.","title":"Id"},"description":"The ID of the document. If not provided, a new ID will be generated."}],"requestBody":{"content":{"multipart/form-data":{"schema":{"$ref":"#/components/schemas/Body_update_document_v3_documents__id__post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_DocumentIngestionResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-codeSamples":[{"lang":"Python","source":"\nfrom r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n# when using auth, do client.login(...)\n\nresult = client.documents.update(\n file_path=\"pg_essay_1.html\",\n id=\"9fbe403b-c11c-5aae-8ade-ef22980c3ad1\"\n)"},{"lang":"cURL","source":"\ncurl -X POST \"https://api.example.com/document/9fbe403b-c11c-5aae-8ade-ef22980c3ad1\" -H \"Content-Type: multipart/form-data\" -H \"Authorization: Bearer YOUR_API_KEY\" -F \"file=@pg_essay_1.html;type=text/plain\" "}]},"get":{"summary":"Retrieve a document","description":"Retrieves detailed information about a specific document by its ID.\n\nThis endpoint returns the document's metadata, status, and system information. It does not\nreturn the document's content - use the `/documents/{id}/download` endpoint for that.\n\nUsers can only retrieve documents they own or have access to through collections.\nSuperusers can retrieve any document.","operationId":"get_document_v3_documents__id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"The ID of the document to retrieve.","title":"Id"},"description":"The ID of the document to retrieve."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_DocumentResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-codeSamples":[{"lang":"Python","source":"\nfrom r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n# when using auth, do client.login(...)\n\nresult = client.documents.retrieve(\n id=\"9fbe403b-c11c-5aae-8ade-ef22980c3ad1\"\n)"},{"lang":"cURL","source":"\ncurl -X GET \"https://api.example.com/v3/documents/9fbe403b-c11c-5aae-8ade-ef22980c3ad1\" -H \"Authorization: Bearer YOUR_API_KEY\" "}]},"delete":{"summary":"Delete a document","description":"Delete a specific document. All chunks corresponding to the document are deleted, and all other references to the document are removed.\n\nNOTE - Deletions do not yet impact the knowledge graph or other derived data. This feature is planned for a future release.","operationId":"delete_document_by_id_v3_documents__id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"Document ID","title":"Id"},"description":"Document ID"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_NoneType_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-codeSamples":[{"lang":"Python","source":"\nfrom r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n# when using auth, do client.login(...)\n\nresult = client.documents.delete(\n id=\"9fbe403b-c11c-5aae-8ade-ef22980c3ad1\"\n)"},{"lang":"cURL","source":"\ncurl -X DELETE \"https://api.example.com/v3/documents/b4ac4dd6-5f27-596e-a55b-7cf242ca30aa\" -H \"Authorization: Bearer YOUR_API_KEY\" "}]}},"/v3/documents/{id}/chunks":{"get":{"summary":"List document chunks","description":"Retrieves the text chunks that were generated from a document during ingestion.\nChunks represent semantic sections of the document and are used for retrieval\nand analysis.\n\nUsers can only access chunks from documents they own or have access to through\ncollections. Vector embeddings are only included if specifically requested.\n\nResults are returned in chunk sequence order, representing their position in\nthe original document.","operationId":"list_chunks_v3_documents__id__chunks_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","description":"The ID of the document to retrieve chunks for.","title":"Id"},"description":"The ID of the document to retrieve chunks for."},{"name":"offset","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","minimum":0},{"type":null}],"description":"The offset of the first chunk to retrieve.","default":0,"title":"Offset"},"description":"The offset of the first chunk to retrieve."},{"name":"limit","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","maximum":20000,"minimum":0},{"type":null}],"description":"The maximum number of chunks to retrieve, up to 20,000.","default":100,"title":"Limit"},"description":"The maximum number of chunks to retrieve, up to 20,000."},{"name":"include_vectors","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":null}],"description":"Whether to include vector embeddings in the response.","default":false,"title":"Include Vectors"},"description":"Whether to include vector embeddings in the response."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResultsWrapper_list_ChunkResponse__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-codeSamples":[{"lang":"Python","source":"\nfrom r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n# when using auth, do client.login(...)\n\nresult = client.documents.list_chunks(\n id=\"9fbe403b-c11c-5aae-8ade-ef22980c3ad1\"\n)"},{"lang":"cURL","source":"\ncurl -X GET \"https://api.example.com/v3/documents/9fbe403b-c11c-5aae-8ade-ef22980c3ad1/chunks\" -H \"Authorization: Bearer YOUR_API_KEY\" "}]}},"/v3/documents/{id}/download":{"get":{"summary":"Download document content","description":"Downloads the original file content of a document.\n\nFor uploaded files, returns the original file with its proper MIME type.\nFor text-only documents, returns the content as plain text.\n\nUsers can only download documents they own or have access to through collections.","operationId":"get_document_file_v3_documents__id__download_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"Document ID","title":"Id"},"description":"Document ID"}],"responses":{"200":{"description":"Successful Response"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-codeSamples":[{"lang":"Python","source":"\nfrom r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n# when using auth, do client.login(...)\n\nresult = client.documents.download(\n id=\"b4ac4dd6-5f27-596e-a55b-7cf242ca30aa\"\n)"},{"lang":"cURL","source":"\ncurl -X GET \"https://api.example.com/v3/documents/b4ac4dd6-5f27-596e-a55b-7cf242ca30aa/download\" -H \"Authorization: Bearer YOUR_API_KEY\" "}]}},"/v3/documents/by-filter":{"delete":{"summary":"Delete documents by filter","description":"Delete documents based on provided filters. Allowed operators include `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `like`, `ilike`, `in`, and `nin`. Deletion requests are limited to a user's own documents.","operationId":"delete_document_by_filter_v3_documents_by_filter_delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"filters","in":"query","required":true,"schema":{"type":"string","description":"JSON-encoded filters","title":"Filters"},"description":"JSON-encoded filters"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_NoneType_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/documents/{id}/collections":{"get":{"summary":"List document collections","description":"Retrieves all collections that contain the specified document. This endpoint is restricted\nto superusers only and provides a system-wide view of document organization.\n\nCollections are used to organize documents and manage access control. A document can belong\nto multiple collections, and users can access documents through collection membership.\n\nThe results are paginated and ordered by collection creation date, with the most recently\ncreated collections appearing first.","operationId":"get_document_collections_v3_documents__id__collections_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","description":"Document ID","title":"Id"},"description":"Document ID"},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"The offset of the first collection to retrieve.","default":0,"title":"Offset"},"description":"The offset of the first collection to retrieve."},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"description":"The maximum number of collections to retrieve, up to 1,000.","default":100,"title":"Limit"},"description":"The maximum number of collections to retrieve, up to 1,000."}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/shared__api__models__base__ResultsWrapper_list_CollectionResponse____1"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-codeSamples":[{"lang":"Python","source":"\nfrom r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n# when using auth, do client.login(...)\n\nresult = client.documents.list_collections(\n id=\"9fbe403b-c11c-5aae-8ade-ef22980c3ad1\", offset=0, limit=10\n)"},{"lang":"cURL","source":"\ncurl -X GET \"https://api.example.com/v3/documents/9fbe403b-c11c-5aae-8ade-ef22980c3ad1/collections\" -H \"Authorization: Bearer YOUR_API_KEY\" "}]}},"/v3/chunks":{"post":{"summary":"Create Chunks","operationId":"create_chunks_v3_chunks_post","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_create_chunks_v3_chunks_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_list_ChunkIngestionResponse__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-codeSamples":[{"lang":"Python","source":"\nfrom r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n# when using auth, do client.login(...)\n\nresult = client.chunks.create(\n chunks=[\n {\n \"id\": \"b4ac4dd6-5f27-596e-a55b-7cf242ca30aa\",\n \"document_id\": \"b4ac4dd6-5f27-596e-a55b-7cf242ca30aa\",\n \"collection_ids\": [\"b4ac4dd6-5f27-596e-a55b-7cf242ca30aa\"],\n \"metadata\": {\"key\": \"value\"},\n \"text\": \"Some text content\"\n }\n ],\n run_with_orchestration=False\n)\n"},{"lang":"cURL","source":"\ncurl -X POST \"https://api.example.com/v3/chunks\" \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -d '{\n \"chunks\": [{\n \"id\": \"b4ac4dd6-5f27-596e-a55b-7cf242ca30aa\",\n \"document_id\": \"b4ac4dd6-5f27-596e-a55b-7cf242ca30aa\",\n \"collection_ids\": [\"b4ac4dd6-5f27-596e-a55b-7cf242ca30aa\"],\n \"metadata\": {\"key\": \"value\"},\n \"text\": \"Some text content\"\n }],\n \"run_with_orchestration\": false\n }'\n"}]},"get":{"summary":"List Chunks","description":"List chunks with pagination support.\n\nReturns a paginated list of chunks that the user has access to.\nResults can be filtered and sorted based on various parameters.\nVector embeddings are only included if specifically requested.\n\nRegular users can only list chunks they own or have access to through\ncollections. Superusers can list all chunks in the system.","operationId":"list_chunks_v3_chunks_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Number of records to skip","default":0,"title":"Offset"},"description":"Number of records to skip"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Maximum number of records to return","default":10,"title":"Limit"},"description":"Maximum number of records to return"},{"name":"sort_by","in":"query","required":false,"schema":{"type":"string","description":"Field to sort by","default":"created_at","title":"Sort By"},"description":"Field to sort by"},{"name":"sort_order","in":"query","required":false,"schema":{"type":"string","pattern":"^(ASC|DESC)$","description":"Sort order","default":"DESC","title":"Sort Order"},"description":"Sort order"},{"name":"metadata_filter","in":"query","required":false,"schema":{"anyOf":[{"type":"string","contentMediaType":"application/json","contentSchema":{"type":"object"}},{"type":null}],"description":"Filter by metadata","title":"Metadata Filter"},"description":"Filter by metadata"},{"name":"include_vectors","in":"query","required":false,"schema":{"type":"boolean","description":"Include vector data in response","default":false,"title":"Include Vectors"},"description":"Include vector data in response"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResultsWrapper_list_ChunkResponse__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-codeSamples":[{"lang":"Python","source":"\nfrom r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\nresults = client.chunks.list(\n offset=0,\n limit=10,\n sort_by=\"created_at\",\n sort_order=\"DESC\",\n metadata_filter={\"key\": \"value\"},\n include_vectors=False\n)\n"}]}},"/v3/chunks/search":{"post":{"summary":"Search Chunks","description":"Perform a semantic search query over all stored chunks.\n\nThis endpoint allows for complex filtering of search results using PostgreSQL-based queries.\nFilters can be applied to various fields such as document_id, and internal metadata values.\n\nAllowed operators include `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `like`, `ilike`, `in`, and `nin`.","operationId":"search_chunks_v3_chunks_search_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_search_chunks_v3_chunks_search_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_list_VectorSearchResult__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}],"x-codeSamples":[{"lang":"Python","source":"\nfrom r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\nresults = client.chunks.search(\n query=\"search query\",\n vector_search_settings={\n \"limit\": 10,\n \"min_score\": 0.7\n }\n)\n"}]}},"/v3/chunks/{id}":{"get":{"summary":"Retrieve Chunk","description":"Get a specific chunk by its ID.\n\nReturns the chunk's content, metadata, and associated document/collection information.\nUsers can only retrieve chunks they own or have access to through collections.","operationId":"retrieve_chunk_v3_chunks__id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_ChunkResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-codeSamples":[{"lang":"Python","source":"\nfrom r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\nchunk = client.chunks.retrieve(id=\"b4ac4dd6-5f27-596e-a55b-7cf242ca30aa\")\n"}]},"post":{"summary":"Update Chunk","description":"Update an existing chunk's content and/or metadata.\n\nThe chunk's vectors will be automatically recomputed based on the new content.\nUsers can only update chunks they own unless they are superusers.","operationId":"update_chunk_v3_chunks__id__post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateChunk"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_ChunkResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-codeSamples":[{"lang":"Python","source":"\nfrom r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\nresult = client.chunks.update(\n id=\"b4ac4dd6-5f27-596e-a55b-7cf242ca30aa\",\n text=\"Updated content\",\n metadata={\"key\": \"new value\"}\n)\n"}]},"delete":{"summary":"Delete Chunk","description":"Delete a specific chunk by ID.\n\nThis permanently removes the chunk and its associated vector embeddings.\nThe parent document remains unchanged. Users can only delete chunks they\nown unless they are superusers.","operationId":"delete_chunk_v3_chunks__id__delete","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_ChunkResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-codeSamples":[{"lang":"Python","source":"\nfrom r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\nresult = client.chunks.delete(\n id=\"b4ac4dd6-5f27-596e-a55b-7cf242ca30aa\"\n)\n"}]}},"/v3/chunks/{id}/enrich":{"post":{"summary":"Enrich Chunk","description":"Enrich a chunk with additional processing and metadata.\n\nThis endpoint allows adding additional enrichments to an existing chunk,\nsuch as entity extraction, classification, or custom processing defined\nin the enrichment_config.\n\nUsers can only enrich chunks they own unless they are superusers.","operationId":"enrich_chunk_v3_chunks__id__enrich_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","title":"Enrichment Config"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_ChunkResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-codeSamples":[{"lang":"Python","source":"\nfrom r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\nresult = client.chunks.enrich(\n id=\"b4ac4dd6-5f27-596e-a55b-7cf242ca30aa\",\n enrichment_config={\"key\": \"value\"}\n)\n"}]}},"/v3/indices":{"post":{"summary":"Create Vector Index","description":"Create a new vector similarity search index in the database.\n\nThis endpoint creates a database index optimized for efficient similarity search over vector embeddings.\nIt supports two main indexing methods:\n\n1. HNSW (Hierarchical Navigable Small World):\n - Best for: High-dimensional vectors requiring fast approximate nearest neighbor search\n - Pros: Very fast search, good recall, memory-resident for speed\n - Cons: Slower index construction, more memory usage\n - Key parameters:\n * m: Number of connections per layer (higher = better recall but more memory)\n * ef_construction: Build-time search width (higher = better recall but slower build)\n * ef: Query-time search width (higher = better recall but slower search)\n\n2. IVF-Flat (Inverted File with Flat Storage):\n - Best for: Balance between build speed, search speed, and recall\n - Pros: Faster index construction, less memory usage\n - Cons: Slightly slower search than HNSW\n - Key parameters:\n * lists: Number of clusters (usually sqrt(n) where n is number of vectors)\n * probe: Number of nearest clusters to search\n\nSupported similarity measures:\n- cosine_distance: Best for comparing semantic similarity\n- l2_distance: Best for comparing absolute distances\n- ip_distance: Best for comparing raw dot products\n\nNotes:\n- Index creation can be resource-intensive for large datasets\n- Use run_with_orchestration=True for large indices to prevent timeouts\n- The 'concurrently' option allows other operations while building\n- Index names must be unique per table","operationId":"create_index_v3_indices_post","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_create_index_v3_indices_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_CreateVectorIndexResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-codeSamples":[{"lang":"Python","source":"\nfrom r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n# when using auth, do client.login(...)\n\n# Create an HNSW index for efficient similarity search\nresult = client.indices.create(\n config={\n \"table_name\": \"vectors\", # The table containing vector embeddings\n \"index_method\": \"hnsw\", # Hierarchical Navigable Small World graph\n \"index_measure\": \"cosine_distance\", # Similarity measure\n \"index_arguments\": {\n \"m\": 16, # Number of connections per layer\n \"ef_construction\": 64,# Size of dynamic candidate list for construction\n \"ef\": 40, # Size of dynamic candidate list for search\n },\n \"index_name\": \"my_document_embeddings_idx\",\n \"index_column\": \"embedding\",\n \"concurrently\": True # Build index without blocking table writes\n },\n run_with_orchestration=True # Run as orchestrated task for large indices\n)\n\n# Create an IVF-Flat index for balanced performance\nresult = client.indices.create(\n config={\n \"table_name\": \"vectors\",\n \"index_method\": \"ivf_flat\", # Inverted File with Flat storage\n \"index_measure\": \"l2_distance\",\n \"index_arguments\": {\n \"lists\": 100, # Number of cluster centroids\n \"probe\": 10, # Number of clusters to search\n },\n \"index_name\": \"my_ivf_embeddings_idx\",\n \"index_column\": \"embedding\",\n \"concurrently\": True\n }\n)"},{"lang":"Shell","source":"\n# Create HNSW Index\ncurl -X POST \"https://api.example.com/indices\" \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -d '{\n \"config\": {\n \"table_name\": \"vectors\",\n \"index_method\": \"hnsw\",\n \"index_measure\": \"cosine_distance\",\n \"index_arguments\": {\n \"m\": 16,\n \"ef_construction\": 64,\n \"ef\": 40\n },\n \"index_name\": \"my_document_embeddings_idx\",\n \"index_column\": \"embedding\",\n \"concurrently\": true\n },\n \"run_with_orchestration\": true\n }'\n\n# Create IVF-Flat Index\ncurl -X POST \"https://api.example.com/indices\" \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -d '{\n \"config\": {\n \"table_name\": \"vectors\",\n \"index_method\": \"ivf_flat\",\n \"index_measure\": \"l2_distance\",\n \"index_arguments\": {\n \"lists\": 100,\n \"probe\": 10\n },\n \"index_name\": \"my_ivf_embeddings_idx\",\n \"index_column\": \"embedding\",\n \"concurrently\": true\n }\n }'"}]},"get":{"summary":"List Vector Indices","description":"List existing vector similarity search indices with pagination support.\n\nReturns details about each index including:\n- Name and table name\n- Indexing method and parameters\n- Size and row count\n- Creation timestamp and last updated\n- Performance statistics (if available)\n\nThe response can be filtered using the filter_by parameter to narrow down results\nbased on table name, index method, or other attributes.","operationId":"list_indices_v3_indices_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"description":"Number of records to skip","default":0,"title":"Offset"},"description":"Number of records to skip"},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"description":"Maximum number of records to return","default":10,"title":"Limit"},"description":"Maximum number of records to return"},{"name":"filter_by","in":"query","required":false,"schema":{"anyOf":[{"type":"string","contentMediaType":"application/json","contentSchema":{"type":"object"}},{"type":null}],"description":"Filter criteria for indices (e.g., {\"table_name\": \"vectors\"})","title":"Filter By"},"description":"Filter criteria for indices (e.g., {\"table_name\": \"vectors\"})"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_ListVectorIndicesResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-codeSamples":[{"lang":"Python","source":"\nfrom r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n\n# List all indices\nindices = client.indices.list(\n offset=0,\n limit=10,\n filter_by={\"table_name\": \"vectors\"}\n)\n\n# Print index details\nfor idx in indices:\n print(f\"Index: {idx['name']}\")\n print(f\"Method: {idx['method']}\")\n print(f\"Size: {idx['size_bytes'] / 1024 / 1024:.2f} MB\")\n print(f\"Row count: {idx['row_count']}\")"},{"lang":"Shell","source":"\ncurl -X GET \"https://api.example.com/indices?offset=0&limit=10\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -H \"Content-Type: application/json\"\n \n# With filters\ncurl -X GET \"https://api.example.com/indices?offset=0&limit=10&filter_by={\"table_name\":\"vectors\"}\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -H \"Content-Type: application/json\"\n"}]}},"/v3/indices/{id}":{"get":{"summary":"Get Vector Index Details","description":"Get detailed information about a specific vector index.\n\nReturns comprehensive information about the index including:\n- Configuration details (method, measure, parameters)\n- Current size and row count\n- Build progress (if still under construction)\n- Performance statistics:\n * Average query time\n * Memory usage\n * Cache hit rates\n * Recent query patterns\n- Maintenance information:\n * Last vacuum\n * Fragmentation level\n * Recommended optimizations","operationId":"get_index_v3_indices__id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-codeSamples":[{"lang":"Python","source":"\nfrom r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n\n# Get detailed information about a specific index\nindex = client.indices.get(\"550e8400-e29b-41d4-a716-446655440000\")\n\n# Access index details\nprint(f\"Index Method: {index['method']}\")\nprint(f\"Parameters: {index['parameters']}\")\nprint(f\"Performance Stats: {index['stats']}\")"},{"lang":"Shell","source":"\ncurl -X GET \"https://api.example.com/indices/550e8400-e29b-41d4-a716-446655440000\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\"\n"}]},"put":{"summary":"Update Vector Index","description":"Update an existing index's configuration.","operationId":"update_index_v3_indices__id__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_update_index_v3_indices__id__put"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-codeSamples":[{"lang":"Python","source":"\nfrom r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n\n# Update HNSW index parameters\nresult = client.indices.update(\n \"550e8400-e29b-41d4-a716-446655440000\",\n config={\n \"index_arguments\": {\n \"ef\": 80, # Increase search quality\n \"m\": 24 # Increase connections per layer\n },\n \"concurrently\": True\n },\n run_with_orchestration=True\n)"},{"lang":"Shell","source":"\ncurl -X PUT \"https://api.example.com/indices/550e8400-e29b-41d4-a716-446655440000\" \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -d '{\n \"config\": {\n \"index_arguments\": {\n \"ef\": 80,\n \"m\": 24\n },\n \"concurrently\": true\n },\n \"run_with_orchestration\": true\n }'"}]},"delete":{"summary":"Delete Vector Index","description":"Delete an existing vector similarity search index.\n\nThis endpoint removes the specified index from the database. Important considerations:\n\n- Deletion is permanent and cannot be undone\n- Underlying vector data remains intact\n- Queries will fall back to sequential scan\n- Running queries during deletion may be slower\n- Use run_with_orchestration=True for large indices to prevent timeouts\n- Consider index dependencies before deletion\n\nThe operation returns immediately but cleanup may continue in background\nwhen run_with_orchestration=True.","operationId":"delete_index_v3_indices__id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}}],"requestBody":{"content":{"application/json":{"schema":{"anyOf":[{"type":"boolean"},{"type":null}],"default":true,"title":"Run With Orchestration"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_DeleteVectorIndexResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-codeSamples":[{"lang":"Python","source":"\nfrom r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n\n# Delete an index with orchestration for cleanup\nresult = client.indices.delete(\n \"550e8400-e29b-41d4-a716-446655440000\",\n run_with_orchestration=True\n)"},{"lang":"Shell","source":"\ncurl -X DELETE \"https://api.example.com/indices/550e8400-e29b-41d4-a716-446655440000\" \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -d '{\n \"run_with_orchestration\": true\n }'"}]}},"/v3/users":{"get":{"summary":"List Users","description":"List all users with pagination and filtering options.\nOnly accessible by superusers.","operationId":"list_users_v3_users_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":100,"title":"Limit"}},{"name":"username","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":null}],"title":"Username"}},{"name":"email","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":null}],"title":"Email"}},{"name":"is_active","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":null}],"title":"Is Active"}},{"name":"is_superuser","in":"query","required":false,"schema":{"anyOf":[{"type":"boolean"},{"type":null}],"title":"Is Superuser"}},{"name":"sort_by","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":null}],"title":"Sort By"}},{"name":"sort_order","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":null}],"default":"desc","title":"Sort Order"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResultsWrapper_List_UserOverviewResponse__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/users/{user_id}":{"get":{"summary":"Get User","description":"Get detailed information about a specific user.\nUsers can only access their own information unless they are superusers.","operationId":"get_user_v3_users__user_id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_UserResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"summary":"Update User","description":"Update user information.\nUsers can only update their own information unless they are superusers.\nSuperuser status can only be modified by existing superusers.","operationId":"update_user_v3_users__user_id__post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_update_user_v3_users__user_id__post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_UserResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/users/{user_id}/collections":{"get":{"summary":"Get User Collections","description":"Get all collections associated with a specific user.\nUsers can only access their own collections unless they are superusers.","operationId":"get_user_collections_v3_users__user_id__collections_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":100,"title":"Limit"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResultsWrapper_List_UserCollectionResponse__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/users/{user_id}/collections/{collection_id}":{"post":{"summary":"Add User To Collection","description":"Add a user to a collection.\nRequires either superuser status or access to the collection.","operationId":"add_user_to_collection_v3_users__user_id__collections__collection_id__post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}},{"name":"collection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Collection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_NoneType_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Remove User From Collection","description":"Remove a user from a collection.\nRequires either superuser status or access to the collection.","operationId":"remove_user_from_collection_v3_users__user_id__collections__collection_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}},{"name":"collection_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Collection Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_NoneType_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/collections":{"post":{"summary":"Create Collection","description":"Create a new collection and automatically add the creating user to it.","operationId":"create_collection_v3_collections_post","security":[{"HTTPBearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionConfig"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_CollectionResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"get":{"summary":"List Collections","description":"List collections the user has access to with pagination and filtering options.","operationId":"list_collections_v3_collections_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":100,"title":"Limit"}},{"name":"name","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":null}],"title":"Name"}},{"name":"sort_by","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":null}],"title":"Sort By"}},{"name":"sort_order","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":null}],"default":"desc","title":"Sort Order"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/shared__api__models__base__ResultsWrapper_list_CollectionResponse____2"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/collections/{id}":{"get":{"summary":"Get Collection","description":"Get details of a specific collection.","operationId":"get_collection_v3_collections__id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_CollectionResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"post":{"summary":"Update Collection","description":"Update an existing collection's configuration.","operationId":"update_collection_v3_collections__id__post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CollectionConfig"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_CollectionResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Delete Collection","description":"Delete an existing collection.","operationId":"delete_collection_v3_collections__id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_NoneType_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/collections/{id}/documents":{"get":{"summary":"Get Collection Documents","description":"Get all documents in a collection with pagination and sorting options.","operationId":"get_collection_documents_v3_collections__id__documents_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":100,"title":"Limit"}},{"name":"sort_by","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":null}],"title":"Sort By"}},{"name":"sort_order","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":null}],"default":"desc","title":"Sort Order"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResultsWrapper_list_DocumentOverviewResponse__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/collections/{id}/documents/{document_id}":{"post":{"summary":"Add Document To Collection","description":"Add a document to a collection.","operationId":"add_document_to_collection_v3_collections__id__documents__document_id__post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}},{"name":"document_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Document Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_NoneType_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Remove Document From Collection","description":"Remove a document from a collection.","operationId":"remove_document_from_collection_v3_collections__id__documents__document_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}},{"name":"document_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Document Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_NoneType_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/collections/{id}/users":{"get":{"summary":"Get Collection Users","description":"Get all users in a collection with pagination and sorting options.","operationId":"get_collection_users_v3_collections__id__users_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}},{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":100,"title":"Limit"}},{"name":"sort_by","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":null}],"title":"Sort By"}},{"name":"sort_order","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":null}],"default":"desc","title":"Sort Order"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResultsWrapper_list_UserResponse__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/collections/{id}/users/{user_id}":{"post":{"summary":"Add User To Collection","description":"Add a user to a collection.","operationId":"add_user_to_collection_v3_collections__id__users__user_id__post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}},{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_NoneType_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Remove User From Collection","description":"Remove a user from a collection.","operationId":"remove_user_from_collection_v3_collections__id__users__user_id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}},{"name":"user_id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"User Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_NoneType_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/conversations":{"post":{"summary":"Create Conversation","description":"Create a new conversation.","operationId":"create_conversation_v3_conversations_post","security":[{"HTTPBearer":[]}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_list_Tuple_str__Message___"}}}}}},"get":{"summary":"List Conversations","description":"List conversations with pagination and sorting options.","operationId":"list_conversations_v3_conversations_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"offset","in":"query","required":false,"schema":{"type":"integer","minimum":0,"default":0,"title":"Offset"}},{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":1000,"minimum":1,"default":100,"title":"Limit"}},{"name":"sort_by","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":null}],"title":"Sort By"}},{"name":"sort_order","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":null}],"default":"desc","title":"Sort Order"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PaginatedResultsWrapper_list_ConversationOverviewResponse__"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/conversations/{id}":{"get":{"summary":"Get Conversation","description":"Get details of a specific conversation.","operationId":"get_conversation_v3_conversations__id__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}},{"name":"branch_id","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":null}],"title":"Branch Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_list_Tuple_str__Message___"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Delete Conversation","description":"Delete an existing conversation.","operationId":"delete_conversation_v3_conversations__id__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_NoneType_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/conversations/{id}/messages":{"post":{"summary":"Add Message","description":"Add a new message to a conversation.","operationId":"add_message_v3_conversations__id__messages_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageContent"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Add Message V3 Conversations Id Messages Post"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/conversations/{id}/messages/{message_id}":{"put":{"summary":"Update Message","description":"Update an existing message in a conversation.","operationId":"update_message_v3_conversations__id__messages__message_id__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}},{"name":"message_id","in":"path","required":true,"schema":{"type":"string","title":"Message Id"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"string","title":"Content"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response Update Message V3 Conversations Id Messages Message Id Put"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/conversations/{id}/branches":{"get":{"summary":"List Branches","description":"List all branches in a conversation.","operationId":"list_branches_v3_conversations__id__branches_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid","title":"Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"object","title":"Response List Branches V3 Conversations Id Branches Get"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/prompts":{"get":{"summary":"List Prompts","description":"List all available prompts.","operationId":"list_prompts_v3_prompts_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_AllPromptsResponse_"}}}}},"security":[{"HTTPBearer":[]}]},"post":{"summary":"Create Prompt","description":"Create a new prompt with the given configuration.","operationId":"create_prompt_v3_prompts_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PromptConfig"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_UpdatePromptResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/v3/prompts/{name}":{"get":{"summary":"Get Prompt","description":"Get a specific prompt by name, optionally with inputs and override.","operationId":"get_prompt_v3_prompts__name__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","description":"Prompt name","title":"Name"},"description":"Prompt name"},{"name":"inputs","in":"query","required":false,"schema":{"anyOf":[{"type":"string","contentMediaType":"application/json","contentSchema":{"type":"object"}},{"type":null}],"description":"JSON-encoded prompt inputs","title":"Inputs"},"description":"JSON-encoded prompt inputs"},{"name":"prompt_override","in":"query","required":false,"schema":{"anyOf":[{"type":"string"},{"type":null}],"description":"Prompt override","title":"Prompt Override"},"description":"Prompt override"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_UpdatePromptResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"put":{"summary":"Update Prompt","description":"Update an existing prompt's template and/or input types.","operationId":"update_prompt_v3_prompts__name__put","security":[{"HTTPBearer":[]}],"parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","description":"Prompt name","title":"Name"},"description":"Prompt name"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_update_prompt_v3_prompts__name__put"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_UpdatePromptResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}},"delete":{"summary":"Delete Prompt","description":"Delete a prompt by name.","operationId":"delete_prompt_v3_prompts__name__delete","security":[{"HTTPBearer":[]}],"parameters":[{"name":"name","in":"path","required":true,"schema":{"type":"string","description":"Prompt name","title":"Name"},"description":"Prompt name"}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_NoneType_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/v3/retrieval/search":{"post":{"summary":"Search R2R","description":"Perform a search query on the vector database and knowledge graph and any other configured search engines.\n\nThis endpoint allows for complex filtering of search results using PostgreSQL-based queries.\nFilters can be applied to various fields such as document_id, and internal metadata values.\n\nAllowed operators include `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `like`, `ilike`, `in`, and `nin`.","operationId":"search_app_v3_retrieval_search_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_search_app_v3_retrieval_search_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_CombinedSearchResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}],"x-codeSamples":[{"lang":"Python","source":"\nfrom r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n# when using auth, do client.login(...)\n\nresult = client.search(\n query=\"Who is Aristotle?\",\n vector_search_settings={\n \"use_vector_search\": True,\n \"filters\": {\"document_id\": {\"$eq\": \"3e157b3a-8469-51db-90d9-52e7d896b49b\"}},\n \"search_limit\": 20,\n \"use_hybrid_search\": True\n },\n kg_search_settings={\n \"use_kg_search\": True,\n \"kg_search_type\": \"local\",\n \"kg_search_level\": \"0\",\n \"generation_config\": {\n \"model\": \"gpt-4o-mini\",\n \"temperature\": 0.7,\n },\n \"local_search_limits\": {\n \"__Entity__\": 20,\n \"__Relationship__\": 20,\n \"__Community__\": 20,\n },\n \"max_community_description_length\": 65536,\n \"max_llm_queries_for_global_search\": 250\n }\n)"},{"lang":"Shell","source":"\ncurl -X POST \"https://api.example.com/retrieval/search\" \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -d '{\n \"query\": \"Who is Aristotle?\",\n \"vector_search_settings\": {\n \"use_vector_search\": true,\n \"filters\": {\"document_id\": {\"$eq\": \"3e157b3a-8469-51db-90d9-52e7d896b49b\"}},\n \"search_limit\": 20,\n \"use_hybrid_search\": true\n },\n \"kg_search_settings\": {\n \"use_kg_search\": true,\n \"kg_search_type\": \"local\",\n \"kg_search_level\": \"0\",\n \"generation_config\": {\n \"model\": \"gpt-4o-mini\",\n \"temperature\": 0.7\n },\n \"local_search_limits\": {\n \"__Entity__\": 20,\n \"__Relationship__\": 20,\n \"__Community__\": 20\n },\n \"max_community_description_length\": 65536,\n \"max_llm_queries_for_global_search\": 250\n }\n }'"}]}},"/v3/retrieval/rag":{"post":{"summary":"RAG Query","description":"Execute a RAG (Retrieval-Augmented Generation) query.\n\nThis endpoint combines search results with language model generation.\nIt supports the same filtering capabilities as the search endpoint,\nallowing for precise control over the retrieved context.\n\nThe generation process can be customized using the `rag_generation_config` parameter.","operationId":"rag_app_v3_retrieval_rag_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_rag_app_v3_retrieval_rag_post"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_RAGResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}],"x-codeSamples":[{"lang":"Python","source":"\nfrom r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n# when using auth, do client.login(...)\n\nresult = client.rag(\n query=\"Who is Aristotle?\",\n vector_search_settings={\n \"use_vector_search\": True,\n \"filters\": {\"document_id\": {\"$eq\": \"3e157b3a-8469-51db-90d9-52e7d896b49b\"}},\n \"search_limit\": 20,\n \"use_hybrid_search\": True\n },\n kg_search_settings={\n \"use_kg_search\": True,\n \"kg_search_type\": \"local\",\n \"kg_search_level\": \"0\",\n \"generation_config\": {\n \"model\": \"gpt-4o-mini\",\n \"temperature\": 0.7,\n }\n },\n rag_generation_config={\n \"stream\": False,\n \"temperature\": 0.7,\n \"max_tokens\": 150\n }\n)"},{"lang":"Shell","source":"\ncurl -X POST \"https://api.example.com/retrieval/rag\" \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -d '{\n \"query\": \"Who is Aristotle?\",\n \"vector_search_settings\": {\n \"use_vector_search\": true,\n \"filters\": {\"document_id\": {\"$eq\": \"3e157b3a-8469-51db-90d9-52e7d896b49b\"}},\n \"search_limit\": 20,\n \"use_hybrid_search\": true\n },\n \"kg_search_settings\": {\n \"use_kg_search\": true,\n \"kg_search_type\": \"local\",\n \"kg_search_level\": \"0\",\n \"generation_config\": {\n \"model\": \"gpt-4o-mini\",\n \"temperature\": 0.7\n }\n },\n \"rag_generation_config\": {\n \"stream\": false,\n \"temperature\": 0.7,\n \"max_tokens\": 150\n }\n }'"}]}},"/v3/retrieval/agent":{"post":{"summary":"RAG-powered Conversational Agent","description":"Engage with an intelligent RAG-powered conversational agent for complex information retrieval and analysis.\n\nThis advanced endpoint combines retrieval-augmented generation (RAG) with a conversational AI agent to provide\ndetailed, context-aware responses based on your document collection. The agent can:\n\n- Maintain conversation context across multiple interactions\n- Dynamically search and retrieve relevant information from both vector and knowledge graph sources\n- Break down complex queries into sub-questions for comprehensive answers\n- Cite sources and provide evidence-based responses\n- Handle follow-up questions and clarifications\n- Navigate complex topics with multi-step reasoning\n\nKey Features:\n- Hybrid search combining vector and knowledge graph approaches\n- Contextual conversation management with conversation_id tracking\n- Customizable generation parameters for response style and length\n- Source document citation with optional title inclusion\n- Streaming support for real-time responses\n- Branch management for exploring different conversation paths\n\nCommon Use Cases:\n- Research assistance and literature review\n- Document analysis and summarization\n- Technical support and troubleshooting\n- Educational Q&A and tutoring\n- Knowledge base exploration\n\nThe agent uses both vector search and knowledge graph capabilities to find and synthesize\ninformation, providing detailed, factual responses with proper attribution to source documents.","operationId":"agent_app_v3_retrieval_agent_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_agent_app_v3_retrieval_agent_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResultsWrapper_RAGAgentResponse_"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}],"x-codeSamples":[{"lang":"Python","source":"\n from r2r import R2RClient\n\n client = R2RClient(\"http://localhost:7272\")\n # when using auth, do client.login(...)\n\n result = client.agent(\n message={\n \"role\": \"user\", \n \"content\": \"What were the key contributions of Aristotle to logic and how did they influence later philosophers?\"\n },\n vector_search_settings={\n \"use_vector_search\": True,\n \"filters\": {\"collection_ids\": [\"5e157b3a-8469-51db-90d9-52e7d896b49b\"]},\n \"search_limit\": 20,\n \"use_hybrid_search\": True\n },\n kg_search_settings={\n \"use_kg_search\": True,\n \"kg_search_type\": \"local\",\n \"kg_search_level\": \"1\"\n },\n rag_generation_config={\n \"stream\": False,\n \"temperature\": 0.7,\n \"max_tokens\": 1000\n },\n include_title_if_available=True,\n conversation_id=\"550e8400-e29b-41d4-a716-446655440000\" # Optional for conversation continuity\n )"},{"lang":"Shell","source":"\n curl -X POST \"https://api.example.com/retrieval/agent\" \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -d '{\n \"message\": {\n \"role\": \"user\",\n \"content\": \"What were the key contributions of Aristotle to logic and how did they influence later philosophers?\"\n },\n \"vector_search_settings\": {\n \"use_vector_search\": true,\n \"filters\": {\"collection_ids\": [\"5e157b3a-8469-51db-90d9-52e7d896b49b\"]},\n \"search_limit\": 20,\n \"use_hybrid_search\": true\n },\n \"kg_search_settings\": {\n \"use_kg_search\": true,\n \"kg_search_type\": \"local\",\n \"kg_search_level\": \"1\"\n },\n \"rag_generation_config\": {\n \"stream\": false,\n \"temperature\": 0.7,\n \"max_tokens\": 1000\n },\n \"include_title_if_available\": true,\n \"conversation_id\": \"550e8400-e29b-41d4-a716-446655440000\"\n }'"}]}},"/v3/retrieval/completion":{"post":{"summary":"Generate Message Completions","description":"Generate completions for a list of messages.\n\nThis endpoint uses the language model to generate completions for the provided messages.\nThe generation process can be customized using the generation_config parameter.\n\nThe messages list should contain alternating user and assistant messages, with an optional\nsystem message at the start. Each message should have a 'role' and 'content'.","operationId":"completion_v3_retrieval_completion_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"response_model","in":"query","required":false,"schema":{"title":"Response Model"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Body_completion_v3_retrieval_completion_post"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"x-codeSamples":[{"lang":"Python","source":"\nfrom r2r import R2RClient\n\nclient = R2RClient(\"http://localhost:7272\")\n# when using auth, do client.login(...)\n\nresult = client.completion(\n messages=[\n {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n {\"role\": \"user\", \"content\": \"What is the capital of France?\"},\n {\"role\": \"assistant\", \"content\": \"The capital of France is Paris.\"},\n {\"role\": \"user\", \"content\": \"What about Italy?\"}\n ],\n generation_config={\n \"model\": \"gpt-4o-mini\",\n \"temperature\": 0.7,\n \"max_tokens\": 150,\n \"stream\": False\n }\n)"},{"lang":"Shell","source":"\ncurl -X POST \"https://api.example.com/retrieval/completion\" \\\n -H \"Content-Type: application/json\" \\\n -H \"Authorization: Bearer YOUR_API_KEY\" \\\n -d '{\n \"messages\": [\n {\"role\": \"system\", \"content\": \"You are a helpful assistant.\"},\n {\"role\": \"user\", \"content\": \"What is the capital of France?\"},\n {\"role\": \"assistant\", \"content\": \"The capital of France is Paris.\"},\n {\"role\": \"user\", \"content\": \"What about Italy?\"}\n ],\n \"generation_config\": {\n \"model\": \"gpt-4o-mini\",\n \"temperature\": 0.7,\n \"max_tokens\": 150,\n \"stream\": false\n }\n }'"}]}}},"components":{"schemas":{"AllPromptsResponse":{"properties":{"prompts":{"additionalProperties":{"$ref":"#/components/schemas/PromptResponse"},"type":"object","title":"Prompts"}},"type":"object","required":["prompts"],"title":"AllPromptsResponse"},"BaseModel":{"properties":{},"type":"object","title":"BaseModel"},"Body_agent_app_v3_retrieval_agent_post":{"properties":{"message":{"anyOf":[{"$ref":"#/components/schemas/Message"},{"type":null}],"description":"Current message to process"},"messages":{"anyOf":[{"items":{"$ref":"#/components/schemas/Message"},"type":"array"},{"type":null}],"title":"Messages","description":"List of messages (deprecated, use message instead)","deprecated":true},"vector_search_settings":{"$ref":"#/components/schemas/VectorSearchSettings","description":"Settings for vector-based search"},"kg_search_settings":{"$ref":"#/components/schemas/KGSearchSettings","description":"Settings for knowledge graph search"},"rag_generation_config":{"$ref":"#/components/schemas/GenerationConfig","description":"Configuration for RAG generation"},"task_prompt_override":{"anyOf":[{"type":"string"},{"type":null}],"title":"Task Prompt Override","description":"Optional custom prompt to override default"},"include_title_if_available":{"type":"boolean","title":"Include Title If Available","description":"Include document titles in responses when available","default":true},"conversation_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":null}],"title":"Conversation Id","description":"ID of the conversation"},"branch_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":null}],"title":"Branch Id","description":"ID of the conversation branch"}},"type":"object","title":"Body_agent_app_v3_retrieval_agent_post"},"Body_completion_v3_retrieval_completion_post":{"properties":{"messages":{"items":{"$ref":"#/components/schemas/Message"},"type":"array","title":"Messages","description":"List of messages to generate completion for"},"generation_config":{"$ref":"#/components/schemas/GenerationConfig","description":"Configuration for text generation"}},"type":"object","required":["messages"],"title":"Body_completion_v3_retrieval_completion_post"},"Body_create_chunks_v3_chunks_post":{"properties":{"raw_chunks":{"items":{"$ref":"#/components/schemas/UnprocessedChunk"},"type":"array","title":"Raw Chunks","description":"List of chunks to create"},"run_with_orchestration":{"anyOf":[{"type":"boolean"},{"type":null}],"title":"Run With Orchestration","default":true}},"type":"object","required":["raw_chunks"],"title":"Body_create_chunks_v3_chunks_post"},"Body_create_document_v3_documents_post":{"properties":{"file":{"anyOf":[{"type":"string","format":"binary"},{"type":null}],"title":"File","description":"The file to ingest. Either a file or content must be provided, but not both."},"content":{"anyOf":[{"type":"string"},{"type":null}],"title":"Content","description":"The text content to ingest. Either a file or content must be provided, but not both."},"id":{"anyOf":[{"type":"string","contentMediaType":"application/json","contentSchema":{"type":"string","format":"uuid"}},{"type":null}],"title":"Id","description":"The ID of the document. If not provided, a new ID will be generated."},"metadata":{"anyOf":[{"type":"string","contentMediaType":"application/json","contentSchema":{"type":"object"}},{"type":null}],"title":"Metadata","description":"Metadata to associate with the document, such as title, description, or custom fields."},"ingestion_config":{"anyOf":[{"type":"string","contentMediaType":"application/json","contentSchema":{"type":"object"}},{"type":null}],"title":"Ingestion Config","description":"An optional dictionary to override the default chunking configuration for the ingestion process. If not provided, the system will use the default server-side chunking configuration."},"run_with_orchestration":{"anyOf":[{"type":"boolean"},{"type":null}],"title":"Run With Orchestration","description":"Whether or not ingestion runs with orchestration, default is `True`. When set to `False`, the ingestion process will run synchronous and directly return the result.","default":true}},"type":"object","title":"Body_create_document_v3_documents_post"},"Body_create_index_v3_indices_post":{"properties":{"config":{"$ref":"#/components/schemas/IndexConfig","description":"Configuration for the vector index"},"run_with_orchestration":{"anyOf":[{"type":"boolean"},{"type":null}],"title":"Run With Orchestration","description":"Whether to run index creation as an orchestrated task (recommended for large indices)","default":true}},"type":"object","required":["config"],"title":"Body_create_index_v3_indices_post"},"Body_rag_app_v3_retrieval_rag_post":{"properties":{"query":{"type":"string","title":"Query"},"vector_search_settings":{"$ref":"#/components/schemas/VectorSearchSettings","description":"Settings for vector-based search"},"kg_search_settings":{"$ref":"#/components/schemas/KGSearchSettings","description":"Settings for knowledge graph search"},"rag_generation_config":{"$ref":"#/components/schemas/GenerationConfig","description":"Configuration for RAG generation"},"task_prompt_override":{"anyOf":[{"type":"string"},{"type":null}],"title":"Task Prompt Override","description":"Optional custom prompt to override default"},"include_title_if_available":{"type":"boolean","title":"Include Title If Available","description":"Include document titles in responses when available","default":false}},"type":"object","required":["query"],"title":"Body_rag_app_v3_retrieval_rag_post"},"Body_search_app_v3_retrieval_search_post":{"properties":{"query":{"type":"string","title":"Query","description":"Search query to find relevant documents"},"vector_search_settings":{"$ref":"#/components/schemas/VectorSearchSettings","description":"Settings for vector-based search"},"kg_search_settings":{"$ref":"#/components/schemas/KGSearchSettings","description":"Settings for knowledge graph search"}},"type":"object","required":["query"],"title":"Body_search_app_v3_retrieval_search_post"},"Body_search_chunks_v3_chunks_search_post":{"properties":{"query":{"type":"string","title":"Query"},"vector_search_settings":{"$ref":"#/components/schemas/VectorSearchSettings"}},"type":"object","required":["query"],"title":"Body_search_chunks_v3_chunks_search_post"},"Body_update_document_v3_documents__id__post":{"properties":{"file":{"anyOf":[{"type":"string","format":"binary"},{"type":null}],"title":"File","description":"The file to ingest. Either a file or content must be provided, but not both."},"content":{"anyOf":[{"type":"string"},{"type":null}],"title":"Content","description":"The text content to ingest. Either a file or content must be provided, but not both."},"metadata":{"anyOf":[{"type":"string","contentMediaType":"application/json","contentSchema":{"type":"object"}},{"type":null}],"title":"Metadata","description":"Metadata to associate with the document, such as title, description, or custom fields."},"ingestion_config":{"anyOf":[{"type":"string","contentMediaType":"application/json","contentSchema":{"type":"object"}},{"type":null}],"title":"Ingestion Config","description":"An optional dictionary to override the default chunking configuration for the ingestion process. If not provided, the system will use the default server-side chunking configuration."},"run_with_orchestration":{"anyOf":[{"type":"boolean"},{"type":null}],"title":"Run With Orchestration","description":"Whether or not ingestion runs with orchestration, default is `True`. When set to `False`, the ingestion process will run synchronous and directly return the result.","default":true}},"type":"object","title":"Body_update_document_v3_documents__id__post"},"Body_update_index_v3_indices__id__put":{"properties":{"config":{"$ref":"#/components/schemas/IndexConfig"},"run_with_orchestration":{"anyOf":[{"type":"boolean"},{"type":null}],"title":"Run With Orchestration","default":true}},"type":"object","required":["config"],"title":"Body_update_index_v3_indices__id__put"},"Body_update_prompt_v3_prompts__name__put":{"properties":{"template":{"anyOf":[{"type":"string"},{"type":null}],"title":"Template","description":"Updated prompt template"},"input_types":{"anyOf":[{"additionalProperties":{"type":"string"},"type":"object"},{"type":null}],"title":"Input Types","description":"Updated input types","default":{}}},"type":"object","title":"Body_update_prompt_v3_prompts__name__put"},"Body_update_user_v3_users__user_id__post":{"properties":{"username":{"anyOf":[{"type":"string"},{"type":null}],"title":"Username"},"email":{"anyOf":[{"type":"string"},{"type":null}],"title":"Email"},"is_active":{"anyOf":[{"type":"boolean"},{"type":null}],"title":"Is Active"},"is_superuser":{"anyOf":[{"type":"boolean"},{"type":null}],"title":"Is Superuser"},"metadata":{"anyOf":[{"type":"object"},{"type":null}],"title":"Metadata"}},"type":"object","title":"Body_update_user_v3_users__user_id__post"},"ChunkIngestionResponse":{"properties":{"message":{"type":"string","title":"Message"},"document_id":{"type":"string","format":"uuid","title":"Document Id"},"task_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":null}],"title":"Task Id"}},"type":"object","required":["message","document_id"],"title":"ChunkIngestionResponse","description":"Response model for chunk ingestion","example":{"document_id":"9fbe403b-c11c-5aae-8ade-ef22980c3ad1","message":"Ingestion task completed successfully","task_id":"c68dc72e-fc23-5452-8f49-d7bd46088a96"}},"ChunkResponse":{"properties":{"document_id":{"type":"string","format":"uuid","title":"Document Id"},"id":{"type":"string","format":"uuid","title":"Id"},"collection_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Collection Ids"},"text":{"type":"string","title":"Text"},"metadata":{"type":"object","title":"Metadata"},"vector":{"anyOf":[{"items":{"type":"number"},"type":"array"},{"type":null}],"title":"Vector"}},"type":"object","required":["document_id","id","collection_ids","text","metadata"],"title":"ChunkResponse","description":"Response model representing a chunk with its metadata and content.","example":{"collection_ids":["d09dedb1-b2ab-48a5-b950-6e1f464d83e7"],"document_id":"9fbe403b-c11c-5aae-8ade-ef22980c3ad1","id":"b4ac4dd6-5f27-596e-a55b-7cf242ca30aa","metadata":{"key":"value"},"text":"Sample chunk content","vector":[0.1,0.2,0.3]}},"CollectionConfig":{"properties":{"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":null}],"title":"Description"}},"type":"object","required":["name"],"title":"CollectionConfig"},"CombinedSearchResponse":{"properties":{"vector_search_results":{"items":{"$ref":"#/components/schemas/VectorSearchResult"},"type":"array","title":"Vector Search Results","description":"List of vector search results"},"kg_search_results":{"anyOf":[{"items":{"$ref":"#/components/schemas/KGSearchResult"},"type":"array"},{"type":null}],"title":"Kg Search Results","description":"Knowledge graph search results, if applicable"}},"type":"object","required":["vector_search_results"],"title":"CombinedSearchResponse","example":{"kg_search_results":[{"content":{"description":"Entity Description","metadata":{},"name":"Entity Name"},"extraction_ids":["c68dc72e-fc23-5452-8f49-d7bd46088a96"],"metadata":{"associated_query":"What is the capital of France?"},"method":"local","result_type":"entity"}],"vector_search_results":[{"chunk_id":"3f3d47f3-8baf-58eb-8bc2-0171fb1c6e09","collection_ids":[],"document_id":"3e157b3a-8469-51db-90d9-52e7d896b49b","metadata":{"associated_query":"What is the capital of France?","title":"example_document.pdf"},"score":0.23943702876567796,"text":"Example text from the document","user_id":"2acb499e-8428-543b-bd85-0d9098718220"}]}},"ConversationOverviewResponse":{"properties":{"conversation_id":{"type":"string","format":"uuid","title":"Conversation Id"},"created_at":{"type":"string","format":"date-time","title":"Created At"}},"type":"object","required":["conversation_id","created_at"],"title":"ConversationOverviewResponse"},"CreateVectorIndexResponse":{"properties":{"message":{"type":"string","title":"Message","description":"Vector index creation queued successfully."}},"type":"object","required":["message"],"title":"CreateVectorIndexResponse"},"DeleteVectorIndexResponse":{"properties":{"message":{"type":"string","title":"Message"}},"type":"object","required":["message"],"title":"DeleteVectorIndexResponse"},"DocumentIngestionResponse":{"properties":{"message":{"type":"string","title":"Message","description":"A message describing the result of the ingestion request."},"task_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":null}],"title":"Task Id","description":"The task ID of the ingestion request."},"document_id":{"type":"string","format":"uuid","title":"Document Id","description":"The ID of the document that was ingested."}},"type":"object","required":["message","document_id"],"title":"DocumentIngestionResponse","example":{"document_id":"9fbe403b-c11c-5aae-8ade-ef22980c3ad1","message":"Ingestion task queued successfully.","task_id":"c68dc72e-fc23-5452-8f49-d7bd46088a96"}},"DocumentOverviewResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"title":{"type":"string","title":"Title"},"user_id":{"type":"string","format":"uuid","title":"User Id"},"document_type":{"type":"string","title":"Document Type"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"ingestion_status":{"type":"string","title":"Ingestion Status"},"kg_extraction_status":{"type":"string","title":"Kg Extraction Status"},"version":{"type":"string","title":"Version"},"collection_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Collection Ids"},"metadata":{"type":"object","title":"Metadata"}},"type":"object","required":["id","title","user_id","document_type","created_at","updated_at","ingestion_status","kg_extraction_status","version","collection_ids","metadata"],"title":"DocumentOverviewResponse"},"DocumentResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"title":{"type":"string","title":"Title"},"user_id":{"type":"string","format":"uuid","title":"User Id"},"document_type":{"type":"string","title":"Document Type"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"ingestion_status":{"type":"string","title":"Ingestion Status"},"kg_extraction_status":{"type":"string","title":"Kg Extraction Status"},"version":{"type":"string","title":"Version"},"collection_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Collection Ids"},"metadata":{"type":"object","title":"Metadata"}},"type":"object","required":["id","title","user_id","document_type","created_at","updated_at","ingestion_status","kg_extraction_status","version","collection_ids","metadata"],"title":"DocumentResponse","example":{"collection_ids":["d09dedb1-b2ab-48a5-b950-6e1f464d83e7"],"created_at":"2021-09-01T12:00:00Z","document_type":"text","id":"9fbe403b-c11c-5aae-8ade-ef22980c3ad1","ingestion_status":"success","kg_extraction_status":"success","metadata":{"key":"value"},"title":"My Document","updated_at":"2021-09-01T12:00:00Z","user_id":"3c10c8ff-4deb-43d8-a322-e92551ae1c96","version":"1"}},"EntityLevel":{"type":"string","enum":["collection","document","chunk"],"title":"EntityLevel"},"GenerationConfig":{"properties":{"model":{"type":"string","title":"Model"},"temperature":{"type":"number","title":"Temperature"},"top_p":{"type":"number","title":"Top P"},"max_tokens_to_sample":{"type":"integer","title":"Max Tokens To Sample"},"stream":{"type":"boolean","title":"Stream"},"functions":{"anyOf":[{"items":{"type":"object"},"type":"array"},{"type":null}],"title":"Functions"},"tools":{"anyOf":[{"items":{"type":"object"},"type":"array"},{"type":null}],"title":"Tools"},"add_generation_kwargs":{"anyOf":[{"type":"object"},{"type":null}],"title":"Add Generation Kwargs"},"api_base":{"anyOf":[{"type":"string"},{"type":null}],"title":"Api Base"},"response_format":{"anyOf":[{"type":"object"},{"$ref":"#/components/schemas/BaseModel"},{"type":null}],"title":"Response Format"}},"type":"object","title":"GenerationConfig","max_tokens_to_sample":1024,"model":"openai/gpt-4o","stream":false,"temperature":0.1,"top_p":1.0},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HybridSearchSettings":{"properties":{"full_text_weight":{"type":"number","title":"Full Text Weight","description":"Weight to apply to full text search","default":1.0},"semantic_weight":{"type":"number","title":"Semantic Weight","description":"Weight to apply to semantic search","default":5.0},"full_text_limit":{"type":"integer","title":"Full Text Limit","description":"Maximum number of results to return from full text search","default":200},"rrf_k":{"type":"integer","title":"Rrf K","description":"K-value for RRF (Rank Reciprocal Fusion)","default":50}},"type":"object","title":"HybridSearchSettings"},"IndexConfig":{"properties":{"table_name":{"anyOf":[{"type":"string"},{"type":null}],"title":"Table Name","default":"vectors"},"index_method":{"anyOf":[{"type":"string"},{"type":null}],"title":"Index Method","default":"hnsw"},"index_measure":{"anyOf":[{"type":"string"},{"type":null}],"title":"Index Measure","default":"cosine_distance"},"index_arguments":{"anyOf":[{"type":"object"},{"type":null}],"title":"Index Arguments"},"index_name":{"type":"string","title":"Index Name"},"index_column":{"anyOf":[{"type":"string"},{"type":null}],"title":"Index Column"},"concurrently":{"type":"boolean","title":"Concurrently","default":true}},"type":"object","title":"IndexConfig"},"IndexMeasure":{"type":"string","enum":["l2_distance","max_inner_product","cosine_distance","l1_distance","hamming_distance","jaccard_distance"],"title":"IndexMeasure","description":"An enum representing the types of distance measures available for indexing.\n\nAttributes:\n cosine_distance (str): The cosine distance measure for indexing.\n l2_distance (str): The Euclidean (L2) distance measure for indexing.\n max_inner_product (str): The maximum inner product measure for indexing."},"KGCommunityResult":{"properties":{"name":{"type":"string","title":"Name"},"summary":{"type":"string","title":"Summary"},"rating":{"type":"number","title":"Rating"},"rating_explanation":{"type":"string","title":"Rating Explanation"},"findings":{"items":{"type":"string"},"type":"array","title":"Findings"},"metadata":{"anyOf":[{"type":"object"},{"type":null}],"title":"Metadata"}},"type":"object","required":["name","summary","rating","rating_explanation","findings"],"title":"KGCommunityResult","findings":["Finding 1","Finding 2"],"metadata":{},"name":"Community Name","rating":9,"rating_explanation":"Rating Explanation","summary":"Community Summary"},"KGEntityResult":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"metadata":{"anyOf":[{"type":"object"},{"type":null}],"title":"Metadata"}},"type":"object","required":["name","description"],"title":"KGEntityResult","description":"Entity Description","metadata":{},"name":"Entity Name"},"KGGlobalResult":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"metadata":{"anyOf":[{"type":"object"},{"type":null}],"title":"Metadata"}},"type":"object","required":["name","description"],"title":"KGGlobalResult","description":"Global Result Description","metadata":{},"name":"Global Result Name"},"KGRelationshipResult":{"properties":{"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"metadata":{"anyOf":[{"type":"object"},{"type":null}],"title":"Metadata"}},"type":"object","required":["name","description"],"title":"KGRelationshipResult","description":"Relationship Description","metadata":{},"name":"Relationship Name"},"KGSearchMethod":{"type":"string","enum":["local"],"const":"local","title":"KGSearchMethod"},"KGSearchResult":{"properties":{"method":{"$ref":"#/components/schemas/KGSearchMethod"},"content":{"anyOf":[{"$ref":"#/components/schemas/KGEntityResult"},{"$ref":"#/components/schemas/KGRelationshipResult"},{"$ref":"#/components/schemas/KGCommunityResult"},{"$ref":"#/components/schemas/KGGlobalResult"}],"title":"Content"},"result_type":{"anyOf":[{"$ref":"#/components/schemas/KGSearchResultType"},{"type":null}]},"extraction_ids":{"anyOf":[{"items":{"type":"string","format":"uuid"},"type":"array"},{"type":null}],"title":"Extraction Ids"},"metadata":{"type":"object","title":"Metadata","default":{}}},"type":"object","required":["method","content"],"title":"KGSearchResult","content":{"description":"Entity Description","metadata":{},"name":"Entity Name"},"extraction_ids":["c68dc72e-fc23-5452-8f49-d7bd46088a96"],"metadata":{"associated_query":"What is the capital of France?"},"method":"local","result_type":"entity"},"KGSearchResultType":{"type":"string","enum":["entity","relationship","community"],"title":"KGSearchResultType"},"KGSearchSettings":{"properties":{"entities_level":{"$ref":"#/components/schemas/EntityLevel","description":"The level of entities to search for","default":"document"},"filters":{"type":"object","title":"Filters","description":"Alias for search_filters","deprecated":true},"search_filters":{"type":"object","title":"Search Filters","description":"Filters to apply to the vector search. Allowed operators include `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `like`, `ilike`, `in`, and `nin`.\n\n Commonly seen filters include operations include the following:\n\n `{\"document_id\": {\"$eq\": \"9fbe403b-...\"}}`\n\n `{\"document_id\": {\"$in\": [\"9fbe403b-...\", \"3e157b3a-...\"]}}`\n\n `{\"collection_ids\": {\"$overlap\": [\"122fdf6a-...\", \"...\"]}}`\n\n `{\"$and\": {\"$document_id\": ..., \"collection_ids\": ...}}`"},"selected_collection_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Selected Collection Ids","description":"Collection IDs to search for"},"graphrag_map_system":{"type":"string","title":"Graphrag Map System","description":"The system prompt for the graphrag map prompt.","default":"graphrag_map_system"},"graphrag_reduce_system":{"type":"string","title":"Graphrag Reduce System","description":"The system prompt for the graphrag reduce prompt.","default":"graphrag_reduce_system"},"use_kg_search":{"type":"boolean","title":"Use Kg Search","description":"Whether to use KG search","default":false},"kg_search_type":{"type":"string","title":"Kg Search Type","description":"KG search type","default":"local"},"kg_search_level":{"anyOf":[{"type":"string"},{"type":null}],"title":"Kg Search Level","description":"KG search level"},"generation_config":{"$ref":"#/components/schemas/GenerationConfig","description":"Configuration for text generation during graph search."},"max_community_description_length":{"type":"integer","title":"Max Community Description Length","default":65536},"max_llm_queries_for_global_search":{"type":"integer","title":"Max Llm Queries For Global Search","default":250},"local_search_limits":{"additionalProperties":{"type":"integer"},"type":"object","title":"Local Search Limits","default":{"__Entity__":20,"__Relationship__":20,"__Community__":20}}},"type":"object","title":"KGSearchSettings","generation_config":{"max_tokens_to_sample":1024,"model":"openai/gpt-4o","stream":false,"temperature":0.1,"top_p":1.0},"kg_search_level":"0","kg_search_type":"local","local_search_limits":{"__Community__":20,"__Entity__":20,"__Relationship__":20},"max_community_description_length":65536,"max_llm_queries_for_global_search":250,"use_kg_search":true},"ListVectorIndicesResponse":{"properties":{"indices":{"items":{"type":"object"},"type":"array","title":"Indices"}},"type":"object","required":["indices"],"title":"ListVectorIndicesResponse"},"Message":{"properties":{"role":{"anyOf":[{"$ref":"#/components/schemas/MessageType"},{"type":"string"}],"title":"Role"},"content":{"anyOf":[{"type":"string"},{"type":null}],"title":"Content"},"name":{"anyOf":[{"type":"string"},{"type":null}],"title":"Name"},"function_call":{"anyOf":[{"type":"object"},{"type":null}],"title":"Function Call"},"tool_calls":{"anyOf":[{"items":{"type":"object"},"type":"array"},{"type":null}],"title":"Tool Calls"}},"type":"object","required":["role"],"title":"Message","content":"This is a test message.","role":"user"},"MessageContent":{"properties":{"content":{"type":"string","title":"Content"},"parent_id":{"anyOf":[{"type":"string"},{"type":null}],"title":"Parent Id"},"metadata":{"anyOf":[{"type":"object"},{"type":null}],"title":"Metadata"}},"type":"object","required":["content"],"title":"MessageContent"},"MessageType":{"type":"string","enum":["system","user","assistant","function","tool"],"title":"MessageType"},"PaginatedResultsWrapper_List_UserCollectionResponse__":{"properties":{"results":{"items":{"$ref":"#/components/schemas/UserCollectionResponse"},"type":"array","title":"Results"},"total_entries":{"type":"integer","title":"Total Entries"}},"type":"object","required":["results","total_entries"],"title":"PaginatedResultsWrapper[List[UserCollectionResponse]]"},"PaginatedResultsWrapper_List_UserOverviewResponse__":{"properties":{"results":{"items":{"$ref":"#/components/schemas/UserOverviewResponse"},"type":"array","title":"Results"},"total_entries":{"type":"integer","title":"Total Entries"}},"type":"object","required":["results","total_entries"],"title":"PaginatedResultsWrapper[List[UserOverviewResponse]]"},"PaginatedResultsWrapper_list_ChunkResponse__":{"properties":{"results":{"items":{"$ref":"#/components/schemas/ChunkResponse"},"type":"array","title":"Results"},"total_entries":{"type":"integer","title":"Total Entries"}},"type":"object","required":["results","total_entries"],"title":"PaginatedResultsWrapper[list[ChunkResponse]]"},"PaginatedResultsWrapper_list_ConversationOverviewResponse__":{"properties":{"results":{"items":{"$ref":"#/components/schemas/ConversationOverviewResponse"},"type":"array","title":"Results"},"total_entries":{"type":"integer","title":"Total Entries"}},"type":"object","required":["results","total_entries"],"title":"PaginatedResultsWrapper[list[ConversationOverviewResponse]]"},"PaginatedResultsWrapper_list_DocumentOverviewResponse__":{"properties":{"results":{"items":{"$ref":"#/components/schemas/DocumentOverviewResponse"},"type":"array","title":"Results"},"total_entries":{"type":"integer","title":"Total Entries"}},"type":"object","required":["results","total_entries"],"title":"PaginatedResultsWrapper[list[DocumentOverviewResponse]]"},"PaginatedResultsWrapper_list_DocumentResponse__":{"properties":{"results":{"items":{"$ref":"#/components/schemas/DocumentResponse"},"type":"array","title":"Results"},"total_entries":{"type":"integer","title":"Total Entries"}},"type":"object","required":["results","total_entries"],"title":"PaginatedResultsWrapper[list[DocumentResponse]]"},"PaginatedResultsWrapper_list_UserResponse__":{"properties":{"results":{"items":{"$ref":"#/components/schemas/shared__api__models__management__responses__UserResponse"},"type":"array","title":"Results"},"total_entries":{"type":"integer","title":"Total Entries"}},"type":"object","required":["results","total_entries"],"title":"PaginatedResultsWrapper[list[UserResponse]]"},"PromptConfig":{"properties":{"name":{"type":"string","title":"Name"},"template":{"type":"string","title":"Template"},"input_types":{"additionalProperties":{"type":"string"},"type":"object","title":"Input Types","default":{}}},"type":"object","required":["name","template"],"title":"PromptConfig"},"PromptResponse":{"properties":{"prompt_id":{"type":"string","format":"uuid","title":"Prompt Id"},"name":{"type":"string","title":"Name"},"template":{"type":"string","title":"Template"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"},"input_types":{"additionalProperties":{"type":"string"},"type":"object","title":"Input Types"}},"type":"object","required":["prompt_id","name","template","created_at","updated_at","input_types"],"title":"PromptResponse"},"RAGAgentResponse":{"properties":{"messages":{"items":{"$ref":"#/components/schemas/Message"},"type":"array","title":"Messages","description":"Agent response messages"},"conversation_id":{"type":"string","title":"Conversation Id","description":"The conversation ID for the RAG agent response"}},"type":"object","required":["messages","conversation_id"],"title":"RAGAgentResponse","example":{"conversation_id":"a32b4c5d-6e7f-8a9b-0c1d-2e3f4a5b6c7d","messages":[{"function_call":{"arguments":"{\"query\":\"Aristotle biography\"}","name":"search"},"role":"assistant"},{"content":"1. Aristotle[A] (Greek: Ἀριστοτέλης Aristotélēs, pronounced [aristotélɛːs]; 384–322 BC) was an Ancient Greek philosopher and polymath. His writings cover a broad range of subjects spanning the natural sciences, philosophy, linguistics, economics, politics, psychology, and the arts. As the founder of the Peripatetic school of philosophy in the Lyceum in Athens, he began the wider Aristotelian tradition that followed, which set the groundwork for the development of modern science.\n2. Aristotle[A] (Greek: Ἀριστοτέλης Aristotélēs, pronounced [aristotélɛːs]; 384–322 BC) was an Ancient Greek philosopher and polymath. His writings cover a broad range of subjects spanning the natural sciences, philosophy, linguistics, economics, politics, psychology, and the arts. As the founder of the Peripatetic school of philosophy in the Lyceum in Athens, he began the wider Aristotelian tradition that followed, which set the groundwork for the development of modern science.\n3. Aristotle was born in 384 BC[C] in Stagira, Chalcidice,[2] about 55 km (34 miles) east of modern-day Thessaloniki.[3][4] His father, Nicomachus, was the personal physician to King Amyntas of Macedon. While he was young, Aristotle learned about biology and medical information, which was taught by his father.[5] Both of Aristotle's parents died when he was about thirteen, and Proxenus of Atarneus became his guardian.[6] Although little information about Aristotle's childhood has survived, he probably spent\n4. Aristotle was born in 384 BC[C] in Stagira, Chalcidice,[2] about 55 km (34 miles) east of modern-day Thessaloniki.[3][4] His father, Nicomachus, was the personal physician to King Amyntas of Macedon. While he was young, Aristotle learned about biology and medical information, which was taught by his father.[5] Both of Aristotle's parents died when he was about thirteen, and Proxenus of Atarneus became his guardian.[6] Although little information about Aristotle's childhood has survived, he probably spent\n5. Life\nIn general, the details of Aristotle's life are not well-established. The biographies written in ancient times are often speculative and historians only agree on a few salient points.[B]\n","name":"search","role":"function"},{"content":"Aristotle (384–322 BC) was an Ancient Greek philosopher and polymath whose contributions have had a profound impact on various fields of knowledge. Here are some key points about his life and work:\n\n1. **Early Life**: Aristotle was born in 384 BC in Stagira, Chalcidice, which is near modern-day Thessaloniki, Greece. His father, Nicomachus, was the personal physician to King Amyntas of Macedon, which exposed Aristotle to medical and biological knowledge from a young age [C].\n\n2. **Education and Career**: After the death of his parents, Aristotle was sent to Athens to study at Plato's Academy, where he remained for about 20 years. After Plato's death, Aristotle left Athens and eventually became the tutor of Alexander the Great [C].\n\n3. **Philosophical Contributions**: Aristotle founded the Lyceum in Athens, where he established the Peripatetic school of philosophy. His works cover a wide range of subjects, including metaphysics, ethics, politics, logic, biology, and aesthetics. His writings laid the groundwork for many modern scientific and philosophical inquiries [A].\n\n4. **Legacy**: Aristotle's influence extends beyond philosophy to the natural sciences, linguistics, economics, and psychology. His method of systematic observation and analysis has been foundational to the development of modern science [A].\n\nAristotle's comprehensive approach to knowledge and his systematic methodology have earned him a lasting legacy as one of the greatest philosophers of all time.\n\nSources:\n- [A] Aristotle's broad range of writings and influence on modern science.\n- [C] Details about Aristotle's early life and education.","role":"assistant"}]}},"RAGResponse":{"properties":{"completion":{"title":"Completion","description":"The generated completion from the RAG process"},"search_results":{"$ref":"#/components/schemas/CombinedSearchResponse","description":"The search results used for the RAG process"}},"type":"object","required":["completion","search_results"],"title":"RAGResponse","example":{"completion":{"choices":[{"finish_reason":"stop","index":0,"message":{"content":"Paris is the capital of France.","role":"assistant"}}],"id":"chatcmpl-example123"},"search_results":{"kg_search_results":[{"content":{"description":"Entity Description","metadata":{},"name":"Entity Name"},"extraction_ids":["c68dc72e-fc23-5452-8f49-d7bd46088a96"],"metadata":{"associated_query":"What is the capital of France?"},"method":"local","result_type":"entity"}],"vector_search_results":[{"chunk_id":"3f3d47f3-8baf-58eb-8bc2-0171fb1c6e09","collection_ids":[],"document_id":"3e157b3a-8469-51db-90d9-52e7d896b49b","metadata":{"associated_query":"What is the capital of France?","title":"example_document.pdf"},"score":0.23943702876567796,"text":"Example text from the document","user_id":"2acb499e-8428-543b-bd85-0d9098718220"}]}}},"ResultsWrapper_AllPromptsResponse_":{"properties":{"results":{"$ref":"#/components/schemas/AllPromptsResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[AllPromptsResponse]"},"ResultsWrapper_ChunkResponse_":{"properties":{"results":{"$ref":"#/components/schemas/ChunkResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[ChunkResponse]"},"ResultsWrapper_CollectionResponse_":{"properties":{"results":{"$ref":"#/components/schemas/shared__api__models__management__responses__CollectionResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[CollectionResponse]"},"ResultsWrapper_CombinedSearchResponse_":{"properties":{"results":{"$ref":"#/components/schemas/CombinedSearchResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[CombinedSearchResponse]"},"ResultsWrapper_CreateVectorIndexResponse_":{"properties":{"results":{"$ref":"#/components/schemas/CreateVectorIndexResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[CreateVectorIndexResponse]"},"ResultsWrapper_DeleteVectorIndexResponse_":{"properties":{"results":{"$ref":"#/components/schemas/DeleteVectorIndexResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[DeleteVectorIndexResponse]"},"ResultsWrapper_DocumentIngestionResponse_":{"properties":{"results":{"$ref":"#/components/schemas/DocumentIngestionResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[DocumentIngestionResponse]"},"ResultsWrapper_DocumentResponse_":{"properties":{"results":{"$ref":"#/components/schemas/DocumentResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[DocumentResponse]"},"ResultsWrapper_ListVectorIndicesResponse_":{"properties":{"results":{"$ref":"#/components/schemas/ListVectorIndicesResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[ListVectorIndicesResponse]"},"ResultsWrapper_NoneType_":{"properties":{"results":{"type":null,"title":"Results"}},"type":"object","required":["results"],"title":"ResultsWrapper[NoneType]"},"ResultsWrapper_RAGAgentResponse_":{"properties":{"results":{"$ref":"#/components/schemas/RAGAgentResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[RAGAgentResponse]"},"ResultsWrapper_RAGResponse_":{"properties":{"results":{"$ref":"#/components/schemas/RAGResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[RAGResponse]"},"ResultsWrapper_UpdatePromptResponse_":{"properties":{"results":{"$ref":"#/components/schemas/UpdatePromptResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[UpdatePromptResponse]"},"ResultsWrapper_UserResponse_":{"properties":{"results":{"$ref":"#/components/schemas/core__main__api__v3__users_router__UserResponse"}},"type":"object","required":["results"],"title":"ResultsWrapper[UserResponse]"},"ResultsWrapper_list_ChunkIngestionResponse__":{"properties":{"results":{"items":{"$ref":"#/components/schemas/ChunkIngestionResponse"},"type":"array","title":"Results"}},"type":"object","required":["results"],"title":"ResultsWrapper[list[ChunkIngestionResponse]]"},"ResultsWrapper_list_Tuple_str__Message___":{"properties":{"results":{"items":{"prefixItems":[{"type":"string"},{"$ref":"#/components/schemas/Message"}],"type":"array","maxItems":2,"minItems":2},"type":"array","title":"Results"}},"type":"object","required":["results"],"title":"ResultsWrapper[list[Tuple[str, Message]]]"},"ResultsWrapper_list_VectorSearchResult__":{"properties":{"results":{"items":{"$ref":"#/components/schemas/VectorSearchResult"},"type":"array","title":"Results"}},"type":"object","required":["results"],"title":"ResultsWrapper[list[VectorSearchResult]]"},"UnprocessedChunk":{"properties":{"id":{"anyOf":[{"type":"string","format":"uuid"},{"type":null}],"title":"Id"},"document_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":null}],"title":"Document Id"},"collection_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Collection Ids","default":[]},"metadata":{"type":"object","title":"Metadata","default":{}},"text":{"type":"string","title":"Text"}},"type":"object","required":["text"],"title":"UnprocessedChunk","description":"An extraction from a document."},"UpdateChunk":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"metadata":{"anyOf":[{"type":"object"},{"type":null}],"title":"Metadata"},"text":{"type":"string","title":"Text"}},"type":"object","required":["id","text"],"title":"UpdateChunk","description":"An extraction from a document."},"UpdatePromptResponse":{"properties":{"message":{"type":"string","title":"Message"}},"type":"object","required":["message"],"title":"UpdatePromptResponse"},"UserCollectionResponse":{"properties":{"collection_id":{"type":"string","format":"uuid","title":"Collection Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":null}],"title":"Description"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"document_count":{"type":"integer","title":"Document Count"}},"type":"object","required":["collection_id","name","description","created_at","updated_at","document_count"],"title":"UserCollectionResponse","description":"Collection information associated with a user"},"UserOverviewResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"username":{"type":"string","title":"Username"},"email":{"type":"string","title":"Email"},"is_active":{"type":"boolean","title":"Is Active"},"is_superuser":{"type":"boolean","title":"Is Superuser"},"collection_count":{"type":"integer","title":"Collection Count"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["id","username","email","is_active","is_superuser","collection_count","created_at"],"title":"UserOverviewResponse","description":"Summary user information for list views"},"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"},"VectorSearchResult":{"properties":{"chunk_id":{"type":"string","format":"uuid","title":"Chunk Id"},"document_id":{"type":"string","format":"uuid","title":"Document Id"},"user_id":{"anyOf":[{"type":"string","format":"uuid"},{"type":null}],"title":"User Id"},"collection_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Collection Ids"},"score":{"type":"number","title":"Score"},"text":{"type":"string","title":"Text"},"metadata":{"type":"object","title":"Metadata"}},"type":"object","required":["chunk_id","document_id","user_id","collection_ids","score","text","metadata"],"title":"VectorSearchResult","description":"Result of a search operation.","chunk_id":"3f3d47f3-8baf-58eb-8bc2-0171fb1c6e09","collection_ids":[],"document_id":"3e157b3a-8469-51db-90d9-52e7d896b49b","metadata":{"associated_query":"What is the capital of France?","title":"example_document.pdf"},"score":0.23943702876567796,"text":"Example text from the document","user_id":"2acb499e-8428-543b-bd85-0d9098718220"},"VectorSearchSettings":{"properties":{"use_vector_search":{"type":"boolean","title":"Use Vector Search","description":"Whether to use vector search","default":true},"use_hybrid_search":{"type":"boolean","title":"Use Hybrid Search","description":"Whether to perform a hybrid search (combining vector and keyword search)","default":false},"filters":{"type":"object","title":"Filters","description":"Alias for search_filters","deprecated":true},"search_filters":{"type":"object","title":"Search Filters","description":"Filters to apply to the vector search. Allowed operators include `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `like`, `ilike`, `in`, and `nin`.\n\n Commonly seen filters include operations include the following:\n\n `{\"document_id\": {\"$eq\": \"9fbe403b-...\"}}`\n\n `{\"document_id\": {\"$in\": [\"9fbe403b-...\", \"3e157b3a-...\"]}}`\n\n `{\"collection_ids\": {\"$overlap\": [\"122fdf6a-...\", \"...\"]}}`\n\n `{\"$and\": {\"$document_id\": ..., \"collection_ids\": ...}}`"},"search_limit":{"type":"integer","maximum":1000.0,"minimum":1.0,"title":"Search Limit","description":"Maximum number of results to return","default":10},"offset":{"type":"integer","minimum":0.0,"title":"Offset","description":"Offset to paginate search results","default":0},"selected_collection_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Selected Collection Ids","description":"Collection IDs to search for"},"index_measure":{"$ref":"#/components/schemas/IndexMeasure","description":"The distance measure to use for indexing","default":"cosine_distance"},"include_values":{"type":"boolean","title":"Include Values","description":"Whether to include search score values in the search results","default":true},"include_metadatas":{"type":"boolean","title":"Include Metadatas","description":"Whether to include element metadata in the search results","default":true},"probes":{"type":"integer","title":"Probes","description":"Number of ivfflat index lists to query. Higher increases accuracy but decreases speed.","default":10},"ef_search":{"type":"integer","title":"Ef Search","description":"Size of the dynamic candidate list for HNSW index search. Higher increases accuracy but decreases speed.","default":40},"hybrid_search_settings":{"$ref":"#/components/schemas/HybridSearchSettings","description":"Settings for hybrid search","default":{"full_text_weight":1.0,"semantic_weight":5.0,"full_text_limit":200,"rrf_k":50}},"search_strategy":{"type":"string","title":"Search Strategy","description":"Search strategy to use (e.g., 'default', 'query_fusion', 'hyde')","default":"vanilla"}},"type":"object","title":"VectorSearchSettings","ef_search":40,"filters":{"category":"technology"},"hybrid_search_settings":{"full_text_limit":200,"full_text_weight":1.0,"rrf_k":50,"semantic_weight":5.0},"include_metadata":true,"index_measure":"cosine_distance","limit":20,"offset":0,"probes":10,"selected_collection_ids":["2acb499e-8428-543b-bd85-0d9098718220","3e157b3a-8469-51db-90d9-52e7d896b49b"],"use_hybrid_search":true,"use_vector_search":true},"core__main__api__v3__documents_router__CollectionResponse":{"properties":{"collection_id":{"type":"string","format":"uuid","title":"Collection Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":null}],"title":"Description"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["collection_id","name","description","created_at","updated_at"],"title":"CollectionResponse","example":{"collection_id":"d09dedb1-b2ab-48a5-b950-6e1f464d83e7","created_at":"2021-09-01T12:00:00Z","description":"A collection of documents.","name":"My Collection","updated_at":"2021-09-01T12:00:00Z"}},"core__main__api__v3__users_router__UserResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"username":{"type":"string","title":"Username"},"email":{"type":"string","title":"Email"},"is_active":{"type":"boolean","title":"Is Active"},"is_superuser":{"type":"boolean","title":"Is Superuser"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"},"last_login":{"anyOf":[{"type":"string"},{"type":null}],"title":"Last Login"},"collection_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Collection Ids"},"metadata":{"anyOf":[{"type":"object"},{"type":null}],"title":"Metadata"}},"type":"object","required":["id","username","email","is_active","is_superuser","created_at","updated_at","last_login","collection_ids","metadata"],"title":"UserResponse","description":"Detailed user information response"},"shared__api__models__base__ResultsWrapper_list_CollectionResponse____1":{"properties":{"results":{"items":{"$ref":"#/components/schemas/core__main__api__v3__documents_router__CollectionResponse"},"type":"array","title":"Results"}},"type":"object","required":["results"],"title":"ResultsWrapper[list[CollectionResponse]]"},"shared__api__models__base__ResultsWrapper_list_CollectionResponse____2":{"properties":{"results":{"items":{"$ref":"#/components/schemas/shared__api__models__management__responses__CollectionResponse"},"type":"array","title":"Results"}},"type":"object","required":["results"],"title":"ResultsWrapper[list[CollectionResponse]]"},"shared__api__models__management__responses__CollectionResponse":{"properties":{"collection_id":{"type":"string","format":"uuid","title":"Collection Id"},"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":null}],"title":"Description"},"created_at":{"type":"string","format":"date-time","title":"Created At"},"updated_at":{"type":"string","format":"date-time","title":"Updated At"}},"type":"object","required":["collection_id","name","description","created_at","updated_at"],"title":"CollectionResponse"},"shared__api__models__management__responses__UserResponse":{"properties":{"id":{"type":"string","format":"uuid","title":"Id"},"email":{"type":"string","title":"Email"},"is_active":{"type":"boolean","title":"Is Active","default":true},"is_superuser":{"type":"boolean","title":"Is Superuser","default":false},"created_at":{"type":"string","format":"date-time","title":"Created At","default":"2024-11-03T19:45:22.224439"},"updated_at":{"type":"string","format":"date-time","title":"Updated At","default":"2024-11-03T19:45:22.224442"},"is_verified":{"type":"boolean","title":"Is Verified","default":false},"collection_ids":{"items":{"type":"string","format":"uuid"},"type":"array","title":"Collection Ids","default":[]},"hashed_password":{"anyOf":[{"type":"string"},{"type":null}],"title":"Hashed Password"},"verification_code_expiry":{"anyOf":[{"type":"string","format":"date-time"},{"type":null}],"title":"Verification Code Expiry"},"name":{"anyOf":[{"type":"string"},{"type":null}],"title":"Name"},"bio":{"anyOf":[{"type":"string"},{"type":null}],"title":"Bio"},"profile_picture":{"anyOf":[{"type":"string"},{"type":null}],"title":"Profile Picture"}},"type":"object","required":["id","email"],"title":"UserResponse"}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}}}} diff --git a/py/core/main/api/v3/chunks_router.py b/py/core/main/api/v3/chunks_router.py index aaa1e0e5f..2ba10bc15 100644 --- a/py/core/main/api/v3/chunks_router.py +++ b/py/core/main/api/v3/chunks_router.py @@ -26,6 +26,8 @@ class ChunkResponse(BaseModel): + """Response model representing a chunk with its metadata and content.""" + document_id: UUID id: UUID collection_ids: list[UUID] @@ -33,12 +35,34 @@ class ChunkResponse(BaseModel): metadata: dict[str, Any] vector: Optional[list[float]] = None + class Config: + json_schema_extra = { + "example": { + "document_id": "9fbe403b-c11c-5aae-8ade-ef22980c3ad1", + "id": "b4ac4dd6-5f27-596e-a55b-7cf242ca30aa", + "collection_ids": ["d09dedb1-b2ab-48a5-b950-6e1f464d83e7"], + "text": "Sample chunk content", + "metadata": {"key": "value"}, + "vector": [0.1, 0.2, 0.3], + } + } + class ChunkIngestionResponse(BaseModel): """Response model for chunk ingestion""" message: str document_id: UUID + task_id: Optional[UUID] = None + + class Config: + json_schema_extra = { + "example": { + "message": "Ingestion task completed successfully", + "document_id": "9fbe403b-c11c-5aae-8ade-ef22980c3ad1", + "task_id": "c68dc72e-fc23-5452-8f49-d7bd46088a96", + } + } logger = logging.getLogger() @@ -102,7 +126,54 @@ def _select_filters( return filters def _setup_routes(self): - @self.router.post("/chunks") + @self.router.post( + "/chunks", + summary="Create Chunks", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": """ +from r2r import R2RClient + +client = R2RClient("http://localhost:7272") +# when using auth, do client.login(...) + +result = client.chunks.create( + chunks=[ + { + "id": "b4ac4dd6-5f27-596e-a55b-7cf242ca30aa", + "document_id": "b4ac4dd6-5f27-596e-a55b-7cf242ca30aa", + "collection_ids": ["b4ac4dd6-5f27-596e-a55b-7cf242ca30aa"], + "metadata": {"key": "value"}, + "text": "Some text content" + } + ], + run_with_orchestration=False +) +""", + }, + { + "lang": "cURL", + "source": """ +curl -X POST "https://api.example.com/v3/chunks" \\ + -H "Content-Type: application/json" \\ + -H "Authorization: Bearer YOUR_API_KEY" \\ + -d '{ + "chunks": [{ + "id": "b4ac4dd6-5f27-596e-a55b-7cf242ca30aa", + "document_id": "b4ac4dd6-5f27-596e-a55b-7cf242ca30aa", + "collection_ids": ["b4ac4dd6-5f27-596e-a55b-7cf242ca30aa"], + "metadata": {"key": "value"}, + "text": "Some text content" + }], + "run_with_orchestration": false + }' +""", + }, + ] + }, + ) @self.base_endpoint async def create_chunks( raw_chunks: Json[list[UnprocessedChunk]] = Body( @@ -111,8 +182,14 @@ async def create_chunks( run_with_orchestration: Optional[bool] = Body(True), auth_user=Depends(self.providers.auth.auth_wrapper), ) -> ResultsWrapper[list[ChunkIngestionResponse]]: - """ + f""" Create multiple chunks and process them through the ingestion pipeline. + + This endpoint allows creating multiple chunks at once, optionally associating them + with documents and collections. The chunks will be processed asynchronously if + run_with_orchestration is True. + + Maximum of {MAX_CHUNKS_PER_REQUEST} chunks can be created in a single request. """ default_document_id = generate_id() if len(raw_chunks) > MAX_CHUNKS_PER_REQUEST: @@ -192,6 +269,26 @@ async def create_chunks( @self.router.post( "/chunks/search", + summary="Search Chunks", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": """ +from r2r import R2RClient + +client = R2RClient("http://localhost:7272") +results = client.chunks.search( + query="search query", + vector_search_settings={ + "limit": 10, + "min_score": 0.7 + } +) +""", + } + ] + }, ) @self.base_endpoint async def search_chunks( @@ -203,12 +300,11 @@ async def search_chunks( ) -> WrappedVectorSearchResponse: # type: ignore # TODO - Deduplicate this code by sharing the code on the retrieval router """ - Perform a search query on the vector database and knowledge graph. + Perform a semantic search query over all stored chunks. This endpoint allows for complex filtering of search results using PostgreSQL-based queries. Filters can be applied to various fields such as document_id, and internal metadata values. - Allowed operators include `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `like`, `ilike`, `in`, and `nin`. """ @@ -225,7 +321,23 @@ async def search_chunks( ) return results["vector_search_results"] - @self.router.get("/chunks/{id}") + @self.router.get( + "/chunks/{id}", + summary="Retrieve Chunk", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": """ +from r2r import R2RClient + +client = R2RClient("http://localhost:7272") +chunk = client.chunks.retrieve(id="b4ac4dd6-5f27-596e-a55b-7cf242ca30aa") +""", + } + ] + }, + ) @self.base_endpoint async def retrieve_chunk( id: UUID = Path(...), @@ -233,6 +345,9 @@ async def retrieve_chunk( ) -> ResultsWrapper[ChunkResponse]: """ Get a specific chunk by its ID. + + Returns the chunk's content, metadata, and associated document/collection information. + Users can only retrieve chunks they own or have access to through collections. """ chunk = await self.services["ingestion"].get_chunk(id) if not chunk: @@ -255,7 +370,27 @@ async def retrieve_chunk( # vector = chunk["vector"] # TODO - Add include vector flag ) - @self.router.post("/chunks/{id}") + @self.router.post( + "/chunks/{id}", + summary="Update Chunk", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": """ +from r2r import R2RClient + +client = R2RClient("http://localhost:7272") +result = client.chunks.update( + id="b4ac4dd6-5f27-596e-a55b-7cf242ca30aa", + text="Updated content", + metadata={"key": "new value"} +) +""", + } + ] + }, + ) @self.base_endpoint async def update_chunk( id: UUID = Path(...), @@ -263,7 +398,10 @@ async def update_chunk( auth_user=Depends(self.providers.auth.auth_wrapper), ) -> ResultsWrapper[ChunkResponse]: """ - Update existing chunks with new content. + Update an existing chunk's content and/or metadata. + + The chunk's vectors will be automatically recomputed based on the new content. + Users can only update chunks they own unless they are superusers. """ # Get the existing chunk to get its chunk_id existing_chunk = await self.services["ingestion"].get_chunk( @@ -299,7 +437,26 @@ async def update_chunk( # vector = existing_chunk.get('vector') ) - @self.router.post("/chunks/{id}/enrich") + @self.router.post( + "/chunks/{id}/enrich", + summary="Enrich Chunk", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": """ +from r2r import R2RClient + +client = R2RClient("http://localhost:7272") +result = client.chunks.enrich( + id="b4ac4dd6-5f27-596e-a55b-7cf242ca30aa", + enrichment_config={"key": "value"} +) +""", + } + ] + }, + ) @self.base_endpoint async def enrich_chunk( id: Json[UUID] = Path(...), @@ -307,17 +464,45 @@ async def enrich_chunk( auth_user=Depends(self.providers.auth.auth_wrapper), ) -> ResultsWrapper[ChunkResponse]: """ - Update existing chunks with new content. + Enrich a chunk with additional processing and metadata. + + This endpoint allows adding additional enrichments to an existing chunk, + such as entity extraction, classification, or custom processing defined + in the enrichment_config. + + Users can only enrich chunks they own unless they are superusers. """ pass - @self.router.delete("/chunks/{id}") + @self.router.delete( + "/chunks/{id}", + summary="Delete Chunk", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": """ +from r2r import R2RClient + +client = R2RClient("http://localhost:7272") +result = client.chunks.delete( + id="b4ac4dd6-5f27-596e-a55b-7cf242ca30aa" +) +""", + } + ] + }, + ) @self.base_endpoint async def delete_chunk( id: Json[UUID] = Path(...), ) -> ResultsWrapper[ChunkResponse]: """ - Update existing chunks with new content. + Delete a specific chunk by ID. + + This permanently removes the chunk and its associated vector embeddings. + The parent document remains unchanged. Users can only delete chunks they + own unless they are superusers. """ # Get the existing chunk to get its chunk_id existing_chunk = await self.services["ingestion"].get_chunk(id) @@ -327,7 +512,30 @@ async def delete_chunk( await self.services["management"].delete({"$eq": {"chunk_id": id}}) return None - @self.router.get("/chunks") + @self.router.get( + "/chunks", + summary="List Chunks", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": """ +from r2r import R2RClient + +client = R2RClient("http://localhost:7272") +results = client.chunks.list( + offset=0, + limit=10, + sort_by="created_at", + sort_order="DESC", + metadata_filter={"key": "value"}, + include_vectors=False +) +""", + } + ] + }, + ) @self.base_endpoint async def list_chunks( offset: int = Query( @@ -356,8 +564,11 @@ async def list_chunks( Returns a paginated list of chunks that the user has access to. Results can be filtered and sorted based on various parameters. - """ - # Build filters + Vector embeddings are only included if specifically requested. + + Regular users can only list chunks they own or have access to through + collections. Superusers can list all chunks in the system. + """ # Build filters filters = {} # Add user access control filter diff --git a/py/core/main/api/v3/documents_router.py b/py/core/main/api/v3/documents_router.py index ab6f74aee..f36a4820f 100644 --- a/py/core/main/api/v3/documents_router.py +++ b/py/core/main/api/v3/documents_router.py @@ -2,6 +2,7 @@ import json import logging import mimetypes +import textwrap from datetime import datetime from io import BytesIO from typing import Any, Optional, TypeVar, Union @@ -61,6 +62,23 @@ class DocumentResponse(BaseModel): collection_ids: list[UUID] metadata: dict[str, Any] + class Config: + json_schema_extra = { + "example": { + "id": "9fbe403b-c11c-5aae-8ade-ef22980c3ad1", + "title": "My Document", + "user_id": "3c10c8ff-4deb-43d8-a322-e92551ae1c96", + "document_type": "text", + "created_at": "2021-09-01T12:00:00Z", + "updated_at": "2021-09-01T12:00:00Z", + "ingestion_status": "success", + "kg_extraction_status": "success", + "version": "1", + "collection_ids": ["d09dedb1-b2ab-48a5-b950-6e1f464d83e7"], + "metadata": {"key": "value"}, + } + } + class CollectionResponse(BaseModel): collection_id: UUID @@ -69,6 +87,17 @@ class CollectionResponse(BaseModel): created_at: datetime updated_at: datetime + class Config: + json_schema_extra = { + "example": { + "collection_id": "d09dedb1-b2ab-48a5-b950-6e1f464d83e7", + "name": "My Collection", + "description": "A collection of documents.", + "created_at": "2021-09-01T12:00:00Z", + "updated_at": "2021-09-01T12:00:00Z", + } + } + logger = logging.getLogger() @@ -90,6 +119,38 @@ def _setup_routes(self): "/documents", status_code=202, summary="Create a new document", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": textwrap.dedent( + """ + from r2r import R2RClient + + client = R2RClient("http://localhost:7272") + # when using auth, do client.login(...) + + result = client.documents.create( + file_path="pg_essay_1.html", + metadata={"metadata_1":"some random metadata"}, + id=None + )""" + ), + }, + { + "lang": "cURL", + "source": textwrap.dedent( + """ + curl -X POST "https://api.example.com/v3/documents" \\ + -H "Content-Type: multipart/form-data" \\ + -H "Authorization: Bearer YOUR_API_KEY" \\ + -F "file=@pg_essay_1.html;type=text/html" \\ + -F 'metadata={}' \\ + -F 'id=null'""" + ), + }, + ] + }, ) @self.base_endpoint async def create_document( @@ -225,6 +286,35 @@ async def create_document( @self.router.post( "/documents/{id}", summary="Update a document", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": textwrap.dedent( + """ + from r2r import R2RClient + + client = R2RClient("http://localhost:7272") + # when using auth, do client.login(...) + + result = client.documents.update( + file_path="pg_essay_1.html", + id="9fbe403b-c11c-5aae-8ade-ef22980c3ad1" + )""" + ), + }, + { + "lang": "cURL", + "source": textwrap.dedent( + """ + curl -X POST "https://api.example.com/document/9fbe403b-c11c-5aae-8ade-ef22980c3ad1" \ + -H "Content-Type: multipart/form-data" \ + -H "Authorization: Bearer YOUR_API_KEY" \ + -F "file=@pg_essay_1.html;type=text/plain" """ + ), + }, + ] + }, ) @self.base_endpoint async def update_document( @@ -350,6 +440,33 @@ async def update_document( @self.router.get( "/documents", summary="List documents", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": textwrap.dedent( + """ + from r2r import R2RClient + + client = R2RClient("http://localhost:7272") + # when using auth, do client.login(...) + + result = client.documents.list( + limit=10, + offset=0 + )""" + ), + }, + { + "lang": "cURL", + "source": textwrap.dedent( + """ + curl -X GET "https://api.example.com/v3/documents" \ + -H "Authorization: Bearer YOUR_API_KEY" """ + ), + }, + ] + }, ) @self.base_endpoint async def get_documents( @@ -408,6 +525,32 @@ async def get_documents( @self.router.get( "/documents/{id}", summary="Retrieve a document", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": textwrap.dedent( + """ + from r2r import R2RClient + + client = R2RClient("http://localhost:7272") + # when using auth, do client.login(...) + + result = client.documents.retrieve( + id="9fbe403b-c11c-5aae-8ade-ef22980c3ad1" + )""" + ), + }, + { + "lang": "cURL", + "source": textwrap.dedent( + """ + curl -X GET "https://api.example.com/v3/documents/9fbe403b-c11c-5aae-8ade-ef22980c3ad1" \ + -H "Authorization: Bearer YOUR_API_KEY" """ + ), + }, + ] + }, ) @self.base_endpoint async def get_document( @@ -446,7 +589,36 @@ async def get_document( return results[0] - @self.router.get("/documents/{id}/chunks") + @self.router.get( + "/documents/{id}/chunks", + summary="List document chunks", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": textwrap.dedent( + """ + from r2r import R2RClient + + client = R2RClient("http://localhost:7272") + # when using auth, do client.login(...) + + result = client.documents.list_chunks( + id="9fbe403b-c11c-5aae-8ade-ef22980c3ad1" + )""" + ), + }, + { + "lang": "cURL", + "source": textwrap.dedent( + """ + curl -X GET "https://api.example.com/v3/documents/9fbe403b-c11c-5aae-8ade-ef22980c3ad1/chunks" \ + -H "Authorization: Bearer YOUR_API_KEY" """ + ), + }, + ] + }, + ) @self.base_endpoint async def list_chunks( id: UUID = Path( @@ -522,12 +694,38 @@ async def list_chunks( "/documents/{id}/download", response_class=StreamingResponse, summary="Download document content", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": textwrap.dedent( + """ + from r2r import R2RClient + + client = R2RClient("http://localhost:7272") + # when using auth, do client.login(...) + + result = client.documents.download( + id="b4ac4dd6-5f27-596e-a55b-7cf242ca30aa" + )""" + ), + }, + { + "lang": "cURL", + "source": textwrap.dedent( + """ + curl -X GET "https://api.example.com/v3/documents/b4ac4dd6-5f27-596e-a55b-7cf242ca30aa/download" \ + -H "Authorization: Bearer YOUR_API_KEY" """ + ), + }, + ] + }, ) @self.base_endpoint async def get_document_file( id: str = Path(..., description="Document ID"), auth_user=Depends(self.providers.auth.auth_wrapper), - ): + ) -> StreamingResponse: """ Downloads the original file content of a document. @@ -577,6 +775,32 @@ async def file_stream(): @self.router.delete( "/documents/{id}", summary="Delete a document", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": textwrap.dedent( + """ + from r2r import R2RClient + + client = R2RClient("http://localhost:7272") + # when using auth, do client.login(...) + + result = client.documents.delete( + id="9fbe403b-c11c-5aae-8ade-ef22980c3ad1" + )""" + ), + }, + { + "lang": "cURL", + "source": textwrap.dedent( + """ + curl -X DELETE "https://api.example.com/v3/documents/b4ac4dd6-5f27-596e-a55b-7cf242ca30aa" \ + -H "Authorization: Bearer YOUR_API_KEY" """ + ), + }, + ] + }, ) @self.base_endpoint async def delete_document_by_id( @@ -636,6 +860,32 @@ async def delete_document_by_filter( @self.router.get( "/documents/{id}/collections", summary="List document collections", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": textwrap.dedent( + """ + from r2r import R2RClient + + client = R2RClient("http://localhost:7272") + # when using auth, do client.login(...) + + result = client.documents.list_collections( + id="9fbe403b-c11c-5aae-8ade-ef22980c3ad1", offset=0, limit=10 + )""" + ), + }, + { + "lang": "cURL", + "source": textwrap.dedent( + """ + curl -X GET "https://api.example.com/v3/documents/9fbe403b-c11c-5aae-8ade-ef22980c3ad1/collections" \ + -H "Authorization: Bearer YOUR_API_KEY" """ + ), + }, + ] + }, ) @self.base_endpoint async def get_document_collections( diff --git a/py/core/main/api/v3/indices_router.py b/py/core/main/api/v3/indices_router.py index ba73e75a2..59b49fcb8 100644 --- a/py/core/main/api/v3/indices_router.py +++ b/py/core/main/api/v3/indices_router.py @@ -84,46 +84,337 @@ def __init__( super().__init__(providers, services, orchestration_provider, run_type) def _setup_routes(self): - @self.router.post("/indices") + + @self.router.post( + "/indices", + summary="Create Vector Index", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": """ +from r2r import R2RClient + +client = R2RClient("http://localhost:7272") +# when using auth, do client.login(...) + +# Create an HNSW index for efficient similarity search +result = client.indices.create( + config={ + "table_name": "vectors", # The table containing vector embeddings + "index_method": "hnsw", # Hierarchical Navigable Small World graph + "index_measure": "cosine_distance", # Similarity measure + "index_arguments": { + "m": 16, # Number of connections per layer + "ef_construction": 64,# Size of dynamic candidate list for construction + "ef": 40, # Size of dynamic candidate list for search + }, + "index_name": "my_document_embeddings_idx", + "index_column": "embedding", + "concurrently": True # Build index without blocking table writes + }, + run_with_orchestration=True # Run as orchestrated task for large indices +) + +# Create an IVF-Flat index for balanced performance +result = client.indices.create( + config={ + "table_name": "vectors", + "index_method": "ivf_flat", # Inverted File with Flat storage + "index_measure": "l2_distance", + "index_arguments": { + "lists": 100, # Number of cluster centroids + "probe": 10, # Number of clusters to search + }, + "index_name": "my_ivf_embeddings_idx", + "index_column": "embedding", + "concurrently": True + } +)""", + }, + { + "lang": "Shell", + "source": """ +# Create HNSW Index +curl -X POST "https://api.example.com/indices" \\ + -H "Content-Type: application/json" \\ + -H "Authorization: Bearer YOUR_API_KEY" \\ + -d '{ + "config": { + "table_name": "vectors", + "index_method": "hnsw", + "index_measure": "cosine_distance", + "index_arguments": { + "m": 16, + "ef_construction": 64, + "ef": 40 + }, + "index_name": "my_document_embeddings_idx", + "index_column": "embedding", + "concurrently": true + }, + "run_with_orchestration": true + }' + +# Create IVF-Flat Index +curl -X POST "https://api.example.com/indices" \\ + -H "Content-Type: application/json" \\ + -H "Authorization: Bearer YOUR_API_KEY" \\ + -d '{ + "config": { + "table_name": "vectors", + "index_method": "ivf_flat", + "index_measure": "l2_distance", + "index_arguments": { + "lists": 100, + "probe": 10 + }, + "index_name": "my_ivf_embeddings_idx", + "index_column": "embedding", + "concurrently": true + } + }'""", + }, + ] + }, + ) @self.base_endpoint async def create_index( - config: IndexConfig = Body(...), - run_with_orchestration: Optional[bool] = Body(True), + config: IndexConfig = Body( + ..., + description="Configuration for the vector index", + example={ + "table_name": "vectors", + "index_method": "hnsw", + "index_measure": "cosine_distance", + "index_arguments": { + "m": 16, + "ef_construction": 64, + "ef": 40, + }, + "index_name": "my_document_embeddings_idx", + "index_column": "embedding", + "concurrently": True, + }, + ), + run_with_orchestration: Optional[bool] = Body( + True, + description="Whether to run index creation as an orchestrated task (recommended for large indices)", + ), auth_user=Depends(self.providers.auth.auth_wrapper), ) -> WrappedCreateVectorIndexResponse: """ - Create a new index with the specified configuration. + Create a new vector similarity search index in the database. + + This endpoint creates a database index optimized for efficient similarity search over vector embeddings. + It supports two main indexing methods: + + 1. HNSW (Hierarchical Navigable Small World): + - Best for: High-dimensional vectors requiring fast approximate nearest neighbor search + - Pros: Very fast search, good recall, memory-resident for speed + - Cons: Slower index construction, more memory usage + - Key parameters: + * m: Number of connections per layer (higher = better recall but more memory) + * ef_construction: Build-time search width (higher = better recall but slower build) + * ef: Query-time search width (higher = better recall but slower search) + + 2. IVF-Flat (Inverted File with Flat Storage): + - Best for: Balance between build speed, search speed, and recall + - Pros: Faster index construction, less memory usage + - Cons: Slightly slower search than HNSW + - Key parameters: + * lists: Number of clusters (usually sqrt(n) where n is number of vectors) + * probe: Number of nearest clusters to search + + Supported similarity measures: + - cosine_distance: Best for comparing semantic similarity + - l2_distance: Best for comparing absolute distances + - ip_distance: Best for comparing raw dot products + + Notes: + - Index creation can be resource-intensive for large datasets + - Use run_with_orchestration=True for large indices to prevent timeouts + - The 'concurrently' option allows other operations while building + - Index names must be unique per table """ # TODO: Implement index creation logic pass - @self.router.get("/indices") + @self.router.get( + "/indices", + summary="List Vector Indices", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": """ +from r2r import R2RClient + +client = R2RClient("http://localhost:7272") + +# List all indices +indices = client.indices.list( + offset=0, + limit=10, + filter_by={"table_name": "vectors"} +) + +# Print index details +for idx in indices: + print(f"Index: {idx['name']}") + print(f"Method: {idx['method']}") + print(f"Size: {idx['size_bytes'] / 1024 / 1024:.2f} MB") + print(f"Row count: {idx['row_count']}")""", + }, + { + "lang": "Shell", + "source": """ +curl -X GET "https://api.example.com/indices?offset=0&limit=10" \\ + -H "Authorization: Bearer YOUR_API_KEY" \\ + -H "Content-Type: application/json" + +# With filters +curl -X GET "https://api.example.com/indices?offset=0&limit=10&filter_by={\"table_name\":\"vectors\"}" \\ + -H "Authorization: Bearer YOUR_API_KEY" \\ + -H "Content-Type: application/json" +""", + }, + ] + }, + ) @self.base_endpoint async def list_indices( - offset: int = Query(0, ge=0), - limit: int = Query(10, ge=1, le=100), - filter_by: Optional[Json[dict]] = Query(None), + offset: int = Query( + 0, ge=0, description="Number of records to skip" + ), + limit: int = Query( + 10, + ge=1, + le=100, + description="Maximum number of records to return", + ), + filter_by: Optional[Json[dict]] = Query( + None, + description='Filter criteria for indices (e.g., {"table_name": "vectors"})', + ), auth_user=Depends(self.providers.auth.auth_wrapper), ) -> WrappedListVectorIndicesResponse: """ - List available indices with pagination support. + List existing vector similarity search indices with pagination support. + + Returns details about each index including: + - Name and table name + - Indexing method and parameters + - Size and row count + - Creation timestamp and last updated + - Performance statistics (if available) + + The response can be filtered using the filter_by parameter to narrow down results + based on table name, index method, or other attributes. """ # TODO: Implement index listing logic pass - @self.router.get("/indices/{id}") + @self.router.get( + "/indices/{id}", + summary="Get Vector Index Details", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": """ +from r2r import R2RClient + +client = R2RClient("http://localhost:7272") + +# Get detailed information about a specific index +index = client.indices.get("550e8400-e29b-41d4-a716-446655440000") + +# Access index details +print(f"Index Method: {index['method']}") +print(f"Parameters: {index['parameters']}") +print(f"Performance Stats: {index['stats']}")""", + }, + { + "lang": "Shell", + "source": """ +curl -X GET "https://api.example.com/indices/550e8400-e29b-41d4-a716-446655440000" \\ + -H "Authorization: Bearer YOUR_API_KEY" +""", + }, + ] + }, + ) @self.base_endpoint async def get_index( id: UUID = Path(...), auth_user=Depends(self.providers.auth.auth_wrapper), ): # -> WrappedGetIndexResponse: """ - Get details of a specific index. + Get detailed information about a specific vector index. + + Returns comprehensive information about the index including: + - Configuration details (method, measure, parameters) + - Current size and row count + - Build progress (if still under construction) + - Performance statistics: + * Average query time + * Memory usage + * Cache hit rates + * Recent query patterns + - Maintenance information: + * Last vacuum + * Fragmentation level + * Recommended optimizations """ # TODO: Implement get index logic pass - @self.router.put("/indices/{id}") + @self.router.put( + "/indices/{id}", + summary="Update Vector Index", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": """ +from r2r import R2RClient + +client = R2RClient("http://localhost:7272") + +# Update HNSW index parameters +result = client.indices.update( + "550e8400-e29b-41d4-a716-446655440000", + config={ + "index_arguments": { + "ef": 80, # Increase search quality + "m": 24 # Increase connections per layer + }, + "concurrently": True + }, + run_with_orchestration=True +)""", + }, + { + "lang": "Shell", + "source": """ +curl -X PUT "https://api.example.com/indices/550e8400-e29b-41d4-a716-446655440000" \\ + -H "Content-Type: application/json" \\ + -H "Authorization: Bearer YOUR_API_KEY" \\ + -d '{ + "config": { + "index_arguments": { + "ef": 80, + "m": 24 + }, + "concurrently": true + }, + "run_with_orchestration": true + }'""", + }, + ] + }, + ) @self.base_endpoint async def update_index( id: UUID = Path(...), @@ -137,7 +428,37 @@ async def update_index( # TODO: Implement index update logic pass - @self.router.delete("/indices/{id}") + @self.router.delete( + "/indices/{id}", + summary="Delete Vector Index", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": """ +from r2r import R2RClient + +client = R2RClient("http://localhost:7272") + +# Delete an index with orchestration for cleanup +result = client.indices.delete( + "550e8400-e29b-41d4-a716-446655440000", + run_with_orchestration=True +)""", + }, + { + "lang": "Shell", + "source": """ +curl -X DELETE "https://api.example.com/indices/550e8400-e29b-41d4-a716-446655440000" \\ + -H "Content-Type: application/json" \\ + -H "Authorization: Bearer YOUR_API_KEY" \\ + -d '{ + "run_with_orchestration": true + }'""", + }, + ] + }, + ) @self.base_endpoint async def delete_index( id: UUID = Path(...), @@ -145,7 +466,19 @@ async def delete_index( auth_user=Depends(self.providers.auth.auth_wrapper), ) -> WrappedDeleteVectorIndexResponse: """ - Delete an existing index. + Delete an existing vector similarity search index. + + This endpoint removes the specified index from the database. Important considerations: + + - Deletion is permanent and cannot be undone + - Underlying vector data remains intact + - Queries will fall back to sequential scan + - Running queries during deletion may be slower + - Use run_with_orchestration=True for large indices to prevent timeouts + - Consider index dependencies before deletion + + The operation returns immediately but cleanup may continue in background + when run_with_orchestration=True. """ # TODO: Implement index deletion logic pass diff --git a/py/core/main/api/v3/retrieval_router.py b/py/core/main/api/v3/retrieval_router.py index 72399a909..a8a4c7ec0 100644 --- a/py/core/main/api/v3/retrieval_router.py +++ b/py/core/main/api/v3/retrieval_router.py @@ -90,27 +90,102 @@ def _select_filters( def _setup_routes(self): - @self.router.post("/retrieval/search") + @self.router.post( + "/retrieval/search", + summary="Search R2R", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": """ +from r2r import R2RClient + +client = R2RClient("http://localhost:7272") +# when using auth, do client.login(...) + +result = client.search( + query="Who is Aristotle?", + vector_search_settings={ + "use_vector_search": True, + "filters": {"document_id": {"$eq": "3e157b3a-8469-51db-90d9-52e7d896b49b"}}, + "search_limit": 20, + "use_hybrid_search": True + }, + kg_search_settings={ + "use_kg_search": True, + "kg_search_type": "local", + "kg_search_level": "0", + "generation_config": { + "model": "gpt-4o-mini", + "temperature": 0.7, + }, + "local_search_limits": { + "__Entity__": 20, + "__Relationship__": 20, + "__Community__": 20, + }, + "max_community_description_length": 65536, + "max_llm_queries_for_global_search": 250 + } +)""", + }, + { + "lang": "Shell", + "source": """ +curl -X POST "https://api.example.com/retrieval/search" \\ + -H "Content-Type: application/json" \\ + -H "Authorization: Bearer YOUR_API_KEY" \\ + -d '{ + "query": "Who is Aristotle?", + "vector_search_settings": { + "use_vector_search": true, + "filters": {"document_id": {"$eq": "3e157b3a-8469-51db-90d9-52e7d896b49b"}}, + "search_limit": 20, + "use_hybrid_search": true + }, + "kg_search_settings": { + "use_kg_search": true, + "kg_search_type": "local", + "kg_search_level": "0", + "generation_config": { + "model": "gpt-4o-mini", + "temperature": 0.7 + }, + "local_search_limits": { + "__Entity__": 20, + "__Relationship__": 20, + "__Community__": 20 + }, + "max_community_description_length": 65536, + "max_llm_queries_for_global_search": 250 + } + }'""", + }, + ] + }, + ) @self.base_endpoint async def search_app( query: str = Body( ..., + description="Search query to find relevant documents", ), vector_search_settings: VectorSearchSettings = Body( default_factory=VectorSearchSettings, + description="Settings for vector-based search", ), kg_search_settings: KGSearchSettings = Body( default_factory=KGSearchSettings, + description="Settings for knowledge graph search", ), auth_user=Depends(self.providers.auth.auth_wrapper), ) -> WrappedSearchResponse: # type: ignore """ - Perform a search query on the vector database and knowledge graph. + Perform a search query on the vector database and knowledge graph and any other configured search engines. This endpoint allows for complex filtering of search results using PostgreSQL-based queries. Filters can be applied to various fields such as document_id, and internal metadata values. - Allowed operators include `eq`, `neq`, `gt`, `gte`, `lt`, `lte`, `like`, `ilike`, `in`, and `nin`. """ @@ -131,24 +206,96 @@ async def search_app( @self.router.post( "/retrieval/rag", + summary="RAG Query", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": """ +from r2r import R2RClient + +client = R2RClient("http://localhost:7272") +# when using auth, do client.login(...) + +result = client.rag( + query="Who is Aristotle?", + vector_search_settings={ + "use_vector_search": True, + "filters": {"document_id": {"$eq": "3e157b3a-8469-51db-90d9-52e7d896b49b"}}, + "search_limit": 20, + "use_hybrid_search": True + }, + kg_search_settings={ + "use_kg_search": True, + "kg_search_type": "local", + "kg_search_level": "0", + "generation_config": { + "model": "gpt-4o-mini", + "temperature": 0.7, + } + }, + rag_generation_config={ + "stream": False, + "temperature": 0.7, + "max_tokens": 150 + } +)""", + }, + { + "lang": "Shell", + "source": """ +curl -X POST "https://api.example.com/retrieval/rag" \\ + -H "Content-Type: application/json" \\ + -H "Authorization: Bearer YOUR_API_KEY" \\ + -d '{ + "query": "Who is Aristotle?", + "vector_search_settings": { + "use_vector_search": true, + "filters": {"document_id": {"$eq": "3e157b3a-8469-51db-90d9-52e7d896b49b"}}, + "search_limit": 20, + "use_hybrid_search": true + }, + "kg_search_settings": { + "use_kg_search": true, + "kg_search_type": "local", + "kg_search_level": "0", + "generation_config": { + "model": "gpt-4o-mini", + "temperature": 0.7 + } + }, + "rag_generation_config": { + "stream": false, + "temperature": 0.7, + "max_tokens": 150 + } + }'""", + }, + ] + }, ) @self.base_endpoint async def rag_app( query: str = Body(...), vector_search_settings: VectorSearchSettings = Body( default_factory=VectorSearchSettings, + description="Settings for vector-based search", ), kg_search_settings: KGSearchSettings = Body( default_factory=KGSearchSettings, + description="Settings for knowledge graph search", ), rag_generation_config: GenerationConfig = Body( default_factory=GenerationConfig, + description="Configuration for RAG generation", ), task_prompt_override: Optional[str] = Body( None, + description="Optional custom prompt to override default", ), include_title_if_available: bool = Body( False, + description="Include document titles in responses when available", ), auth_user=Depends(self.providers.auth.auth_wrapper), ) -> WrappedRAGResponse: # type: ignore @@ -159,7 +306,7 @@ async def rag_app( It supports the same filtering capabilities as the search endpoint, allowing for precise control over the retrieved context. - The generation process can be customized using the rag_generation_config parameter. + The generation process can be customized using the `rag_generation_config` parameter. """ vector_search_settings.filters = self._select_filters( @@ -190,48 +337,147 @@ async def stream_generator(): @self.router.post( "/retrieval/agent", + summary="RAG-powered Conversational Agent", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": """ + from r2r import R2RClient + + client = R2RClient("http://localhost:7272") + # when using auth, do client.login(...) + + result = client.agent( + message={ + "role": "user", + "content": "What were the key contributions of Aristotle to logic and how did they influence later philosophers?" + }, + vector_search_settings={ + "use_vector_search": True, + "filters": {"collection_ids": ["5e157b3a-8469-51db-90d9-52e7d896b49b"]}, + "search_limit": 20, + "use_hybrid_search": True + }, + kg_search_settings={ + "use_kg_search": True, + "kg_search_type": "local", + "kg_search_level": "1" + }, + rag_generation_config={ + "stream": False, + "temperature": 0.7, + "max_tokens": 1000 + }, + include_title_if_available=True, + conversation_id="550e8400-e29b-41d4-a716-446655440000" # Optional for conversation continuity + )""", + }, + { + "lang": "Shell", + "source": """ + curl -X POST "https://api.example.com/retrieval/agent" \\ + -H "Content-Type: application/json" \\ + -H "Authorization: Bearer YOUR_API_KEY" \\ + -d '{ + "message": { + "role": "user", + "content": "What were the key contributions of Aristotle to logic and how did they influence later philosophers?" + }, + "vector_search_settings": { + "use_vector_search": true, + "filters": {"collection_ids": ["5e157b3a-8469-51db-90d9-52e7d896b49b"]}, + "search_limit": 20, + "use_hybrid_search": true + }, + "kg_search_settings": { + "use_kg_search": true, + "kg_search_type": "local", + "kg_search_level": "1" + }, + "rag_generation_config": { + "stream": false, + "temperature": 0.7, + "max_tokens": 1000 + }, + "include_title_if_available": true, + "conversation_id": "550e8400-e29b-41d4-a716-446655440000" + }'""", + }, + ] + }, ) @self.base_endpoint async def agent_app( message: Optional[Message] = Body( None, + description="Current message to process", ), messages: Optional[list[Message]] = Body( None, deprecated=True, + description="List of messages (deprecated, use message instead)", ), vector_search_settings: VectorSearchSettings = Body( default_factory=VectorSearchSettings, + description="Settings for vector-based search", ), kg_search_settings: KGSearchSettings = Body( default_factory=KGSearchSettings, + description="Settings for knowledge graph search", ), rag_generation_config: GenerationConfig = Body( default_factory=GenerationConfig, + description="Configuration for RAG generation", ), task_prompt_override: Optional[str] = Body( None, + description="Optional custom prompt to override default", ), include_title_if_available: bool = Body( True, + description="Include document titles in responses when available", ), conversation_id: Optional[UUID] = Body( None, + description="ID of the conversation", ), branch_id: Optional[UUID] = Body( None, + description="ID of the conversation branch", ), auth_user=Depends(self.providers.auth.auth_wrapper), ) -> WrappedRAGAgentResponse: # type: ignore """ - Implement an agent-based interaction for complex query processing. - - This endpoint supports multi-turn conversations and can handle complex queries - by breaking them down into sub-tasks. It uses the same filtering capabilities - as the search and RAG endpoints for retrieving relevant information. - - The agent's behavior can be customized using the rag_generation_config and - task_prompt_override parameters. + Engage with an intelligent RAG-powered conversational agent for complex information retrieval and analysis. + + This advanced endpoint combines retrieval-augmented generation (RAG) with a conversational AI agent to provide + detailed, context-aware responses based on your document collection. The agent can: + + - Maintain conversation context across multiple interactions + - Dynamically search and retrieve relevant information from both vector and knowledge graph sources + - Break down complex queries into sub-questions for comprehensive answers + - Cite sources and provide evidence-based responses + - Handle follow-up questions and clarifications + - Navigate complex topics with multi-step reasoning + + Key Features: + - Hybrid search combining vector and knowledge graph approaches + - Contextual conversation management with conversation_id tracking + - Customizable generation parameters for response style and length + - Source document citation with optional title inclusion + - Streaming support for real-time responses + - Branch management for exploring different conversation paths + + Common Use Cases: + - Research assistance and literature review + - Document analysis and summarization + - Technical support and troubleshooting + - Educational Q&A and tutoring + - Knowledge base exploration + + The agent uses both vector search and knowledge graph capabilities to find and synthesize + information, providing detailed, factual responses with proper attribution to source documents. """ vector_search_settings.filters = self._select_filters( @@ -271,15 +517,88 @@ async def stream_generator(): except Exception as e: raise R2RException(str(e), 500) - @self.router.post("/retrieval/completion") + @self.router.post( + "/retrieval/completion", + summary="Generate Message Completions", + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": """ +from r2r import R2RClient + +client = R2RClient("http://localhost:7272") +# when using auth, do client.login(...) + +result = client.completion( + messages=[ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "What is the capital of France?"}, + {"role": "assistant", "content": "The capital of France is Paris."}, + {"role": "user", "content": "What about Italy?"} + ], + generation_config={ + "model": "gpt-4o-mini", + "temperature": 0.7, + "max_tokens": 150, + "stream": False + } +)""", + }, + { + "lang": "Shell", + "source": """ +curl -X POST "https://api.example.com/retrieval/completion" \\ + -H "Content-Type: application/json" \\ + -H "Authorization: Bearer YOUR_API_KEY" \\ + -d '{ + "messages": [ + {"role": "system", "content": "You are a helpful assistant."}, + {"role": "user", "content": "What is the capital of France?"}, + {"role": "assistant", "content": "The capital of France is Paris."}, + {"role": "user", "content": "What about Italy?"} + ], + "generation_config": { + "model": "gpt-4o-mini", + "temperature": 0.7, + "max_tokens": 150, + "stream": false + } + }'""", + }, + ] + }, + ) @self.base_endpoint async def completion( messages: list[Message] = Body( - ..., description="The messages to complete" + ..., + description="List of messages to generate completion for", + example=[ + { + "role": "system", + "content": "You are a helpful assistant.", + }, + { + "role": "user", + "content": "What is the capital of France?", + }, + { + "role": "assistant", + "content": "The capital of France is Paris.", + }, + {"role": "user", "content": "What about Italy?"}, + ], ), generation_config: GenerationConfig = Body( default_factory=GenerationConfig, - description="The generation config", + description="Configuration for text generation", + example={ + "model": "gpt-4o-mini", + "temperature": 0.7, + "max_tokens": 150, + "stream": False, + }, ), auth_user=Depends(self.providers.auth.auth_wrapper), response_model=WrappedCompletionResponse, @@ -289,7 +608,11 @@ async def completion( This endpoint uses the language model to generate completions for the provided messages. The generation process can be customized using the generation_config parameter. + + The messages list should contain alternating user and assistant messages, with an optional + system message at the start. Each message should have a 'role' and 'content'. """ + return await self.service.completion( messages=messages, generation_config=generation_config, diff --git a/py/core/main/api/v3/users_router.py b/py/core/main/api/v3/users_router.py index 99bcc7fa2..4e6d70c3b 100644 --- a/py/core/main/api/v3/users_router.py +++ b/py/core/main/api/v3/users_router.py @@ -15,49 +15,231 @@ class UserResponse(BaseModel): """Detailed user information response""" - id: UUID - username: str - email: str - is_active: bool - is_superuser: bool - created_at: str - updated_at: str - last_login: Optional[str] - collection_ids: List[UUID] - metadata: Optional[dict] + id: UUID = Field( + ..., + description="Unique identifier for the user", + example="550e8400-e29b-41d4-a716-446655440000", + ) + username: str = Field( + ..., description="User's login username", example="john.doe" + ) + email: str = Field( + ..., description="User's email address", example="john.doe@example.com" + ) + is_active: bool = Field( + ..., + description="Whether the user account is currently active", + example=True, + ) + is_superuser: bool = Field( + ..., + description="Whether the user has superuser privileges", + example=False, + ) + created_at: str = Field( + ..., + description="ISO formatted timestamp of when the user was created", + example="2024-03-15T14:30:00Z", + ) + updated_at: str = Field( + ..., + description="ISO formatted timestamp of when the user was last updated", + example="2024-03-20T09:15:00Z", + ) + last_login: Optional[str] = Field( + None, + description="ISO formatted timestamp of user's last login", + example="2024-03-22T16:45:00Z", + ) + collection_ids: List[UUID] = Field( + ..., + description="List of collection IDs the user has access to", + example=[ + "750e8400-e29b-41d4-a716-446655440000", + "850e8400-e29b-41d4-a716-446655440000", + ], + ) + metadata: Optional[dict] = Field( + None, + description="Additional user metadata stored as key-value pairs", + example={ + "department": "Engineering", + "title": "Senior Developer", + "location": "New York", + }, + ) + + class Config: + json_schema_extra = { + "example": { + "id": "550e8400-e29b-41d4-a716-446655440000", + "username": "john.doe", + "email": "john.doe@example.com", + "is_active": True, + "is_superuser": False, + "created_at": "2024-03-15T14:30:00Z", + "updated_at": "2024-03-20T09:15:00Z", + "last_login": "2024-03-22T16:45:00Z", + "collection_ids": [ + "750e8400-e29b-41d4-a716-446655440000", + "850e8400-e29b-41d4-a716-446655440000", + ], + "metadata": { + "department": "Engineering", + "title": "Senior Developer", + "location": "New York", + }, + } + } class UserOverviewResponse(BaseModel): """Summary user information for list views""" - id: UUID - username: str - email: str - is_active: bool - is_superuser: bool - collection_count: int - created_at: str + id: UUID = Field( + ..., + description="Unique identifier for the user", + example="550e8400-e29b-41d4-a716-446655440000", + ) + username: str = Field( + ..., description="User's login username", example="john.doe" + ) + email: str = Field( + ..., description="User's email address", example="john.doe@example.com" + ) + is_active: bool = Field( + ..., + description="Whether the user account is currently active", + example=True, + ) + is_superuser: bool = Field( + ..., + description="Whether the user has superuser privileges", + example=False, + ) + collection_count: int = Field( + ..., + description="Total number of collections the user has access to", + example=5, + ) + created_at: str = Field( + ..., + description="ISO formatted timestamp of when the user was created", + example="2024-03-15T14:30:00Z", + ) + + class Config: + json_schema_extra = { + "example": { + "id": "550e8400-e29b-41d4-a716-446655440000", + "username": "john.doe", + "email": "john.doe@example.com", + "is_active": True, + "is_superuser": False, + "collection_count": 5, + "created_at": "2024-03-15T14:30:00Z", + } + } class UserCollectionResponse(BaseModel): """Collection information associated with a user""" - collection_id: UUID - name: str - description: Optional[str] - created_at: str - updated_at: str - document_count: int + collection_id: UUID = Field( + ..., + description="Unique identifier for the collection", + example="750e8400-e29b-41d4-a716-446655440000", + ) + name: str = Field( + ..., + description="Name of the collection", + example="Project Documentation", + ) + description: Optional[str] = Field( + None, + description="Optional description of the collection", + example="Technical documentation for the main project", + ) + created_at: str = Field( + ..., + description="ISO formatted timestamp of when the collection was created", + example="2024-03-15T14:30:00Z", + ) + updated_at: str = Field( + ..., + description="ISO formatted timestamp of when the collection was last updated", + example="2024-03-20T09:15:00Z", + ) + document_count: int = Field( + ..., + description="Total number of documents in the collection", + example=42, + ) + + class Config: + json_schema_extra = { + "example": { + "collection_id": "750e8400-e29b-41d4-a716-446655440000", + "name": "Project Documentation", + "description": "Technical documentation for the main project", + "created_at": "2024-03-15T14:30:00Z", + "updated_at": "2024-03-20T09:15:00Z", + "document_count": 42, + } + } class UserActivityResponse(BaseModel): """User activity statistics""" - total_documents: int - total_collections: int - last_activity: Optional[str] - recent_collections: List[UUID] - recent_documents: List[UUID] + total_documents: int = Field( + ..., + description="Total number of documents owned by the user", + example=156, + ) + total_collections: int = Field( + ..., + description="Total number of collections the user has access to", + example=8, + ) + last_activity: Optional[str] = Field( + None, + description="ISO formatted timestamp of the user's last activity", + example="2024-03-22T16:45:00Z", + ) + recent_collections: List[UUID] = Field( + ..., + description="List of recently accessed collection IDs", + example=[ + "750e8400-e29b-41d4-a716-446655440000", + "850e8400-e29b-41d4-a716-446655440000", + ], + ) + recent_documents: List[UUID] = Field( + ..., + description="List of recently accessed document IDs", + example=[ + "950e8400-e29b-41d4-a716-446655440000", + "a50e8400-e29b-41d4-a716-446655440000", + ], + ) + + class Config: + json_schema_extra = { + "example": { + "total_documents": 156, + "total_collections": 8, + "last_activity": "2024-03-22T16:45:00Z", + "recent_collections": [ + "750e8400-e29b-41d4-a716-446655440000", + "850e8400-e29b-41d4-a716-446655440000", + ], + "recent_documents": [ + "950e8400-e29b-41d4-a716-446655440000", + "a50e8400-e29b-41d4-a716-446655440000", + ], + } + } logger = logging.getLogger() @@ -70,29 +252,112 @@ def __init__( super().__init__(providers, services, orchestration_provider, run_type) def _setup_routes(self): - @self.router.get("/users") + @self.router.get( + "/users", + summary="List Users", + response_model=PaginatedResultsWrapper[List[UserOverviewResponse]], + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": """ +from r2r import R2RClient + +client = R2RClient("http://localhost:7272") +# client.login(...) + +# List users with filters +users = client.list_users( + offset=0, + limit=100, + username="john", + email="john@example.com", + is_active=True, + is_superuser=False, + sort_by="created_at", + sort_order="desc" +)""", + }, + { + "lang": "Shell", + "source": """ +curl -X GET "https://api.example.com/users?offset=0&limit=100&username=john&email=john@example.com&is_active=true&is_superuser=false&sort_by=created_at&sort_order=desc" \\ + -H "Authorization: Bearer YOUR_API_KEY" +""", + }, + ] + }, + ) @self.base_endpoint async def list_users( - offset: int = Query(0, ge=0), - limit: int = Query(100, ge=1, le=1000), - username: Optional[str] = Query(None), - email: Optional[str] = Query(None), - is_active: Optional[bool] = Query(None), - is_superuser: Optional[bool] = Query(None), - sort_by: Optional[str] = Query(None), - sort_order: Optional[str] = Query("desc"), + offset: int = Query(0, ge=0, example=0), + limit: int = Query(100, ge=1, le=1000, example=100), + username: Optional[str] = Query(None, example="john"), + email: Optional[str] = Query(None, example="john@example.com"), + is_active: Optional[bool] = Query(None, example=True), + is_superuser: Optional[bool] = Query(None, example=False), + sort_by: Optional[str] = Query( + None, + example="created_at", + description="Field to sort by (created_at, username, email)", + ), + sort_order: Optional[str] = Query( + "desc", + example="desc", + description="Sort order (asc or desc)", + ), auth_user=Depends(self.providers.auth.auth_wrapper), ) -> PaginatedResultsWrapper[List[UserOverviewResponse]]: """ List all users with pagination and filtering options. Only accessible by superusers. + + Parameters: + - offset: Number of items to skip + - limit: Maximum number of items to return + - username: Filter by username (partial match) + - email: Filter by email (partial match) + - is_active: Filter by active status + - is_superuser: Filter by superuser status + - sort_by: Field to sort by + - sort_order: Sort order (asc/desc) """ + pass - @self.router.get("/users/{user_id}") + @self.router.get( + "/users/{id}", + summary="Get User Details", + response_model=ResultsWrapper[UserResponse], + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": """ +from r2r import R2RClient + +client = R2RClient("http://localhost:7272") +# client.login(...) + +# Get user details +user = client.get_user("550e8400-e29b-41d4-a716-446655440000") +""", + }, + { + "lang": "Shell", + "source": """ +curl -X GET "https://api.example.com/users/550e8400-e29b-41d4-a716-446655440000" \\ + -H "Authorization: Bearer YOUR_API_KEY" +""", + }, + ] + }, + ) @self.base_endpoint async def get_user( - user_id: UUID = Path(...), + id: UUID = Path( + ..., example="550e8400-e29b-41d4-a716-446655440000" + ), auth_user=Depends(self.providers.auth.auth_wrapper), ) -> ResultsWrapper[UserResponse]: """ @@ -101,12 +366,47 @@ async def get_user( """ pass - @self.router.get("/users/{user_id}/collections") + @self.router.get( + "/users/{id}/collections", + summary="Get User Collections", + response_model=PaginatedResultsWrapper[ + List[UserCollectionResponse] + ], + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": """ +from r2r import R2RClient + +client = R2RClient("http://localhost:7272") +# client.login(...) + +# Get user collections +collections = client.get_user_collections( + "550e8400-e29b-41d4-a716-446655440000", + offset=0, + limit=100 +) +""", + }, + { + "lang": "Shell", + "source": """ +curl -X GET "https://api.example.com/users/550e8400-e29b-41d4-a716-446655440000/collections?offset=0&limit=100" \\ + -H "Authorization: Bearer YOUR_API_KEY" +""", + }, + ] + }, + ) @self.base_endpoint async def get_user_collections( - user_id: UUID = Path(...), - offset: int = Query(0, ge=0), - limit: int = Query(100, ge=1, le=1000), + id: UUID = Path( + ..., example="550e8400-e29b-41d4-a716-446655440000" + ), + offset: int = Query(0, ge=0, example=0), + limit: int = Query(100, ge=1, le=1000, example=100), auth_user=Depends(self.providers.auth.auth_wrapper), ) -> PaginatedResultsWrapper[List[UserCollectionResponse]]: """ @@ -115,11 +415,45 @@ async def get_user_collections( """ pass - @self.router.post("/users/{user_id}/collections/{collection_id}") + @self.router.post( + "/users/{id}/collections/{collection_id}", + summary="Add User to Collection", + response_model=ResultsWrapper[None], + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": """ +from r2r import R2RClient + +client = R2RClient("http://localhost:7272") +# client.login(...) + +# Add user to collection +client.add_user_to_collection( + "550e8400-e29b-41d4-a716-446655440000", + "750e8400-e29b-41d4-a716-446655440000" +) +""", + }, + { + "lang": "Shell", + "source": """ +curl -X POST "https://api.example.com/users/550e8400-e29b-41d4-a716-446655440000/collections/750e8400-e29b-41d4-a716-446655440000" \\ + -H "Authorization: Bearer YOUR_API_KEY" +""", + }, + ] + }, + ) @self.base_endpoint async def add_user_to_collection( - user_id: UUID = Path(...), - collection_id: UUID = Path(...), + id: UUID = Path( + ..., example="550e8400-e29b-41d4-a716-446655440000" + ), + collection_id: UUID = Path( + ..., example="750e8400-e29b-41d4-a716-446655440000" + ), auth_user=Depends(self.providers.auth.auth_wrapper), ) -> ResultsWrapper[None]: """ @@ -128,11 +462,45 @@ async def add_user_to_collection( """ pass - @self.router.delete("/users/{user_id}/collections/{collection_id}") + @self.router.delete( + "/users/{id}/collections/{collection_id}", + summary="Remove User from Collection", + response_model=ResultsWrapper[None], + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": """ +from r2r import R2RClient + +client = R2RClient("http://localhost:7272") +# client.login(...) + +# Remove user from collection +client.remove_user_from_collection( + "550e8400-e29b-41d4-a716-446655440000", + "750e8400-e29b-41d4-a716-446655440000" +) +""", + }, + { + "lang": "Shell", + "source": """ +curl -X DELETE "https://api.example.com/users/550e8400-e29b-41d4-a716-446655440000/collections/750e8400-e29b-41d4-a716-446655440000" \\ + -H "Authorization: Bearer YOUR_API_KEY" +""", + }, + ] + }, + ) @self.base_endpoint async def remove_user_from_collection( - user_id: UUID = Path(...), - collection_id: UUID = Path(...), + id: UUID = Path( + ..., example="550e8400-e29b-41d4-a716-446655440000" + ), + collection_id: UUID = Path( + ..., example="750e8400-e29b-41d4-a716-446655440000" + ), auth_user=Depends(self.providers.auth.auth_wrapper), ) -> ResultsWrapper[None]: """ @@ -141,10 +509,52 @@ async def remove_user_from_collection( """ pass - @self.router.post("/users/{user_id}") + @self.router.post( + "/users/{id}", + summary="Update User", + response_model=ResultsWrapper[UserResponse], + openapi_extra={ + "x-codeSamples": [ + { + "lang": "Python", + "source": """ +from r2r import R2RClient + +client = R2RClient("http://localhost:7272") +# client.login(...) + +# Update user +updated_user = client.update_user( + "550e8400-e29b-41d4-a716-446655440000", + username="newusername", + email="newemail@example.com", + is_active=True, + is_superuser=False, + metadata={"department": "Engineering"} +) +""", + }, + { + "lang": "Shell", + "source": """ +curl -X POST "https://api.example.com/users/550e8400-e29b-41d4-a716-446655440000" \\ + -H "Authorization: Bearer YOUR_API_KEY" \\ + -H "Content-Type: application/json" \\ + -d '{ + "username": "newusername", + "email": "newemail@example.com", + "is_active": true, + "is_superuser": false, + "metadata": {"department": "Engineering"} + }' +""", + }, + ] + }, + ) @self.base_endpoint async def update_user( - user_id: UUID = Path(...), + id: UUID = Path(...), username: Optional[str] = Body(None), email: Optional[str] = Body(None), is_active: Optional[bool] = Body(None), diff --git a/py/core/main/app.py b/py/core/main/app.py index 0c84da4d5..b92ba26ae 100644 --- a/py/core/main/app.py +++ b/py/core/main/app.py @@ -80,11 +80,11 @@ async def r2r_exception_handler(request: Request, exc: R2RException): def _setup_routes(self): # Include routers in the app - self.app.include_router(self.ingestion_router, prefix="/v2") - self.app.include_router(self.management_router, prefix="/v2") - self.app.include_router(self.retrieval_router, prefix="/v2") - self.app.include_router(self.auth_router, prefix="/v2") - self.app.include_router(self.kg_router, prefix="/v2") + # self.app.include_router(self.ingestion_router, prefix="/v2") + # self.app.include_router(self.management_router, prefix="/v2") + # self.app.include_router(self.retrieval_router, prefix="/v2") + # self.app.include_router(self.auth_router, prefix="/v2") + # self.app.include_router(self.kg_router, prefix="/v2") self.app.include_router(self.documents_router, prefix="/v3") self.app.include_router(self.chunks_router, prefix="/v3") diff --git a/py/shared/api/models/retrieval/responses.py b/py/shared/api/models/retrieval/responses.py index 0141517d3..8daac0de2 100644 --- a/py/shared/api/models/retrieval/responses.py +++ b/py/shared/api/models/retrieval/responses.py @@ -70,76 +70,42 @@ class Config: class RAGAgentResponse(BaseModel): - messages: list[Message] = Field( - ..., description="List of messages in the RAG agent response" - ) + messages: list[Message] = Field(..., description="Agent response messages") conversation_id: str = Field( ..., description="The conversation ID for the RAG agent response" ) class Config: json_schema_extra = { - "example": [ - { - "role": "system", - "content": "## You are a helpful assistant that can search for information.\n\nWhen asked a question, perform a search to find relevant information and provide a response.\n\nThe response should contain line-item attributions to relevent search results, and be as informative if possible.\nIf no relevant results are found, then state that no results were found.\nIf no obvious question is present, then do not carry out a search, and instead ask for clarification.", - "name": None, - "function_call": None, - "tool_calls": None, - }, - { - "role": "system", - "content": "You are a helpful assistant.", - "name": None, - "function_call": None, - "tool_calls": None, - }, - { - "role": "user", - "content": "Who is the greatest philospher of all time?", - "name": None, - "function_call": None, - "tool_calls": None, - }, - { - "role": "assistant", - "content": "Aristotle is widely considered the greatest philospher of all time.", - "name": None, - "function_call": None, - "tool_calls": None, - }, - { - "role": "user", - "content": "Can you tell me more about him?", - "name": None, - "function_call": None, - "tool_calls": None, - }, - { - "role": "assistant", - "content": None, - "name": None, - "function_call": { + "example": { + "messages": [ + { + "role": "assistant", + "content": None, + "name": None, + "function_call": { + "name": "search", + "arguments": '{"query":"Aristotle biography"}', + }, + "tool_calls": None, + }, + { + "role": "function", + "content": "1. Aristotle[A] (Greek: Ἀριστοτέλης Aristotélēs, pronounced [aristotélɛːs]; 384–322 BC) was an Ancient Greek philosopher and polymath. His writings cover a broad range of subjects spanning the natural sciences, philosophy, linguistics, economics, politics, psychology, and the arts. As the founder of the Peripatetic school of philosophy in the Lyceum in Athens, he began the wider Aristotelian tradition that followed, which set the groundwork for the development of modern science.\n2. Aristotle[A] (Greek: Ἀριστοτέλης Aristotélēs, pronounced [aristotélɛːs]; 384–322 BC) was an Ancient Greek philosopher and polymath. His writings cover a broad range of subjects spanning the natural sciences, philosophy, linguistics, economics, politics, psychology, and the arts. As the founder of the Peripatetic school of philosophy in the Lyceum in Athens, he began the wider Aristotelian tradition that followed, which set the groundwork for the development of modern science.\n3. Aristotle was born in 384 BC[C] in Stagira, Chalcidice,[2] about 55 km (34 miles) east of modern-day Thessaloniki.[3][4] His father, Nicomachus, was the personal physician to King Amyntas of Macedon. While he was young, Aristotle learned about biology and medical information, which was taught by his father.[5] Both of Aristotle's parents died when he was about thirteen, and Proxenus of Atarneus became his guardian.[6] Although little information about Aristotle's childhood has survived, he probably spent\n4. Aristotle was born in 384 BC[C] in Stagira, Chalcidice,[2] about 55 km (34 miles) east of modern-day Thessaloniki.[3][4] His father, Nicomachus, was the personal physician to King Amyntas of Macedon. While he was young, Aristotle learned about biology and medical information, which was taught by his father.[5] Both of Aristotle's parents died when he was about thirteen, and Proxenus of Atarneus became his guardian.[6] Although little information about Aristotle's childhood has survived, he probably spent\n5. Life\nIn general, the details of Aristotle's life are not well-established. The biographies written in ancient times are often speculative and historians only agree on a few salient points.[B]\n", "name": "search", - "arguments": '{"query":"Aristotle biography"}', + "function_call": None, + "tool_calls": None, }, - "tool_calls": None, - }, - { - "role": "function", - "content": "1. Aristotle[A] (Greek: Ἀριστοτέλης Aristotélēs, pronounced [aristotélɛːs]; 384–322 BC) was an Ancient Greek philosopher and polymath. His writings cover a broad range of subjects spanning the natural sciences, philosophy, linguistics, economics, politics, psychology, and the arts. As the founder of the Peripatetic school of philosophy in the Lyceum in Athens, he began the wider Aristotelian tradition that followed, which set the groundwork for the development of modern science.\n2. Aristotle[A] (Greek: Ἀριστοτέλης Aristotélēs, pronounced [aristotélɛːs]; 384–322 BC) was an Ancient Greek philosopher and polymath. His writings cover a broad range of subjects spanning the natural sciences, philosophy, linguistics, economics, politics, psychology, and the arts. As the founder of the Peripatetic school of philosophy in the Lyceum in Athens, he began the wider Aristotelian tradition that followed, which set the groundwork for the development of modern science.\n3. Aristotle was born in 384 BC[C] in Stagira, Chalcidice,[2] about 55 km (34 miles) east of modern-day Thessaloniki.[3][4] His father, Nicomachus, was the personal physician to King Amyntas of Macedon. While he was young, Aristotle learned about biology and medical information, which was taught by his father.[5] Both of Aristotle's parents died when he was about thirteen, and Proxenus of Atarneus became his guardian.[6] Although little information about Aristotle's childhood has survived, he probably spent\n4. Aristotle was born in 384 BC[C] in Stagira, Chalcidice,[2] about 55 km (34 miles) east of modern-day Thessaloniki.[3][4] His father, Nicomachus, was the personal physician to King Amyntas of Macedon. While he was young, Aristotle learned about biology and medical information, which was taught by his father.[5] Both of Aristotle's parents died when he was about thirteen, and Proxenus of Atarneus became his guardian.[6] Although little information about Aristotle's childhood has survived, he probably spent\n5. Life\nIn general, the details of Aristotle's life are not well-established. The biographies written in ancient times are often speculative and historians only agree on a few salient points.[B]\n", - "name": "search", - "function_call": None, - "tool_calls": None, - }, - { - "role": "assistant", - "content": "Aristotle (384–322 BC) was an Ancient Greek philosopher and polymath whose contributions have had a profound impact on various fields of knowledge. Here are some key points about his life and work:\n\n1. **Early Life**: Aristotle was born in 384 BC in Stagira, Chalcidice, which is near modern-day Thessaloniki, Greece. His father, Nicomachus, was the personal physician to King Amyntas of Macedon, which exposed Aristotle to medical and biological knowledge from a young age [C].\n\n2. **Education and Career**: After the death of his parents, Aristotle was sent to Athens to study at Plato's Academy, where he remained for about 20 years. After Plato's death, Aristotle left Athens and eventually became the tutor of Alexander the Great [C].\n\n3. **Philosophical Contributions**: Aristotle founded the Lyceum in Athens, where he established the Peripatetic school of philosophy. His works cover a wide range of subjects, including metaphysics, ethics, politics, logic, biology, and aesthetics. His writings laid the groundwork for many modern scientific and philosophical inquiries [A].\n\n4. **Legacy**: Aristotle's influence extends beyond philosophy to the natural sciences, linguistics, economics, and psychology. His method of systematic observation and analysis has been foundational to the development of modern science [A].\n\nAristotle's comprehensive approach to knowledge and his systematic methodology have earned him a lasting legacy as one of the greatest philosophers of all time.\n\nSources:\n- [A] Aristotle's broad range of writings and influence on modern science.\n- [C] Details about Aristotle's early life and education.", - "name": None, - "function_call": None, - "tool_calls": None, - }, - ] + { + "role": "assistant", + "content": "Aristotle (384–322 BC) was an Ancient Greek philosopher and polymath whose contributions have had a profound impact on various fields of knowledge. Here are some key points about his life and work:\n\n1. **Early Life**: Aristotle was born in 384 BC in Stagira, Chalcidice, which is near modern-day Thessaloniki, Greece. His father, Nicomachus, was the personal physician to King Amyntas of Macedon, which exposed Aristotle to medical and biological knowledge from a young age [C].\n\n2. **Education and Career**: After the death of his parents, Aristotle was sent to Athens to study at Plato's Academy, where he remained for about 20 years. After Plato's death, Aristotle left Athens and eventually became the tutor of Alexander the Great [C].\n\n3. **Philosophical Contributions**: Aristotle founded the Lyceum in Athens, where he established the Peripatetic school of philosophy. His works cover a wide range of subjects, including metaphysics, ethics, politics, logic, biology, and aesthetics. His writings laid the groundwork for many modern scientific and philosophical inquiries [A].\n\n4. **Legacy**: Aristotle's influence extends beyond philosophy to the natural sciences, linguistics, economics, and psychology. His method of systematic observation and analysis has been foundational to the development of modern science [A].\n\nAristotle's comprehensive approach to knowledge and his systematic methodology have earned him a lasting legacy as one of the greatest philosophers of all time.\n\nSources:\n- [A] Aristotle's broad range of writings and influence on modern science.\n- [C] Details about Aristotle's early life and education.", + "name": None, + "function_call": None, + "tool_calls": None, + }, + ], + "conversation_id": "a32b4c5d-6e7f-8a9b-0c1d-2e3f4a5b6c7d", + } }