mirror of
https://github.com/langgenius/dify.git
synced 2026-04-05 20:22:39 +08:00
feat: optimize weaviate batch size (#348)
This commit is contained in:
@@ -26,13 +26,25 @@ class WeaviateVectorStoreClient(BaseVectorStoreClient):
|
|||||||
|
|
||||||
weaviate.connect.connection.has_grpc = grpc_enabled
|
weaviate.connect.connection.has_grpc = grpc_enabled
|
||||||
|
|
||||||
return weaviate.Client(
|
client = weaviate.Client(
|
||||||
url=endpoint,
|
url=endpoint,
|
||||||
auth_client_secret=auth_config,
|
auth_client_secret=auth_config,
|
||||||
timeout_config=(5, 60),
|
timeout_config=(5, 60),
|
||||||
startup_period=None
|
startup_period=None
|
||||||
)
|
)
|
||||||
|
|
||||||
|
client.batch.configure(
|
||||||
|
# `batch_size` takes an `int` value to enable auto-batching
|
||||||
|
# (`None` is used for manual batching)
|
||||||
|
batch_size=100,
|
||||||
|
# dynamically update the `batch_size` based on import speed
|
||||||
|
dynamic=True,
|
||||||
|
# `timeout_retries` takes an `int` value to retry on time outs
|
||||||
|
timeout_retries=3,
|
||||||
|
)
|
||||||
|
|
||||||
|
return client
|
||||||
|
|
||||||
def get_index(self, service_context: ServiceContext, config: dict) -> GPTVectorStoreIndex:
|
def get_index(self, service_context: ServiceContext, config: dict) -> GPTVectorStoreIndex:
|
||||||
index_struct = WeaviateIndexDict()
|
index_struct = WeaviateIndexDict()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user