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)


![image](https://github.com/user-attachments/assets/2c21a69f-cd76-4d25-b320-058964812db8)

Files changed (1) hide show
  1. rag/llm/embedding_model.py +1 -1
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([d for d in res.embeddings.float]), int(
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