Skip to content

Commit 9378bdc

Browse files
adam-d-youngAdam Young
andauthored
docs: Fix incorrect vector_db_id usage in RAG tutorial (#3444)
# What does this PR do? This PR fixes a blocking issue in the detailed RAG tutorial where the code fails with a 400 Bad Request error. The root cause is that recent versions of Llama-Stack ignore the client-generated vector_db_id and assign a new server-side ID. The tutorial was not updated to reflect this, causing the rag_tool.insert call to fail. This change updates the code to capture the authoritative ID from the .identifier attribute of the register() method's response. This ensures the tutorial code runs successfully and reflects the current API behavior. ## Test Plan The fix can be verified by running the Python code snippet from the detailed tutorial page. Run the original code (Before this change): Result: The script fails with a 400 Bad Request error on the rag_tool.insert step. Run the updated code (After this change): Result: The script runs successfully to completion. Co-authored-by: Adam Young <[email protected]>
1 parent 4c2fcb6 commit 9378bdc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

docs/source/getting_started/detailed_tutorial.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -460,10 +460,12 @@ client = LlamaStackClient(base_url="http://localhost:8321")
460460
embed_lm = next(m for m in client.models.list() if m.model_type == "embedding")
461461
embedding_model = embed_lm.identifier
462462
vector_db_id = f"v{uuid.uuid4().hex}"
463-
client.vector_dbs.register(
463+
# The VectorDB API is deprecated; the server now returns its own authoritative ID.
464+
# We capture the correct ID from the response's .identifier attribute.
465+
vector_db_id = client.vector_dbs.register(
464466
vector_db_id=vector_db_id,
465467
embedding_model=embedding_model,
466-
)
468+
).identifier
467469

468470
# Create Documents
469471
urls = [

0 commit comments

Comments
 (0)