langchain.ChatCohereDataset
kedro_datasets_experimental.langchain.ChatCohereDataset ¶
ChatCohereDataset(credentials, kwargs=None)
Bases: AbstractDataset[None, ChatCohere]
ChatCohereDataset loads a ChatCohere langchain model.
Example usage for the YAML API¶
catalog.yml
command:
type: langchain.ChatCohereDataset
kwargs:
model: "command"
temperature: 0.0
credentials: cohere
credentials.yml
cohere:
cohere_api_url: <cohere-api-base>
cohere_api_key: <cohere-api-key>
Example usage for the Python API¶
from kedro_datasets_experimental.langchain import ChatCohereDataset
llm = ChatCohereDataset(
credentials={
"cohere_api_key": "xxx",
"cohere_api_url": "xxx",
},
kwargs={
"model": "command",
"temperature": 0.0,
},
).load()
# See: https://python.langchain.com/v0.1/docs/integrations/chat/cohere/
llm.invoke("Hello world!")
Parameters:
-
credentials(dict[str, str]) –must contain
cohere_api_urlandcohere_api_key. -
kwargs(dict[str, Any], default:None) –keyword arguments passed to the underlying constructor.
Source code in kedro-datasets/kedro_datasets_experimental/langchain/_cohere.py
58 59 60 61 62 63 64 65 66 67 | |
_describe ¶
_describe()
Source code in kedro-datasets/kedro_datasets_experimental/langchain/_cohere.py
69 70 | |
load ¶
load()
Source code in kedro-datasets/kedro_datasets_experimental/langchain/_cohere.py
75 76 | |
save ¶
save(data)
Source code in kedro-datasets/kedro_datasets_experimental/langchain/_cohere.py
72 73 | |