feat:嵌入模型整改
This commit is contained in:
@@ -492,8 +492,8 @@ class CustomQdrant_VectorStore(Qdrant_VectorStore):
|
||||
request_body = {
|
||||
"model": self.embedding_model_name,
|
||||
"encoding_format": "float",
|
||||
# "input": [data],
|
||||
"sentences":[data]
|
||||
"input": [data],
|
||||
#"sentences":[data]
|
||||
}
|
||||
#硅基流动的beg3
|
||||
# request_body = {
|
||||
@@ -510,27 +510,23 @@ class CustomQdrant_VectorStore(Qdrant_VectorStore):
|
||||
# logger.info(f"request_body:{request_body}")
|
||||
request_body.update(kwargs)
|
||||
#AI中台的beg3
|
||||
response = requests.post(
|
||||
url=f"{self.embedding_api_base}",
|
||||
json=request_body,
|
||||
headers={"Authorization": f"Bearer {self.embedding_api_key}", 'Content-Type': 'application/json'},
|
||||
)
|
||||
|
||||
#硅基流动的
|
||||
# response = requests.post(
|
||||
# url=f"{self.embedding_api_base}/v1/embeddings",
|
||||
# json=request_body,
|
||||
# headers={"Authorization": f"Bearer {self.embedding_api_key}", 'Content-Type': 'application/json'},
|
||||
# )
|
||||
response = requests.post(
|
||||
url=f"{self.embedding_api_base}/v1/embeddings",
|
||||
json=request_body,
|
||||
headers={"Authorization": f"Bearer {self.embedding_api_key}", 'Content-Type': 'application/json'},
|
||||
)
|
||||
if response.status_code != 200:
|
||||
raise RuntimeError(
|
||||
f"Failed to create the embeddings, detail: {_get_error_string(response)}"
|
||||
)
|
||||
result = response.json()
|
||||
# logger.info("embedding result:{0}".format(result))
|
||||
embeddings = result['embeddings']
|
||||
# embeddings = result['data'][0]['embedding']
|
||||
return embeddings[0]
|
||||
# return embeddings
|
||||
#embeddings = result['embeddings']
|
||||
embeddings = result['data'][0]['embedding']
|
||||
#return embeddings[0]
|
||||
return embeddings
|
||||
|
||||
class CustomVanna(CustomQdrant_VectorStore, OpenAICompatibleLLM):
|
||||
def __init__(self, llm_config=None, vector_store_config=None):
|
||||
|
||||
Reference in New Issue
Block a user