feat:embeding改成支持电信模型
This commit is contained in:
		
							
								
								
									
										4
									
								
								.env
									
									
									
									
									
								
							
							
						
						
									
										4
									
								
								.env
									
									
									
									
									
								
							| @@ -3,8 +3,8 @@ IS_FIRST_LOAD=True | ||||
| CHAT_MODEL_BASE_URL=https://api.siliconflow.cn | ||||
| CHAT_MODEL_API_KEY=sk-iyhiltycmrfnhrnbljsgqjrinhbztwdplyvuhfihcdlepole | ||||
| CHAT_MODEL_NAME=zai-org/GLM-4.5 | ||||
|  | ||||
| EMBEDDING_MODEL_BASE_URL=https://api.siliconflow.cn | ||||
| #使用ai中台的模型 | ||||
| EMBEDDING_MODEL_BASE_URL=http://10.225.128.2:13206/member1/small-model/bge/encode | ||||
| EMBEDDING_MODEL_API_KEY=sk-iyhiltycmrfnhrnbljsgqjrinhbztwdplyvuhfihcdlepole | ||||
| EMBEDDING_MODEL_NAME=BAAI/bge-m3 | ||||
|  | ||||
|   | ||||
| @@ -270,21 +270,21 @@ class CustomQdrant_VectorStore(Qdrant_VectorStore): | ||||
|  | ||||
|         request_body = { | ||||
|             "model": self.embedding_model_name, | ||||
|             "input": data, | ||||
|             "sentences": [data], | ||||
|         } | ||||
|         request_body.update(kwargs) | ||||
|  | ||||
|         response = requests.post( | ||||
|             url=f"{self.embedding_api_base}/v1/embeddings", | ||||
|             url=f"{self.embedding_api_base}", | ||||
|             json=request_body, | ||||
|             headers={"Authorization": f"Bearer {self.embedding_api_key}"}, | ||||
|             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() | ||||
|         embeddings = [d["embedding"] for d in result["data"]] | ||||
|         embeddings = result['embeddings'] | ||||
|         return embeddings[0] | ||||
|  | ||||
| class CustomVanna(CustomQdrant_VectorStore, OpenAICompatibleLLM): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 雷雨
					雷雨