From db4ee7a9ff5edab588f11ac9f8496397509f044a Mon Sep 17 00:00:00 2001 From: Reid <61492567+reidliu41@users.noreply.github.com> Date: Fri, 7 Mar 2025 06:03:52 +0800 Subject: [PATCH] docs: improve rag doc (#1411) # What does this PR do? [Provide a short summary of what this PR does and why. Link to relevant issues if applicable.] [//]: # (If resolving an issue, uncomment and update the line below) [//]: # (Closes #[issue-number]) ## Test Plan [Describe the tests you ran to verify your changes with result summaries. *Provide clear instructions so the plan can be easily re-executed.*] [//]: # (## Documentation) Signed-off-by: reidliu Co-authored-by: reidliu --- docs/source/building_applications/rag.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/source/building_applications/rag.md b/docs/source/building_applications/rag.md index acbc07ca4..3646936a8 100644 --- a/docs/source/building_applications/rag.md +++ b/docs/source/building_applications/rag.md @@ -20,6 +20,11 @@ We may add more storage types like Graph IO in the future. Here's how to set up a vector database for RAG: ```python +# Create http client +from llama_stack_client import LlamaStackClient + +client = LlamaStackClient(base_url=f"http://localhost:{os.environ['LLAMA_STACK_PORT']}") + # Register a vector db vector_db_id = "my_documents" response = client.vector_dbs.register( @@ -136,6 +141,14 @@ response = agent.create_turn( ) ``` +You can print the response with below. +```python +from llama_stack_client.lib.agents.event_logger import EventLogger + +for log in EventLogger().log(response): + log.print() +``` + ### Unregistering Vector DBs If you need to clean up and unregister vector databases, you can do so as follows: