瀏覽代碼

feat: optimize weaviate error msg (#441)

tags/0.3.6
John Wang 2 年之前
父節點
當前提交
951afcaaed
沒有連結到貢獻者的電子郵件帳戶。
共有 1 個檔案被更改,包括 10 行新增6 行删除
  1. 10
    6
      api/core/index/vector_index/weaviate_vector_index.py

+ 10
- 6
api/core/index/vector_index/weaviate_vector_index.py 查看文件

@@ -1,5 +1,6 @@
from typing import Optional, cast

import requests
import weaviate
from langchain.embeddings.base import Embeddings
from langchain.schema import Document, BaseRetriever
@@ -34,12 +35,15 @@ class WeaviateVectorIndex(BaseVectorIndex):

weaviate.connect.connection.has_grpc = False

client = weaviate.Client(
url=config.endpoint,
auth_client_secret=auth_config,
timeout_config=(5, 60),
startup_period=None
)
try:
client = weaviate.Client(
url=config.endpoint,
auth_client_secret=auth_config,
timeout_config=(5, 60),
startup_period=None
)
except requests.exceptions.ConnectionError:
raise ConnectionError("Vector database connection error")

client.batch.configure(
# `batch_size` takes an `int` value to enable auto-batching

Loading…
取消
儲存