feat (RAG): Implement configurable search mode in RAGQueryConfig

Signed-off-by: Varsha Prasad Narsing <varshaprasad96@gmail.com>
This commit is contained in:
Varsha Prasad Narsing 2025-04-14 16:53:17 -07:00
parent 85b5f3172b
commit e2a7022d3c
14 changed files with 210 additions and 43 deletions

View file

@ -11601,6 +11601,7 @@
},
"max_chunks": {
"type": "integer",
<<<<<<< HEAD
"default": 5,
"description": "Maximum number of chunks to retrieve."
},
@ -11608,6 +11609,12 @@
"type": "string",
"default": "Result {index}\nContent: {chunk.content}\nMetadata: {metadata}\n",
"description": "Template for formatting each retrieved chunk in the context. Available placeholders: {index} (1-based chunk ordinal), {chunk.content} (chunk content string), {metadata} (chunk metadata dict). Default: \"Result {index}\\nContent: {chunk.content}\\nMetadata: {metadata}\\n\""
=======
"default": 5
},
"mode": {
"type": "string"
>>>>>>> 1a0433d2 (feat (RAG): Implement configurable search mode in RAGQueryConfig)
}
},
"additionalProperties": false,

View file

@ -8072,6 +8072,7 @@ components:
max_chunks:
type: integer
default: 5
<<<<<<< HEAD
description: Maximum number of chunks to retrieve.
chunk_template:
type: string
@ -8086,6 +8087,10 @@ components:
placeholders: {index} (1-based chunk ordinal), {chunk.content} (chunk
content string), {metadata} (chunk metadata dict). Default: "Result {index}\nContent:
{chunk.content}\nMetadata: {metadata}\n"
=======
mode:
type: string
>>>>>>> 1a0433d2 (feat (RAG): Implement configurable search mode in RAGQueryConfig)
additionalProperties: false
required:
- query_generator_config

View file

@ -66,6 +66,25 @@ To use sqlite-vec in your Llama Stack project, follow these steps:
2. Configure your Llama Stack project to use SQLite-Vec.
3. Start storing and querying vectors.
## Supported Search Modes
The sqlite-vec provider supports both vector-based and keyword-based (full-text) search modes.
When using the RAGTool interface, you can specify the desired search behavior via the search_mode parameter in
`RAGQueryConfig`. For example:
```python
from llama_stack.apis.tool_runtime.rag import RAGQueryConfig
query_config = RAGQueryConfig(max_chunks=6, mode="vector")
results = client.tool_runtime.rag_tool.query(
vector_db_ids=[vector_db_id],
content="what is torchtune",
query_config=query_config,
)
```
## Installation
You can install SQLite-Vec using pip: