docs: Fix vector_store_create params (#4364)
Some checks failed
SqlStore Integration Tests / test-postgres (3.12) (push) Failing after 0s
Integration Auth Tests / test-matrix (oauth2_token) (push) Failing after 0s
SqlStore Integration Tests / test-postgres (3.13) (push) Failing after 0s
Test External Providers Installed via Module / test-external-providers-from-module (venv) (push) Has been skipped
Integration Tests (Replay) / generate-matrix (push) Successful in 3s
API Conformance Tests / check-schema-compatibility (push) Successful in 14s
Python Package Build Test / build (3.12) (push) Successful in 15s
Python Package Build Test / build (3.13) (push) Successful in 17s
Test External API and Providers / test-external (venv) (push) Failing after 31s
Vector IO Integration Tests / test-matrix (push) Failing after 38s
UI Tests / ui-tests (22) (push) Successful in 44s
Unit Tests / unit-tests (3.12) (push) Failing after 1m30s
Unit Tests / unit-tests (3.13) (push) Failing after 1m29s
Pre-commit / pre-commit (22) (push) Successful in 2m59s
Integration Tests (Replay) / Integration Tests (, , , client=, ) (push) Failing after 3m38s

This commit is contained in:
Varsha 2025-12-09 16:48:43 -08:00 committed by GitHub
parent fcea9893a4
commit 17e6912288
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 26 additions and 11 deletions

View file

@ -15,8 +15,10 @@ Unlike OpenAI's vector stores which use a fixed embedding model, Llama Stack all
# Create vector store with specific embedding model
vector_store = client.vector_stores.create(
name="my_documents",
embedding_model="all-MiniLM-L6-v2", # Specify your preferred model
embedding_dimension=384,
extra_body={
"embedding_model": "sentence-transformers/all-MiniLM-L6-v2", # Specify your preferred model
"embedding_dimension": 384, # Optional: will be auto-detected if not provided
}
)
```
@ -64,10 +66,17 @@ Choose from multiple vector store providers based on your specific needs:
```python
# Specify provider when creating vector store
vector_store = client.vector_stores.create(
name="my_documents", provider_id="sqlite-vec" # Choose your preferred provider
name="my_documents",
extra_body={
"provider_id": "sqlite-vec", # Choose your preferred provider
"embedding_model": "sentence-transformers/all-MiniLM-L6-v2", # Optional: specify embedding model
"embedding_dimension": 384, # Optional: will be auto-detected if not provided
}
)
```
**Note**: All Llama Stack-specific parameters (`provider_id`, `embedding_model`, and `embedding_dimension`) must be specified in the `extra_body` parameter when creating vector stores.
## How It Works
The file operations work through several key components:
@ -113,7 +122,8 @@ with open("document.pdf", "rb") as f:
### 2. Attach to Vector Store
```python
# Create a vector store
# Create a vector store (uses defaults if configured)
# You can also specify embedding_model, embedding_dimension, and provider_id in extra_body
vector_store = client.vector_stores.create(name="my_documents")
# Attach the file to the vector store
@ -367,7 +377,8 @@ results = await client.vector_stores.search(
```python
# Build a RAG system with file uploads
async def build_rag_system():
# Create vector store
# Create vector store (uses defaults if configured)
# You can specify embedding_model, embedding_dimension, and provider_id in extra_body if needed
vector_store = client.vector_stores.create(name="knowledge_base")
# Upload and process documents

View file

@ -443,9 +443,11 @@
"vector_store = client.vector_stores.create(\n",
" name=\"acme_docs\",\n",
" file_ids=file_ids,\n",
" embedding_model=\"sentence-transformers/all-MiniLM-L6-v2\",\n",
" embedding_dimension=384,\n",
" provider_id=\"faiss\"\n",
" extra_body={\n",
" \"embedding_model\": \"sentence-transformers/all-MiniLM-L6-v2\",\n",
" \"embedding_dimension\": 384,\n",
" \"provider_id\": \"faiss\"\n",
" }\n",
")"
]
},

View file

@ -360,9 +360,11 @@
"vector_store = client.vector_stores.create(\n",
" name=\"acme_docs\",\n",
" file_ids=file_ids,\n",
" embedding_model=\"sentence-transformers/all-MiniLM-L6-v2\",\n",
" embedding_dimension=384,\n",
" provider_id=\"faiss\"\n",
" extra_body={\n",
" \"embedding_model\": \"sentence-transformers/all-MiniLM-L6-v2\",\n",
" \"embedding_dimension\": 384,\n",
" \"provider_id\": \"faiss\"\n",
" }\n",
")"
]
},