Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

feat: optimize weaviate batch size (#348)

John Wang6a3ab3610113
diff --git a/api/core/vector_store/weaviate_vector_store_client.py b/api/core/vector_store/weaviate_vector_store_client.py
index ea020f951e3..f56162e000a 100644
--- a/api/core/vector_store/weaviate_vector_store_client.py
+++ b/api/core/vector_store/weaviate_vector_store_client.py
@@ -26,13 +26,25 @@ class WeaviateVectorStoreClient(BaseVectorStoreClient):
weaviate.connect.connection.has_grpc = grpc_enabled
- return weaviate.Client(
+ client = weaviate.Client(
url=endpoint,
auth_client_secret=auth_config,
timeout_config=(5, 60),
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:
index_struct = WeaviateIndexDict()