mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 18:00:36 +00:00
feat: add mongodb provider
This commit is contained in:
parent
d8c82c10c2
commit
885631d071
8 changed files with 61 additions and 5 deletions
|
|
@ -25,6 +25,7 @@ distribution_spec:
|
|||
- provider_type: inline::milvus
|
||||
- provider_type: remote::chromadb
|
||||
- provider_type: remote::pgvector
|
||||
- provider_type: remote::mongodb
|
||||
files:
|
||||
- provider_type: inline::localfs
|
||||
safety:
|
||||
|
|
|
|||
|
|
@ -129,6 +129,19 @@ providers:
|
|||
kvstore:
|
||||
type: sqlite
|
||||
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ci-tests}/pgvector_registry.db
|
||||
- provider_id: ${env.MONGODB_CONNECTION_STRING:+mongodb_atlas}
|
||||
provider_type: remote::mongodb
|
||||
config:
|
||||
connection_string: ${env.MONGODB_CONNECTION_STRING}
|
||||
database_name: llama_stack
|
||||
index_name: vector_index
|
||||
path_field: embedding
|
||||
similarity_metric: cosine
|
||||
max_pool_size: 100
|
||||
timeout_ms: 30000
|
||||
kvstore:
|
||||
type: sqlite
|
||||
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/ci-tests}/mongodb_registry.db
|
||||
files:
|
||||
- provider_id: meta-reference-files
|
||||
provider_type: inline::localfs
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ distribution_spec:
|
|||
- provider_type: inline::milvus
|
||||
- provider_type: remote::chromadb
|
||||
- provider_type: remote::pgvector
|
||||
- provider_type: remote::mongodb
|
||||
files:
|
||||
- provider_type: inline::localfs
|
||||
safety:
|
||||
|
|
|
|||
|
|
@ -129,6 +129,19 @@ providers:
|
|||
kvstore:
|
||||
type: sqlite
|
||||
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter-gpu}/pgvector_registry.db
|
||||
- provider_id: ${env.MONGODB_CONNECTION_STRING:+mongodb_atlas}
|
||||
provider_type: remote::mongodb
|
||||
config:
|
||||
connection_string: ${env.MONGODB_CONNECTION_STRING}
|
||||
database_name: llama_stack
|
||||
index_name: vector_index
|
||||
path_field: embedding
|
||||
similarity_metric: cosine
|
||||
max_pool_size: 100
|
||||
timeout_ms: 30000
|
||||
kvstore:
|
||||
type: sqlite
|
||||
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter-gpu}/mongodb_registry.db
|
||||
files:
|
||||
- provider_id: meta-reference-files
|
||||
provider_type: inline::localfs
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ distribution_spec:
|
|||
- provider_type: inline::milvus
|
||||
- provider_type: remote::chromadb
|
||||
- provider_type: remote::pgvector
|
||||
- provider_type: remote::mongodb
|
||||
files:
|
||||
- provider_type: inline::localfs
|
||||
safety:
|
||||
|
|
|
|||
|
|
@ -129,6 +129,19 @@ providers:
|
|||
kvstore:
|
||||
type: sqlite
|
||||
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter}/pgvector_registry.db
|
||||
- provider_id: ${env.MONGODB_CONNECTION_STRING:+mongodb_atlas}
|
||||
provider_type: remote::mongodb
|
||||
config:
|
||||
connection_string: ${env.MONGODB_CONNECTION_STRING}
|
||||
database_name: llama_stack
|
||||
index_name: vector_index
|
||||
path_field: embedding
|
||||
similarity_metric: cosine
|
||||
max_pool_size: 100
|
||||
timeout_ms: 30000
|
||||
kvstore:
|
||||
type: sqlite
|
||||
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/distributions/starter}/mongodb_registry.db
|
||||
files:
|
||||
- provider_id: meta-reference-files
|
||||
provider_type: inline::localfs
|
||||
|
|
|
|||
|
|
@ -28,6 +28,9 @@ from llama_stack.providers.inline.vector_io.sqlite_vec.config import (
|
|||
)
|
||||
from llama_stack.providers.registry.inference import available_providers
|
||||
from llama_stack.providers.remote.vector_io.chroma.config import ChromaVectorIOConfig
|
||||
from llama_stack.providers.remote.vector_io.mongodb.config import (
|
||||
MongoDBVectorIOConfig,
|
||||
)
|
||||
from llama_stack.providers.remote.vector_io.pgvector.config import (
|
||||
PGVectorVectorIOConfig,
|
||||
)
|
||||
|
|
@ -113,6 +116,7 @@ def get_distribution_template(name: str = "starter") -> DistributionTemplate:
|
|||
BuildProvider(provider_type="inline::milvus"),
|
||||
BuildProvider(provider_type="remote::chromadb"),
|
||||
BuildProvider(provider_type="remote::pgvector"),
|
||||
BuildProvider(provider_type="remote::mongodb"),
|
||||
],
|
||||
"files": [BuildProvider(provider_type="inline::localfs")],
|
||||
"safety": [
|
||||
|
|
@ -222,6 +226,13 @@ def get_distribution_template(name: str = "starter") -> DistributionTemplate:
|
|||
password="${env.PGVECTOR_PASSWORD:=}",
|
||||
),
|
||||
),
|
||||
Provider(
|
||||
provider_id="${env.MONGODB_CONNECTION_STRING:+mongodb_atlas}",
|
||||
provider_type="remote::mongodb",
|
||||
config=MongoDBVectorIOConfig.sample_run_config(
|
||||
f"~/.llama/distributions/{name}",
|
||||
),
|
||||
),
|
||||
],
|
||||
"files": [files_provider],
|
||||
},
|
||||
|
|
@ -295,5 +306,13 @@ def get_distribution_template(name: str = "starter") -> DistributionTemplate:
|
|||
"azure",
|
||||
"Azure API Type",
|
||||
),
|
||||
"MONGODB_CONNECTION_STRING": (
|
||||
"",
|
||||
"MongoDB Atlas connection string (e.g., mongodb+srv://user:pass@cluster.mongodb.net/)",
|
||||
),
|
||||
"MONGODB_DATABASE_NAME": (
|
||||
"llama_stack",
|
||||
"MongoDB database name",
|
||||
),
|
||||
},
|
||||
)
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This source code is licensed under the terms described in the LICENSE file in
|
||||
# the root directory of this source tree.
|
||||
Loading…
Add table
Add a link
Reference in a new issue