Skip to content

Commit

Permalink
fix: TypeError: only length-1 arrays can be converted to Python scala…
Browse files Browse the repository at this point in the history
…rs (infiniflow#3211)

### What problem does this PR solve?
fix "TypeError: only length-1 arrays can be converted to Python scalars"
while using cohere embedding model.

### Type of change

- [ ] Bug Fix (non-breaking change which fixes an issue)


![image](https://github.com/user-attachments/assets/2c21a69f-cd76-4d25-b320-058964812db8)
  • Loading branch information
ksztone-huanggonghao authored and jhaiq committed Nov 30, 2024
1 parent 8b5b188 commit 5355ae5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion rag/llm/embedding_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ def encode_queries(self, text):
input_type="search_query",
embedding_types=["float"],
)
return np.array([d for d in res.embeddings.float]), int(
return np.array(res.embeddings.float[0]), int(
res.meta.billed_units.input_tokens
)

Expand Down

0 comments on commit 5355ae5

Please sign in to comment.