mirror of
https://git.mirrors.martin98.com/https://github.com/infiniflow/ragflow.git
synced 2025-08-14 04:55:54 +08:00
Fix gemini embedding error. (#4356)
### What problem does this PR solve? #4314 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
parent
983ec0666c
commit
b93c136797
@ -490,6 +490,7 @@ class BedrockEmbed(Base):
|
||||
|
||||
return np.array(embeddings), token_count
|
||||
|
||||
|
||||
class GeminiEmbed(Base):
|
||||
def __init__(self, key, model_name='models/text-embedding-004',
|
||||
**kwargs):
|
||||
@ -505,7 +506,7 @@ class GeminiEmbed(Base):
|
||||
for i in range(0, len(texts), batch_size):
|
||||
result = genai.embed_content(
|
||||
model=self.model_name,
|
||||
content=texts[i, i + batch_size],
|
||||
content=texts[i: i + batch_size],
|
||||
task_type="retrieval_document",
|
||||
title="Embedding of single string")
|
||||
ress.extend(result['embedding'])
|
||||
@ -519,7 +520,8 @@ class GeminiEmbed(Base):
|
||||
task_type="retrieval_document",
|
||||
title="Embedding of single string")
|
||||
token_count = num_tokens_from_string(text)
|
||||
return np.array(result['embedding']),token_count
|
||||
return np.array(result['embedding']), token_count
|
||||
|
||||
|
||||
class NvidiaEmbed(Base):
|
||||
def __init__(
|
||||
|
Loading…
x
Reference in New Issue
Block a user