enhancement:support Qdrant gRPC mode (#3929)

This commit is contained in:
呆萌闷油瓶
2024-04-28 15:33:32 +08:00
committed by GitHub
parent 9d1cb1bc92
commit 0940f01634
7 changed files with 26 additions and 4 deletions

View File

@@ -36,6 +36,8 @@ class QdrantConfig(BaseModel):
api_key: Optional[str]
timeout: float = 20
root_path: Optional[str]
grpc_port: int = 6334
prefer_grpc: bool = False
def to_qdrant_params(self):
if self.endpoint and self.endpoint.startswith('path:'):
@@ -51,7 +53,9 @@ class QdrantConfig(BaseModel):
'url': self.endpoint,
'api_key': self.api_key,
'timeout': self.timeout,
'verify': self.endpoint.startswith('https')
'verify': self.endpoint.startswith('https'),
'grpc_port': self.grpc_port,
'prefer_grpc': self.prefer_grpc
}

View File

@@ -86,7 +86,9 @@ class Vector:
endpoint=config.get('QDRANT_URL'),
api_key=config.get('QDRANT_API_KEY'),
root_path=current_app.root_path,
timeout=config.get('QDRANT_CLIENT_TIMEOUT')
timeout=config.get('QDRANT_CLIENT_TIMEOUT'),
grpc_port=config.get('QDRANT_GRPC_PORT'),
prefer_grpc=config.get('QDRANT_GRPC_ENABLED')
)
)
elif vector_type == "milvus":