mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 09:53:45 +00:00
Fixed pre commit
This commit is contained in:
parent
7034637cac
commit
df23e0c32f
8 changed files with 28 additions and 14 deletions
|
|
@ -89,15 +89,15 @@ See [Elasticsearch's documentation](https://www.elastic.co/docs/solutions/search
|
||||||
|
|
||||||
| Field | Type | Required | Default | Description |
|
| Field | Type | Required | Default | Description |
|
||||||
|-------|------|----------|---------|-------------|
|
|-------|------|----------|---------|-------------|
|
||||||
| `api_key` | `str \| None` | No | | The API key for the Elasticsearch instance |
|
| `elasticsearch_api_key` | `str \| None` | No | | The API key for the Elasticsearch instance |
|
||||||
| `hosts` | `str \| None` | No | localhost:9200 | The URL of the Elasticsearch instance |
|
| `elasticsearch_url` | `str \| None` | No | localhost:9200 | The URL of the Elasticsearch instance |
|
||||||
| `persistence` | `llama_stack.core.storage.datatypes.KVStoreReference \| None` | No | | Config for KV store backend (SQLite only for now) |
|
| `persistence` | `KVStoreReference \| None` | No | | Config for KV store backend (SQLite only for now) |
|
||||||
|
|
||||||
## Sample Configuration
|
## Sample Configuration
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
hosts: ${env.ELASTICSEARCH_API_KEY:=None}
|
elasticsearch_url: ${env.ELASTICSEARCH_URL:=localhost:9200}
|
||||||
api_key: ${env.ELASTICSEARCH_URL:=localhost:9200}
|
elasticsearch_api_key: ${env.ELASTICSEARCH_API_KEY:=}
|
||||||
persistence:
|
persistence:
|
||||||
namespace: vector_io::elasticsearch
|
namespace: vector_io::elasticsearch
|
||||||
backend: kv_default
|
backend: kv_default
|
||||||
|
|
|
||||||
|
|
@ -146,6 +146,14 @@ providers:
|
||||||
persistence:
|
persistence:
|
||||||
namespace: vector_io::weaviate
|
namespace: vector_io::weaviate
|
||||||
backend: kv_default
|
backend: kv_default
|
||||||
|
- provider_id: ${env.ELASTICSEARCH_URL:+elasticsearch}
|
||||||
|
provider_type: remote::elasticsearch
|
||||||
|
config:
|
||||||
|
elasticsearch_url: ${env.ELASTICSEARCH_URL:=localhost:9200}
|
||||||
|
elasticsearch_api_key: ${env.ELASTICSEARCH_API_KEY:=}
|
||||||
|
persistence:
|
||||||
|
namespace: vector_io::elasticsearch
|
||||||
|
backend: kv_default
|
||||||
files:
|
files:
|
||||||
- provider_id: meta-reference-files
|
- provider_id: meta-reference-files
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
|
|
|
||||||
|
|
@ -146,6 +146,14 @@ providers:
|
||||||
persistence:
|
persistence:
|
||||||
namespace: vector_io::weaviate
|
namespace: vector_io::weaviate
|
||||||
backend: kv_default
|
backend: kv_default
|
||||||
|
- provider_id: ${env.ELASTICSEARCH_URL:+elasticsearch}
|
||||||
|
provider_type: remote::elasticsearch
|
||||||
|
config:
|
||||||
|
elasticsearch_url: ${env.ELASTICSEARCH_URL:=localhost:9200}
|
||||||
|
elasticsearch_api_key: ${env.ELASTICSEARCH_API_KEY:=}
|
||||||
|
persistence:
|
||||||
|
namespace: vector_io::elasticsearch
|
||||||
|
backend: kv_default
|
||||||
files:
|
files:
|
||||||
- provider_id: meta-reference-files
|
- provider_id: meta-reference-files
|
||||||
provider_type: inline::localfs
|
provider_type: inline::localfs
|
||||||
|
|
|
||||||
|
|
@ -149,8 +149,8 @@ providers:
|
||||||
- provider_id: ${env.ELASTICSEARCH_URL:+elasticsearch}
|
- provider_id: ${env.ELASTICSEARCH_URL:+elasticsearch}
|
||||||
provider_type: remote::elasticsearch
|
provider_type: remote::elasticsearch
|
||||||
config:
|
config:
|
||||||
elasticsearch_api_key: ${env.ELASTICSEARCH_API_KEY:=}
|
|
||||||
elasticsearch_url: ${env.ELASTICSEARCH_URL:=localhost:9200}
|
elasticsearch_url: ${env.ELASTICSEARCH_URL:=localhost:9200}
|
||||||
|
elasticsearch_api_key: ${env.ELASTICSEARCH_API_KEY:=}
|
||||||
persistence:
|
persistence:
|
||||||
namespace: vector_io::elasticsearch
|
namespace: vector_io::elasticsearch
|
||||||
backend: kv_default
|
backend: kv_default
|
||||||
|
|
|
||||||
|
|
@ -149,8 +149,8 @@ providers:
|
||||||
- provider_id: ${env.ELASTICSEARCH_URL:+elasticsearch}
|
- provider_id: ${env.ELASTICSEARCH_URL:+elasticsearch}
|
||||||
provider_type: remote::elasticsearch
|
provider_type: remote::elasticsearch
|
||||||
config:
|
config:
|
||||||
elasticsearch_api_key: ${env.ELASTICSEARCH_API_KEY:=}
|
|
||||||
elasticsearch_url: ${env.ELASTICSEARCH_URL:=localhost:9200}
|
elasticsearch_url: ${env.ELASTICSEARCH_URL:=localhost:9200}
|
||||||
|
elasticsearch_api_key: ${env.ELASTICSEARCH_API_KEY:=}
|
||||||
persistence:
|
persistence:
|
||||||
namespace: vector_io::elasticsearch
|
namespace: vector_io::elasticsearch
|
||||||
backend: kv_default
|
backend: kv_default
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
# This source code is licensed under the terms described in the LICENSE file in
|
# This source code is licensed under the terms described in the LICENSE file in
|
||||||
# the root directory of this source tree.
|
# the root directory of this source tree.
|
||||||
|
|
||||||
from llama_stack.providers.datatypes import Api, ProviderSpec
|
from llama_stack_api import Api, ProviderSpec
|
||||||
|
|
||||||
from .config import ElasticsearchVectorIOConfig
|
from .config import ElasticsearchVectorIOConfig
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ from typing import Any
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
|
|
||||||
from llama_stack.core.storage.datatypes import KVStoreReference
|
from llama_stack.core.storage.datatypes import KVStoreReference
|
||||||
from llama_stack.schema_utils import json_schema_type
|
from llama_stack_api import json_schema_type
|
||||||
|
|
||||||
|
|
||||||
@json_schema_type
|
@json_schema_type
|
||||||
|
|
|
||||||
|
|
@ -229,6 +229,7 @@ class ElasticsearchIndex(EmbeddingIndex):
|
||||||
log.error(f"Error deleting Elasticsearch index {self.collection_name}: {e}")
|
log.error(f"Error deleting Elasticsearch index {self.collection_name}: {e}")
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
class ElasticsearchVectorIOAdapter(OpenAIVectorStoreMixin, VectorIO, VectorStoresProtocolPrivate):
|
class ElasticsearchVectorIOAdapter(OpenAIVectorStoreMixin, VectorIO, VectorStoresProtocolPrivate):
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
|
@ -244,10 +245,7 @@ class ElasticsearchVectorIOAdapter(OpenAIVectorStoreMixin, VectorIO, VectorStore
|
||||||
self.vector_store_table = None
|
self.vector_store_table = None
|
||||||
|
|
||||||
async def initialize(self) -> None:
|
async def initialize(self) -> None:
|
||||||
self.client = AsyncElasticsearch(
|
self.client = AsyncElasticsearch(hosts=self.config.elasticsearch_url, api_key=self.config.elasticsearch_api_key)
|
||||||
hosts=self.config.elasticsearch_url,
|
|
||||||
api_key=self.config.elasticsearch_api_key
|
|
||||||
)
|
|
||||||
self.kvstore = await kvstore_impl(self.config.persistence)
|
self.kvstore = await kvstore_impl(self.config.persistence)
|
||||||
|
|
||||||
start_key = VECTOR_DBS_PREFIX
|
start_key = VECTOR_DBS_PREFIX
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue