You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is same as stated in the source code's comment.
However, if use accordingly, the error will be
# ImportError: cannot import name 'Cohere' from 'langchain_cohere' (/Users/user-cloaked/miniforge3/envs/langchain/lib/python3.11/site-packages/langchain_cohere/__init__.py)
According to the structure of the source code, the actual working method seems to be:
from langchain_cohere.llms import Cohere
Assume that this usage is the actual way.
There is a bug inside the llms.py
If calling the Cohere according to manual, should be something like this
model = Cohere(model="command", max_tokens=256, temperature=0.75)
However, it will generate error like this
# TypeError: langchain_cohere.llms.completion_with_retry() got multiple values for keyword argument 'model'
Because when running completion_with_retry(), self.model is provided instead of model
i.e. it didn't allow to specify any model in other words
I am not sure if it is intended to do so or just a copy and paste error, the async also have to same problem by reading the source code without running.
So the final working writing at the moment is
from langchain_cohere.llms import Cohere
model = Cohere(max_tokens=256, temperature=0.75)
# ...
The text was updated successfully, but these errors were encountered:
simongcc
changed the title
The usage shown in the source code and docs is invalid and the completion_with_retry have argument bug in llm.py (tested 0.14)
The usage shown in the source code and docs is invalid and the completion_with_retry have argument bug in llms.py (tested 0.14)
May 6, 2024
According to the Document in LangChain - Cohere
The usage for LLM is
It is same as stated in the source code's comment.
However, if use accordingly, the error will be
According to the structure of the source code, the actual working method seems to be:
Assume that this usage is the actual way.
There is a bug inside the llms.py
If calling the Cohere according to manual, should be something like this
However, it will generate error like this
Because when running
completion_with_retry()
,self.model
is provided instead ofmodel
i.e. it didn't allow to specify any model in other words
I am not sure if it is intended to do so or just a copy and paste error, the async also have to same problem by reading the source code without running.
So the final working writing at the moment is
The text was updated successfully, but these errors were encountered: