langchain-cohere: 0.3.4#
chains#
Functions
|
Create prompt for this agent. :param system_message: Message to use as the system message that will be the first in the prompt. :param extra_prompt_messages: Prompt messages that will be placed between the system message and the new human input. |
chat_models#
Classes
Implements the BaseChatModel (and BaseLanguageModel) interface with Cohere's large language models. |
Functions
|
Get the request for the Cohere chat API. |
|
Get the role of the message. |
common#
Classes
|
Cohere has fine-grained citations that specify the exact part of text. |
csv_agent#
Functions
|
|
|
Create csv agent with the specified language model. |
Create prompt for this agent. |
|
Returns a tool that will execute python code and return the output. |
embeddings#
Classes
Implements the Embeddings interface with Cohere's text representation language models. |
llms#
Classes
Base class for Cohere models. |
|
Cohere large language models. |
Functions
|
Use tenacity to retry the completion call. |
|
Use tenacity to retry the completion call. |
|
Cut off the text as soon as any stop words occur. |
rag_retrievers#
Classes
Cohere Chat API with RAG. |
react_multi_hop#
Classes
Parses a message into agent actions/finish. |
Functions
Create an agent that enables multiple tools to be used in sequence to complete a task. |
|
|
Parse action selections from model output. |
parses string into key-value pairs, |
|
Parses a grounded_generation (from parse_actions) and documents (from convert_to_documents) into a (generation, CohereCitation list) tuple. |
|
|
Parses model-generated jsonified actions. |
Converts observations into a 'document' dict |
|
directly_answer is a special tool that's always presented to the model as an available tool. |
|
The returned function produces a BasePromptTemplate suitable for multi-hop. |
|
Renders an agent's intermediate steps into prompt content. |
|
|
Renders one or more BaseMessage implementations into prompt content. |
Renders the 'output' part of an Agent's intermediate step into prompt content. |
|
|
Renders the role of a message into prompt content. |
Renders the structured preamble part of the prompt content. |
|
|
Renders a tool into prompt content. Either a BaseTool instance, or, a JSON |
rerank#
Classes
Document compressor that uses Cohere Rerank API. |
sql_agent#
Functions
|
Construct a SQL agent from an LLM and toolkit or database. |