VietCat commited on
Commit
aa8cb73
·
1 Parent(s): 486e166

fix metadata

Browse files
Files changed (1) hide show
  1. app/embedding.py +3 -3
app/embedding.py CHANGED
@@ -23,7 +23,7 @@ class EmbeddingClient:
23
  logger.info(f"[EMBEDDING] Initialized with provider={self.provider}, model={self.model}")
24
 
25
  @timing_decorator_async
26
- async def create_embedding(self, text: str) -> List[float]:
27
  """
28
  Tạo embedding vector từ text bằng dịch vụ embedding (ví dụ OpenAI hoặc Gemini).
29
  Input: text (str)
@@ -39,8 +39,8 @@ class EmbeddingClient:
39
  gemini_client = self.gemini_client # type: ignore
40
 
41
  # Luôn sử dụng model từ config, không phụ thuộc vào key/model từ RequestLimitManager
42
- logger.info(f"[EMBEDDING] Creating embedding with model={self.model}")
43
- embedding = await loop.run_in_executor(None, lambda: gemini_client.create_embedding(text, model=self.model))
44
 
45
  # Kiểm tra kiểu dữ liệu trả về
46
  if isinstance(embedding, list):
 
23
  logger.info(f"[EMBEDDING] Initialized with provider={self.provider}, model={self.model}")
24
 
25
  @timing_decorator_async
26
+ async def create_embedding(self, text: str, task_type: str = "retrieval_query") -> List[float]:
27
  """
28
  Tạo embedding vector từ text bằng dịch vụ embedding (ví dụ OpenAI hoặc Gemini).
29
  Input: text (str)
 
39
  gemini_client = self.gemini_client # type: ignore
40
 
41
  # Luôn sử dụng model từ config, không phụ thuộc vào key/model từ RequestLimitManager
42
+ logger.info(f"[EMBEDDING] Creating embedding with model={self.model}, task_type={task_type}")
43
+ embedding = await loop.run_in_executor(None, lambda: gemini_client.create_embedding(text, model=self.model, task_type=task_type))
44
 
45
  # Kiểm tra kiểu dữ liệu trả về
46
  if isinstance(embedding, list):