This commit is contained in:
Habeb Nawatha 2025-09-24 09:30:04 +02:00 committed by GitHub
commit d483239cd7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 12 additions and 19 deletions

View file

@ -17091,14 +17091,14 @@
"type": "string",
"description": "The embedding model to use."
},
"embedding_dimension": {
"type": "integer",
"description": "The dimension of the embedding model."
},
"provider_id": {
"type": "string",
"description": "The identifier of the provider."
},
"embedding_dimension": {
"type": "integer",
"description": "The dimension of the embedding model."
},
"vector_db_name": {
"type": "string",
"description": "The name of the vector database."
@ -17111,7 +17111,8 @@
"additionalProperties": false,
"required": [
"vector_db_id",
"embedding_model"
"embedding_model",
"provider_id"
],
"title": "RegisterVectorDbRequest"
},

View file

@ -12708,12 +12708,12 @@ components:
embedding_model:
type: string
description: The embedding model to use.
embedding_dimension:
type: integer
description: The dimension of the embedding model.
provider_id:
type: string
description: The identifier of the provider.
embedding_dimension:
type: integer
description: The dimension of the embedding model.
vector_db_name:
type: string
description: The name of the vector database.
@ -12725,6 +12725,7 @@ components:
required:
- vector_db_id
- embedding_model
- provider_id
title: RegisterVectorDbRequest
RerankRequest:
type: object

View file

@ -90,8 +90,8 @@ class VectorDBs(Protocol):
self,
vector_db_id: str,
embedding_model: str,
provider_id: str,
embedding_dimension: int | None = 384,
provider_id: str | None = None,
vector_db_name: str | None = None,
provider_vector_db_id: str | None = None,
) -> VectorDB:

View file

@ -47,20 +47,11 @@ class VectorDBsRoutingTable(CommonRoutingTableImpl, VectorDBs):
self,
vector_db_id: str,
embedding_model: str,
provider_id: str,
embedding_dimension: int | None = 384,
provider_id: str | None = None,
provider_vector_db_id: str | None = None,
vector_db_name: str | None = None,
) -> VectorDB:
if provider_id is None:
if len(self.impls_by_provider_id) > 0:
provider_id = list(self.impls_by_provider_id.keys())[0]
if len(self.impls_by_provider_id) > 1:
logger.warning(
f"No provider specified and multiple providers available. Arbitrarily selected the first provider {provider_id}."
)
else:
raise ValueError("No provider available. Please configure a vector_io provider.")
model = await lookup_model(self, embedding_model)
if model is None:
raise ModelNotFoundError(embedding_model)