Traceback (most recent call last):
File "", line 6, in
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/langchain_cohere/embeddings.py", line 173, in embed_query
return self.embed([text], input_type="search_query")[0]
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/langchain_cohere/embeddings.py", line 118, in embed
embeddings = self.embed_with_retry(
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/langchain_cohere/embeddings.py", line 100, in embed_with_retry
return _embed_with_retry(kwargs)
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/tenacity/init.py", line 330, in wrapped_f
return self(f, *args, *kw)
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/tenacity/init.py", line 467, in call
do = self.iter(retry_state=retry_state)
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/tenacity/init.py", line 368, in iter
result = action(retry_state)
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/tenacity/init.py", line 410, in exc_check
raise retry_exc.reraise()
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/tenacity/init.py", line 183, in reraise
raise self.last_attempt.result()
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/concurrent/futures/_base.py", line 451, in result
return self.get_result()
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/concurrent/futures/_base.py", line 403, in get_result
raise self._exception
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/tenacity/init.py", line 470, in call
result = fn(args, kwargs)
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/langchain_cohere/embeddings.py", line 98, in _embed_with_retry
return self.client.embed(*kwargs)
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/cohere/client.py", line 137, in embed
responses = [
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/cohere/client.py", line 137, in
responses = [
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/concurrent/futures/_base.py", line 621, in result_iterator
yield _result_or_cancel(fs.pop())
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/concurrent/futures/_base.py", line 319, in _result_or_cancel
return fut.result(timeout)
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/concurrent/futures/_base.py", line 458, in result
return self.get_result()
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/concurrent/futures/_base.py", line 403, in get_result
raise self._exception
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn(self.args, self.kwargs)
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/cohere/client.py", line 140, in
lambda text_batch: BaseCohere.embed(
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/cohere/base_client.py", line 1446, in embed
typing.cast(typing.Any, constructtype(type=typing.Any, object_=_response.json())) # type: ignore
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/httpx/_models.py", line 764, in json
return jsonlib.loads(self.content, kwargs)
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Tried this code from the documentation example
from langchain_cohere.embeddings import CohereEmbeddings
cohere_embeddings = CohereEmbeddings(model="embed-english-light-v3.0") text = "This is a test document."
query_result = cohere_embeddings.embed_query(text) print(query_result)
doc_result = cohere_embeddings.embed_documents([text]) print(doc_result)
And got the following error
Traceback (most recent call last): File "", line 6, in
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/langchain_cohere/embeddings.py", line 173, in embed_query
return self.embed([text], input_type="search_query")[0]
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/langchain_cohere/embeddings.py", line 118, in embed
embeddings = self.embed_with_retry(
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/langchain_cohere/embeddings.py", line 100, in embed_with_retry
return _embed_with_retry(kwargs)
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/tenacity/init.py", line 330, in wrapped_f
return self(f, *args, *kw)
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/tenacity/init.py", line 467, in call
do = self.iter(retry_state=retry_state)
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/tenacity/init.py", line 368, in iter
result = action(retry_state)
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/tenacity/init.py", line 410, in exc_check
raise retry_exc.reraise()
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/tenacity/init.py", line 183, in reraise
raise self.last_attempt.result()
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/concurrent/futures/_base.py", line 451, in result
return self.get_result()
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/concurrent/futures/_base.py", line 403, in get_result
raise self._exception
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/tenacity/init.py", line 470, in call
result = fn(args, kwargs)
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/langchain_cohere/embeddings.py", line 98, in _embed_with_retry
return self.client.embed(*kwargs)
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/cohere/client.py", line 137, in embed
responses = [
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/cohere/client.py", line 137, in
responses = [
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/concurrent/futures/_base.py", line 621, in result_iterator
yield _result_or_cancel(fs.pop())
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/concurrent/futures/_base.py", line 319, in _result_or_cancel
return fut.result(timeout)
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/concurrent/futures/_base.py", line 458, in result
return self.get_result()
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/concurrent/futures/_base.py", line 403, in get_result
raise self._exception
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/concurrent/futures/thread.py", line 58, in run
result = self.fn( self.args, self.kwargs)
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/cohere/client.py", line 140, in
lambda text_batch: BaseCohere.embed(
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/cohere/base_client.py", line 1446, in embed
typing.cast(typing.Any, constructtype(type=typing.Any, object_=_response.json())) # type: ignore
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/site-packages/httpx/_models.py", line 764, in json
return jsonlib.loads(self.content, kwargs)
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/json/init.py", line 346, in loads
return _default_decoder.decode(s)
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/home/kolyan288/anaconda3/envs/Global/lib/python3.10/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
My dependencies
langchain==0.2.1 langchain-chroma==0.1.1 langchain-cli==0.0.24 langchain-cohere==0.1.8 langchain-community==0.2.1 langchain-core==0.2.3 langchain-experimental==0.0.59 langchain-huggingface==0.0.1 langchain-openai==0.1.8 langchain-text-splitters==0.2.0
platform: linux mint 21.1
python version: 3.10.14