mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 09:53:45 +00:00
fix(rag-example): add provider_id to avoid llama_stack_client 400 error (#1114)
# What does this PR do?
Add provider_id to avoid errors using the rag example with
llama_stack_client
`llama_stack_client.BadRequestError: Error code: 400 - {'detail':
'Invalid value: No provider specified and multiple providers available.
Please specify a provider_id.'}`
[//]: # (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)
---------
Co-authored-by: Xi Yan <yanxi970830@gmail.com>
This commit is contained in:
parent
034ece0011
commit
9e03df983e
1 changed files with 6 additions and 0 deletions
|
|
@ -214,10 +214,16 @@ documents = [
|
|||
for i, url in enumerate(urls)
|
||||
]
|
||||
|
||||
vector_providers = [
|
||||
provider for provider in client.providers.list() if provider.api == "vector_io"
|
||||
]
|
||||
provider_id = vector_providers[0].provider_id # Use the first available vector provider
|
||||
|
||||
# Register a vector database
|
||||
vector_db_id = f"test-vector-db-{uuid.uuid4().hex}"
|
||||
client.vector_dbs.register(
|
||||
vector_db_id=vector_db_id,
|
||||
provider_id=provider_id,
|
||||
embedding_model="all-MiniLM-L6-v2",
|
||||
embedding_dimension=384,
|
||||
)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue