mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-10 04:08:31 +00:00
update rag examples to use fresh faiss index every time
This commit is contained in:
parent
c79cc92b37
commit
3e7f682906
3 changed files with 9 additions and 7 deletions
|
@ -1656,6 +1656,7 @@
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"source": [
|
"source": [
|
||||||
|
"import uuid\n",
|
||||||
"from llama_stack_client.lib.agents.agent import Agent\n",
|
"from llama_stack_client.lib.agents.agent import Agent\n",
|
||||||
"from llama_stack_client.lib.agents.event_logger import EventLogger\n",
|
"from llama_stack_client.lib.agents.event_logger import EventLogger\n",
|
||||||
"from llama_stack_client.types.agent_create_params import AgentConfig\n",
|
"from llama_stack_client.types.agent_create_params import AgentConfig\n",
|
||||||
|
@ -1673,7 +1674,7 @@
|
||||||
" for i, url in enumerate(urls)\n",
|
" for i, url in enumerate(urls)\n",
|
||||||
"]\n",
|
"]\n",
|
||||||
"\n",
|
"\n",
|
||||||
"vector_db_id = \"test-vector-db\"\n",
|
"vector_db_id = f\"test-vector-db-{uuid.uuid4().hex}\"\n",
|
||||||
"client.vector_dbs.register(\n",
|
"client.vector_dbs.register(\n",
|
||||||
" vector_db_id=vector_db_id,\n",
|
" vector_db_id=vector_db_id,\n",
|
||||||
" embedding_model=\"all-MiniLM-L6-v2\",\n",
|
" embedding_model=\"all-MiniLM-L6-v2\",\n",
|
||||||
|
|
|
@ -173,6 +173,7 @@ Here is an example of a simple RAG (Retrieval Augmented Generation) chatbot agen
|
||||||
|
|
||||||
```python
|
```python
|
||||||
import os
|
import os
|
||||||
|
import uuid
|
||||||
from termcolor import cprint
|
from termcolor import cprint
|
||||||
|
|
||||||
from llama_stack_client.lib.agents.agent import Agent
|
from llama_stack_client.lib.agents.agent import Agent
|
||||||
|
@ -214,7 +215,7 @@ documents = [
|
||||||
]
|
]
|
||||||
|
|
||||||
# Register a vector database
|
# Register a vector database
|
||||||
vector_db_id = "test-vector-db"
|
vector_db_id = f"test-vector-db-{uuid.uuid4().hex}"
|
||||||
client.vector_dbs.register(
|
client.vector_dbs.register(
|
||||||
vector_db_id=vector_db_id,
|
vector_db_id=vector_db_id,
|
||||||
embedding_model="all-MiniLM-L6-v2",
|
embedding_model="all-MiniLM-L6-v2",
|
||||||
|
|
|
@ -414,7 +414,7 @@ def test_rag_and_code_agent(llama_stack_client, agent_config):
|
||||||
)
|
)
|
||||||
for i, url in enumerate(urls)
|
for i, url in enumerate(urls)
|
||||||
]
|
]
|
||||||
vector_db_id = "test-vector-db"
|
vector_db_id = f"test-vector-db-{uuid4()}"
|
||||||
llama_stack_client.vector_dbs.register(
|
llama_stack_client.vector_dbs.register(
|
||||||
vector_db_id=vector_db_id,
|
vector_db_id=vector_db_id,
|
||||||
embedding_model="all-MiniLM-L6-v2",
|
embedding_model="all-MiniLM-L6-v2",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue