mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 18:00:36 +00:00
fix: add default param to pass pydantic error
This commit is contained in:
parent
d8849f0b95
commit
8f0f4a26a3
2 changed files with 9 additions and 2 deletions
|
|
@ -23,8 +23,8 @@ class MongoDBVectorIOConfig(BaseModel):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# MongoDB Atlas connection details
|
# MongoDB Atlas connection details
|
||||||
connection_string: str = Field(
|
connection_string: str | None = Field(
|
||||||
default="",
|
default=None,
|
||||||
description="MongoDB Atlas connection string (e.g., mongodb+srv://user:pass@cluster.mongodb.net/)",
|
description="MongoDB Atlas connection string (e.g., mongodb+srv://user:pass@cluster.mongodb.net/)",
|
||||||
)
|
)
|
||||||
database_name: str = Field(default="llama_stack", description="Database name to use for vector collections")
|
database_name: str = Field(default="llama_stack", description="Database name to use for vector collections")
|
||||||
|
|
|
||||||
|
|
@ -419,6 +419,13 @@ class MongoDBVectorIOAdapter(OpenAIVectorStoreMixin, VectorIO, VectorDBsProtocol
|
||||||
# Initialize KV store for metadata
|
# Initialize KV store for metadata
|
||||||
self.kvstore = await kvstore_impl(self.config.kvstore)
|
self.kvstore = await kvstore_impl(self.config.kvstore)
|
||||||
|
|
||||||
|
# Validate connection string
|
||||||
|
if not self.config.connection_string:
|
||||||
|
raise ValueError(
|
||||||
|
"MongoDB connection_string is required but not provided. "
|
||||||
|
"Please set MONGODB_CONNECTION_STRING environment variable or provide it in config."
|
||||||
|
)
|
||||||
|
|
||||||
# Connect to MongoDB with optimized settings for RAG
|
# Connect to MongoDB with optimized settings for RAG
|
||||||
self.client = MongoClient(
|
self.client = MongoClient(
|
||||||
self.config.connection_string,
|
self.config.connection_string,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue