ksztone-huanggonghao
commited on
Commit
·
24b9cdf
1
Parent(s):
bf32bcf
fix: TypeError: only length-1 arrays can be converted to Python scalars (#3211)
Browse files### 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)

rag/llm/embedding_model.py
CHANGED
|
@@ -558,7 +558,7 @@ class CoHereEmbed(Base):
|
|
| 558 |
input_type="search_query",
|
| 559 |
embedding_types=["float"],
|
| 560 |
)
|
| 561 |
-
return np.array(
|
| 562 |
res.meta.billed_units.input_tokens
|
| 563 |
)
|
| 564 |
|
|
|
|
| 558 |
input_type="search_query",
|
| 559 |
embedding_types=["float"],
|
| 560 |
)
|
| 561 |
+
return np.array(res.embeddings.float[0]), int(
|
| 562 |
res.meta.billed_units.input_tokens
|
| 563 |
)
|
| 564 |
|