[memory refactor][6/n] Update naming and routes (#839)

Making a few small naming changes as per feedback:

- RAGToolRuntime methods are called `insert` and `query` to keep them
more general
- The tool names are changed to non-namespaced forms
`insert_into_memory` and `query_from_memory`
- The REST endpoints are more REST-ful
This commit is contained in:
Ashwin Bharambe 2025-01-22 10:39:13 -08:00 committed by GitHub
parent c9e5578151
commit a63a43c646
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 319 additions and 330 deletions

View file

@ -1887,6 +1887,49 @@
]
}
},
"/v1/tool-runtime/rag-tool/insert": {
"post": {
"responses": {
"200": {
"description": "OK"
}
},
"tags": [
"ToolRuntime"
],
"summary": "Index documents so they can be used by the RAG system",
"parameters": [
{
"name": "X-LlamaStack-Provider-Data",
"in": "header",
"description": "JSON-encoded provider data which will be made available to the adapter servicing the API",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "X-LlamaStack-Client-Version",
"in": "header",
"description": "Version of the client making the request. This is used to ensure that the client and server are compatible.",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/InsertRequest"
}
}
},
"required": true
}
}
},
"/v1/vector-io/insert": {
"post": {
"responses": {
@ -1929,49 +1972,6 @@
}
}
},
"/v1/tool-runtime/rag-tool/insert-documents": {
"post": {
"responses": {
"200": {
"description": "OK"
}
},
"tags": [
"ToolRuntime"
],
"summary": "Index documents so they can be used by the RAG system",
"parameters": [
{
"name": "X-LlamaStack-Provider-Data",
"in": "header",
"description": "JSON-encoded provider data which will be made available to the adapter servicing the API",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "X-LlamaStack-Client-Version",
"in": "header",
"description": "Version of the client making the request. This is used to ensure that the client and server are compatible.",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/InsertDocumentsRequest"
}
}
},
"required": true
}
}
},
"/v1/tool-runtime/invoke": {
"post": {
"responses": {
@ -3033,6 +3033,56 @@
}
}
},
"/v1/tool-runtime/rag-tool/query": {
"post": {
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RAGQueryResult"
}
}
}
}
},
"tags": [
"ToolRuntime"
],
"summary": "Query the RAG system for context; typically invoked by the agent",
"parameters": [
{
"name": "X-LlamaStack-Provider-Data",
"in": "header",
"description": "JSON-encoded provider data which will be made available to the adapter servicing the API",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "X-LlamaStack-Client-Version",
"in": "header",
"description": "Version of the client making the request. This is used to ensure that the client and server are compatible.",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/QueryRequest"
}
}
},
"required": true
}
}
},
"/v1/vector-io/query": {
"post": {
"responses": {
@ -3082,56 +3132,6 @@
}
}
},
"/v1/tool-runtime/rag-tool/query-context": {
"post": {
"responses": {
"200": {
"description": "OK",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RAGQueryResult"
}
}
}
}
},
"tags": [
"ToolRuntime"
],
"summary": "Query the RAG system for context; typically invoked by the agent",
"parameters": [
{
"name": "X-LlamaStack-Provider-Data",
"in": "header",
"description": "JSON-encoded provider data which will be made available to the adapter servicing the API",
"required": false,
"schema": {
"type": "string"
}
},
{
"name": "X-LlamaStack-Client-Version",
"in": "header",
"description": "Version of the client making the request. This is used to ensure that the client and server are compatible.",
"required": false,
"schema": {
"type": "string"
}
}
],
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/QueryContextRequest"
}
}
},
"required": true
}
}
},
"/v1/telemetry/spans": {
"get": {
"responses": {
@ -5256,11 +5256,8 @@
"const": "memory_retrieval",
"default": "memory_retrieval"
},
"memory_bank_ids": {
"type": "array",
"items": {
"type": "string"
}
"vector_db_ids": {
"type": "string"
},
"inserted_context": {
"$ref": "#/components/schemas/InterleavedContent"
@ -5271,7 +5268,7 @@
"turn_id",
"step_id",
"step_type",
"memory_bank_ids",
"vector_db_ids",
"inserted_context"
]
},
@ -6976,63 +6973,6 @@
"status"
]
},
"InsertChunksRequest": {
"type": "object",
"properties": {
"vector_db_id": {
"type": "string"
},
"chunks": {
"type": "array",
"items": {
"type": "object",
"properties": {
"content": {
"$ref": "#/components/schemas/InterleavedContent"
},
"metadata": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "null"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
]
}
}
},
"additionalProperties": false,
"required": [
"content",
"metadata"
]
}
},
"ttl_seconds": {
"type": "integer"
}
},
"additionalProperties": false,
"required": [
"vector_db_id",
"chunks"
]
},
"RAGDocument": {
"type": "object",
"properties": {
@ -7094,7 +7034,7 @@
"metadata"
]
},
"InsertDocumentsRequest": {
"InsertRequest": {
"type": "object",
"properties": {
"documents": {
@ -7117,6 +7057,63 @@
"chunk_size_in_tokens"
]
},
"InsertChunksRequest": {
"type": "object",
"properties": {
"vector_db_id": {
"type": "string"
},
"chunks": {
"type": "array",
"items": {
"type": "object",
"properties": {
"content": {
"$ref": "#/components/schemas/InterleavedContent"
},
"metadata": {
"type": "object",
"additionalProperties": {
"oneOf": [
{
"type": "null"
},
{
"type": "boolean"
},
{
"type": "number"
},
{
"type": "string"
},
{
"type": "array"
},
{
"type": "object"
}
]
}
}
},
"additionalProperties": false,
"required": [
"content",
"metadata"
]
}
},
"ttl_seconds": {
"type": "integer"
}
},
"additionalProperties": false,
"required": [
"vector_db_id",
"chunks"
]
},
"InvokeToolRequest": {
"type": "object",
"properties": {
@ -7883,6 +7880,110 @@
"job_uuid"
]
},
"DefaultRAGQueryGeneratorConfig": {
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "default",
"default": "default"
},
"separator": {
"type": "string",
"default": " "
}
},
"additionalProperties": false,
"required": [
"type",
"separator"
]
},
"LLMRAGQueryGeneratorConfig": {
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "llm",
"default": "llm"
},
"model": {
"type": "string"
},
"template": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"type",
"model",
"template"
]
},
"RAGQueryConfig": {
"type": "object",
"properties": {
"query_generator_config": {
"$ref": "#/components/schemas/RAGQueryGeneratorConfig"
},
"max_tokens_in_context": {
"type": "integer",
"default": 4096
},
"max_chunks": {
"type": "integer",
"default": 5
}
},
"additionalProperties": false,
"required": [
"query_generator_config",
"max_tokens_in_context",
"max_chunks"
]
},
"RAGQueryGeneratorConfig": {
"oneOf": [
{
"$ref": "#/components/schemas/DefaultRAGQueryGeneratorConfig"
},
{
"$ref": "#/components/schemas/LLMRAGQueryGeneratorConfig"
}
]
},
"QueryRequest": {
"type": "object",
"properties": {
"content": {
"$ref": "#/components/schemas/InterleavedContent"
},
"vector_db_ids": {
"type": "array",
"items": {
"type": "string"
}
},
"query_config": {
"$ref": "#/components/schemas/RAGQueryConfig"
}
},
"additionalProperties": false,
"required": [
"content",
"vector_db_ids"
]
},
"RAGQueryResult": {
"type": "object",
"properties": {
"content": {
"$ref": "#/components/schemas/InterleavedContent"
}
},
"additionalProperties": false
},
"QueryChunksRequest": {
"type": "object",
"properties": {
@ -7981,111 +8082,6 @@
"scores"
]
},
"DefaultRAGQueryGeneratorConfig": {
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "default",
"default": "default"
},
"separator": {
"type": "string",
"default": " "
}
},
"additionalProperties": false,
"required": [
"type",
"separator"
]
},
"LLMRAGQueryGeneratorConfig": {
"type": "object",
"properties": {
"type": {
"type": "string",
"const": "llm",
"default": "llm"
},
"model": {
"type": "string"
},
"template": {
"type": "string"
}
},
"additionalProperties": false,
"required": [
"type",
"model",
"template"
]
},
"RAGQueryConfig": {
"type": "object",
"properties": {
"query_generator_config": {
"$ref": "#/components/schemas/RAGQueryGeneratorConfig"
},
"max_tokens_in_context": {
"type": "integer",
"default": 4096
},
"max_chunks": {
"type": "integer",
"default": 5
}
},
"additionalProperties": false,
"required": [
"query_generator_config",
"max_tokens_in_context",
"max_chunks"
]
},
"RAGQueryGeneratorConfig": {
"oneOf": [
{
"$ref": "#/components/schemas/DefaultRAGQueryGeneratorConfig"
},
{
"$ref": "#/components/schemas/LLMRAGQueryGeneratorConfig"
}
]
},
"QueryContextRequest": {
"type": "object",
"properties": {
"content": {
"$ref": "#/components/schemas/InterleavedContent"
},
"query_config": {
"$ref": "#/components/schemas/RAGQueryConfig"
},
"vector_db_ids": {
"type": "array",
"items": {
"type": "string"
}
}
},
"additionalProperties": false,
"required": [
"content",
"query_config",
"vector_db_ids"
]
},
"RAGQueryResult": {
"type": "object",
"properties": {
"content": {
"$ref": "#/components/schemas/InterleavedContent"
}
},
"additionalProperties": false
},
"QueryCondition": {
"type": "object",
"properties": {
@ -9246,8 +9242,8 @@
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/InsertChunksRequest\" />"
},
{
"name": "InsertDocumentsRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/InsertDocumentsRequest\" />"
"name": "InsertRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/InsertRequest\" />"
},
{
"name": "Inspect"
@ -9435,8 +9431,8 @@
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/QueryConditionOp\" />"
},
{
"name": "QueryContextRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/QueryContextRequest\" />"
"name": "QueryRequest",
"description": "<SchemaDefinition schemaRef=\"#/components/schemas/QueryRequest\" />"
},
{
"name": "QuerySpanTreeResponse",
@ -9858,7 +9854,7 @@
"ImageDelta",
"InferenceStep",
"InsertChunksRequest",
"InsertDocumentsRequest",
"InsertRequest",
"InterleavedContent",
"InterleavedContentItem",
"InvokeToolRequest",
@ -9903,7 +9899,7 @@
"QueryChunksResponse",
"QueryCondition",
"QueryConditionOp",
"QueryContextRequest",
"QueryRequest",
"QuerySpanTreeResponse",
"QuerySpansResponse",
"QueryTracesResponse",