mirror of
http://112.124.100.131/huang.ze/ebiz-dify-ai.git
synced 2025-12-09 10:56:52 +08:00
feat: add WEAVIATE_BATCH_SIZE (#349)
This commit is contained in:
@@ -27,7 +27,8 @@ class VectorStore:
|
||||
self._client = WeaviateVectorStoreClient(
|
||||
endpoint=app.config['WEAVIATE_ENDPOINT'],
|
||||
api_key=app.config['WEAVIATE_API_KEY'],
|
||||
grpc_enabled=app.config['WEAVIATE_GRPC_ENABLED']
|
||||
grpc_enabled=app.config['WEAVIATE_GRPC_ENABLED'],
|
||||
batch_size=app.config['WEAVIATE_BATCH_SIZE']
|
||||
)
|
||||
elif self._vector_store == 'qdrant':
|
||||
self._client = QdrantVectorStoreClient(
|
||||
|
||||
@@ -18,10 +18,10 @@ from llama_index.readers.weaviate.utils import (
|
||||
|
||||
class WeaviateVectorStoreClient(BaseVectorStoreClient):
|
||||
|
||||
def __init__(self, endpoint: str, api_key: str, grpc_enabled: bool):
|
||||
self._client = self.init_from_config(endpoint, api_key, grpc_enabled)
|
||||
def __init__(self, endpoint: str, api_key: str, grpc_enabled: bool, batch_size: int):
|
||||
self._client = self.init_from_config(endpoint, api_key, grpc_enabled, batch_size)
|
||||
|
||||
def init_from_config(self, endpoint: str, api_key: str, grpc_enabled: bool):
|
||||
def init_from_config(self, endpoint: str, api_key: str, grpc_enabled: bool, batch_size: int):
|
||||
auth_config = weaviate.auth.AuthApiKey(api_key=api_key)
|
||||
|
||||
weaviate.connect.connection.has_grpc = grpc_enabled
|
||||
@@ -36,7 +36,7 @@ class WeaviateVectorStoreClient(BaseVectorStoreClient):
|
||||
client.batch.configure(
|
||||
# `batch_size` takes an `int` value to enable auto-batching
|
||||
# (`None` is used for manual batching)
|
||||
batch_size=100,
|
||||
batch_size=batch_size,
|
||||
# dynamically update the `batch_size` based on import speed
|
||||
dynamic=True,
|
||||
# `timeout_retries` takes an `int` value to retry on time outs
|
||||
|
||||
Reference in New Issue
Block a user