From edf4514ba29b98f37a8a504204dff610a87a8d9b Mon Sep 17 00:00:00 2001 From: Francisco Javier Arceo Date: Wed, 30 Jul 2025 20:38:39 -0400 Subject: [PATCH] remove host and port and use cluster url instead Signed-off-by: Francisco Javier Arceo --- docs/source/providers/vector_io/remote_weaviate.md | 8 ++------ .../providers/remote/vector_io/weaviate/config.py | 10 ++-------- .../providers/remote/vector_io/weaviate/weaviate.py | 7 ++++--- 3 files changed, 8 insertions(+), 17 deletions(-) diff --git a/docs/source/providers/vector_io/remote_weaviate.md b/docs/source/providers/vector_io/remote_weaviate.md index 793032ba9..c59487cf6 100644 --- a/docs/source/providers/vector_io/remote_weaviate.md +++ b/docs/source/providers/vector_io/remote_weaviate.md @@ -37,19 +37,15 @@ See [Weaviate's documentation](https://weaviate.io/developers/weaviate) for more | Field | Type | Required | Default | Description | |-------|------|----------|---------|-------------| -| `host` | `str \| None` | No | localhost | | -| `port` | `int \| None` | No | 8080 | | | `weaviate_api_key` | `str \| None` | No | | The API key for the Weaviate instance | -| `weaviate_cluster_url` | `str \| None` | No | | The URL of the Weaviate cluster | +| `weaviate_cluster_url` | `str \| None` | No | localhost:8080 | The URL of the Weaviate cluster | | `kvstore` | `utils.kvstore.config.RedisKVStoreConfig \| utils.kvstore.config.SqliteKVStoreConfig \| utils.kvstore.config.PostgresKVStoreConfig \| utils.kvstore.config.MongoDBKVStoreConfig, annotation=NoneType, required=False, default='sqlite', discriminator='type'` | No | | Config for KV store backend (SQLite only for now) | ## Sample Configuration ```yaml -host: ${env.WEAVIATE_HOST:=localhost} -port: ${env.WEAVIATE_PORT:=8080} weaviate_api_key: null -weaviate_cluster_url: null +weaviate_cluster_url: ${env.WEAVIATE_CLUSTER_URL:=localhost:8080} kvstore: type: sqlite db_path: ${env.SQLITE_STORE_DIR:=~/.llama/dummy}/weaviate_registry.db diff --git a/llama_stack/providers/remote/vector_io/weaviate/config.py b/llama_stack/providers/remote/vector_io/weaviate/config.py index b111e9032..b693e294e 100644 --- a/llama_stack/providers/remote/vector_io/weaviate/config.py +++ b/llama_stack/providers/remote/vector_io/weaviate/config.py @@ -17,25 +17,19 @@ from llama_stack.schema_utils import json_schema_type @json_schema_type class WeaviateVectorIOConfig(BaseModel): - host: str | None = Field(default="localhost") - port: int | None = Field(default=8080) weaviate_api_key: str | None = Field(description="The API key for the Weaviate instance", default=None) - weaviate_cluster_url: str | None = Field(description="The URL of the Weaviate cluster", default=None) + weaviate_cluster_url: str | None = Field(description="The URL of the Weaviate cluster", default="localhost:8080") kvstore: KVStoreConfig | None = Field(description="Config for KV store backend (SQLite only for now)", default=None) @classmethod def sample_run_config( cls, __distro_dir__: str, - host: str = "${env.WEAVIATE_HOST:=localhost}", - port: int = "${env.WEAVIATE_PORT:=8080}", **kwargs: Any, ) -> dict[str, Any]: return { - "host": "${env.WEAVIATE_HOST:=localhost}", - "port": "${env.WEAVIATE_PORT:=8080}", "weaviate_api_key": None, - "weaviate_cluster_url": None, + "weaviate_cluster_url": "${env.WEAVIATE_CLUSTER_URL:=localhost:8080}", "kvstore": SqliteKVStoreConfig.sample_run_config( __distro_dir__=__distro_dir__, db_name="weaviate_registry.db", diff --git a/llama_stack/providers/remote/vector_io/weaviate/weaviate.py b/llama_stack/providers/remote/vector_io/weaviate/weaviate.py index 465db2f68..aca202b75 100644 --- a/llama_stack/providers/remote/vector_io/weaviate/weaviate.py +++ b/llama_stack/providers/remote/vector_io/weaviate/weaviate.py @@ -166,11 +166,12 @@ class WeaviateVectorIOAdapter( self.metadata_collection_name = "openai_vector_stores_metadata" def _get_client(self) -> weaviate.Client: - if self.config.weaviate_cluster_url is None: + if self.config.weaviate_cluster_url == "localhost:8080": + host, port = self.config.weaviate_cluster_url.split(":") key = "local_test" client = weaviate.connect_to_local( - host=self.config.host, - port=self.config.port, + host=host, + port=port, ) else: key = f"{self.config.weaviate_cluster_url}::{self.config.weaviate_api_key}"