mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-10-04 12:07:34 +00:00
docs: Fix incorrect vector_db_id usage in RAG tutorial
The detailed RAG tutorial was using a client-generated `vector_db_id`. Recent versions of Llama-Stack ignore this ID and assign a new server-side ID, causing the `rag_tool.insert` call to fail with a `400 Bad Request` error. This commit updates the code to capture the authoritative ID from the `.identifier` attribute of the `register()` method's response object. A concise comment is also added to explain why this is necessary. This ensures the tutorial code runs successfully and reflects the current API behavior related to the deprecation of VectorDB.
This commit is contained in:
parent
6787755c0c
commit
1039c8e7cf
1 changed files with 4 additions and 2 deletions
|
@ -460,10 +460,12 @@ client = LlamaStackClient(base_url="http://localhost:8321")
|
||||||
embed_lm = next(m for m in client.models.list() if m.model_type == "embedding")
|
embed_lm = next(m for m in client.models.list() if m.model_type == "embedding")
|
||||||
embedding_model = embed_lm.identifier
|
embedding_model = embed_lm.identifier
|
||||||
vector_db_id = f"v{uuid.uuid4().hex}"
|
vector_db_id = f"v{uuid.uuid4().hex}"
|
||||||
client.vector_dbs.register(
|
# The VectorDB API is deprecated; the server now returns its own authoritative ID.
|
||||||
|
# We capture the correct ID from the response's .identifier attribute.
|
||||||
|
vector_db_id = client.vector_dbs.register(
|
||||||
vector_db_id=vector_db_id,
|
vector_db_id=vector_db_id,
|
||||||
embedding_model=embedding_model,
|
embedding_model=embedding_model,
|
||||||
)
|
).identifier
|
||||||
|
|
||||||
# Create Documents
|
# Create Documents
|
||||||
urls = [
|
urls = [
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue