forked from phoenix-oss/llama-stack-mirror
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 <reid201711@gmail.com> Co-authored-by: reidliu <reid201711@gmail.com>
This commit is contained in:
parent
1a95271fab
commit
db4ee7a9ff
1 changed files with 13 additions and 0 deletions
|
@ -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:
|
Here's how to set up a vector database for RAG:
|
||||||
|
|
||||||
```python
|
```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
|
# Register a vector db
|
||||||
vector_db_id = "my_documents"
|
vector_db_id = "my_documents"
|
||||||
response = client.vector_dbs.register(
|
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
|
### Unregistering Vector DBs
|
||||||
|
|
||||||
If you need to clean up and unregister vector databases, you can do so as follows:
|
If you need to clean up and unregister vector databases, you can do so as follows:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue