mirror of
https://github.com/agentscope-ai/ReMe.git
synced 2026-08-28 05:25:04 +00:00
fix: support BGE-M3 embedding (dense_embedding fallback) (#169)
BGE-M3 returns dense_embedding instead of embedding; use dense_embedding as fallback when embedding is None to avoid TypeError. Made-with: Cursor Co-authored-by: AleksandrMordvinov <mad190192@gmail.com>
This commit is contained in:
parent
4f63fbf197
commit
33f6822792
1 changed files with 3 additions and 1 deletions
|
|
@ -45,7 +45,9 @@ class OpenAIEmbeddingModel(BaseEmbeddingModel):
|
|||
|
||||
result_emb = [[] for _ in range(len(input_text))]
|
||||
for emb in completion.data:
|
||||
result_emb[emb.index] = emb.embedding
|
||||
# BGE-M3 returns dense_embedding instead of embedding; use as fallback
|
||||
vec = getattr(emb, "embedding", None) or getattr(emb, "dense_embedding", None)
|
||||
result_emb[emb.index] = list(vec) if vec is not None else []
|
||||
return result_emb
|
||||
|
||||
async def start(self):
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue