mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-08-16 22:43:14 +00:00
remove host and port and use cluster url instead
Signed-off-by: Francisco Javier Arceo <farceo@redhat.com>
This commit is contained in:
parent
87780534b0
commit
edf4514ba2
3 changed files with 8 additions and 17 deletions
|
@ -37,19 +37,15 @@ See [Weaviate's documentation](https://weaviate.io/developers/weaviate) for more
|
||||||
|
|
||||||
| Field | Type | Required | Default | Description |
|
| 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_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) |
|
| `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
|
## Sample Configuration
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
host: ${env.WEAVIATE_HOST:=localhost}
|
|
||||||
port: ${env.WEAVIATE_PORT:=8080}
|
|
||||||
weaviate_api_key: null
|
weaviate_api_key: null
|
||||||
weaviate_cluster_url: null
|
weaviate_cluster_url: ${env.WEAVIATE_CLUSTER_URL:=localhost:8080}
|
||||||
kvstore:
|
kvstore:
|
||||||
type: sqlite
|
type: sqlite
|
||||||
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/dummy}/weaviate_registry.db
|
db_path: ${env.SQLITE_STORE_DIR:=~/.llama/dummy}/weaviate_registry.db
|
||||||
|
|
|
@ -17,25 +17,19 @@ from llama_stack.schema_utils import json_schema_type
|
||||||
|
|
||||||
@json_schema_type
|
@json_schema_type
|
||||||
class WeaviateVectorIOConfig(BaseModel):
|
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_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)
|
kvstore: KVStoreConfig | None = Field(description="Config for KV store backend (SQLite only for now)", default=None)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def sample_run_config(
|
def sample_run_config(
|
||||||
cls,
|
cls,
|
||||||
__distro_dir__: str,
|
__distro_dir__: str,
|
||||||
host: str = "${env.WEAVIATE_HOST:=localhost}",
|
|
||||||
port: int = "${env.WEAVIATE_PORT:=8080}",
|
|
||||||
**kwargs: Any,
|
**kwargs: Any,
|
||||||
) -> dict[str, Any]:
|
) -> dict[str, Any]:
|
||||||
return {
|
return {
|
||||||
"host": "${env.WEAVIATE_HOST:=localhost}",
|
|
||||||
"port": "${env.WEAVIATE_PORT:=8080}",
|
|
||||||
"weaviate_api_key": None,
|
"weaviate_api_key": None,
|
||||||
"weaviate_cluster_url": None,
|
"weaviate_cluster_url": "${env.WEAVIATE_CLUSTER_URL:=localhost:8080}",
|
||||||
"kvstore": SqliteKVStoreConfig.sample_run_config(
|
"kvstore": SqliteKVStoreConfig.sample_run_config(
|
||||||
__distro_dir__=__distro_dir__,
|
__distro_dir__=__distro_dir__,
|
||||||
db_name="weaviate_registry.db",
|
db_name="weaviate_registry.db",
|
||||||
|
|
|
@ -166,11 +166,12 @@ class WeaviateVectorIOAdapter(
|
||||||
self.metadata_collection_name = "openai_vector_stores_metadata"
|
self.metadata_collection_name = "openai_vector_stores_metadata"
|
||||||
|
|
||||||
def _get_client(self) -> weaviate.Client:
|
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"
|
key = "local_test"
|
||||||
client = weaviate.connect_to_local(
|
client = weaviate.connect_to_local(
|
||||||
host=self.config.host,
|
host=host,
|
||||||
port=self.config.port,
|
port=port,
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
key = f"{self.config.weaviate_cluster_url}::{self.config.weaviate_api_key}"
|
key = f"{self.config.weaviate_cluster_url}::{self.config.weaviate_api_key}"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue