Adapt input type parameter with MiniMax embedding model (#9342)

This commit is contained in:
ice yao 2024-10-15 09:01:00 +08:00 committed by GitHub
parent 6d2c6caa23
commit 5908fd6552
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -61,7 +61,8 @@ class MinimaxTextEmbeddingModel(TextEmbeddingModel):
url = f"{self.api_base}?GroupId={group_id}"
headers = {"Authorization": "Bearer " + api_key, "Content-Type": "application/json"}
data = {"model": "embo-01", "texts": texts, "type": "db"}
embedding_type = "db" if input_type == EmbeddingInputType.DOCUMENT else "query"
data = {"model": "embo-01", "texts": texts, "type": embedding_type}
try:
response = post(url, headers=headers, data=dumps(data))