fix: TypeError: only length-1 arrays can be converted to Python scalars (#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)
This commit is contained in:
ksztone-huanggonghao 2024-11-06 11:15:00 +08:00 committed by GitHub
parent 601a128cd3
commit 0dff64f6ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -558,7 +558,7 @@ class CoHereEmbed(Base):
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
)