langchain_cohere 0.1.4

langchain_cohere.chat_models

Classes

chat_models.ChatCohere

Implements the BaseChatModel (and BaseLanguageModel) interface with Cohere's large language models.

Functions

chat_models.get_cohere_chat_request(messages, *)

Get the request for the Cohere chat API.

chat_models.get_role(message)

Get the role of the message.

langchain_cohere.cohere_agent

Functions

cohere_agent.create_cohere_tools_agent(llm, ...)

langchain_cohere.common

Classes

common.CohereCitation(start, end, text, ...)

Cohere has fine-grained citations that specify the exact part of text.

langchain_cohere.embeddings

Classes

embeddings.CohereEmbeddings

Implements the Embeddings interface with Cohere's text representation language models.

langchain_cohere.llms

Classes

llms.BaseCohere

Base class for Cohere models.

llms.Cohere

Cohere large language models.

Functions

llms.acompletion_with_retry(llm, **kwargs)

Use tenacity to retry the completion call.

llms.completion_with_retry(llm, **kwargs)

Use tenacity to retry the completion call.

llms.enforce_stop_tokens(text, stop)

Cut off the text as soon as any stop words occur.

langchain_cohere.rag_retrievers

Classes

rag_retrievers.CohereRagRetriever

Cohere Chat API with RAG.

langchain_cohere.react_multi_hop

Classes

react_multi_hop.parsing.CohereToolsReactAgentOutputParser

Parses a message into agent actions/finish.

Functions

react_multi_hop.agent.create_cohere_react_agent(...)

Create an agent that enables multiple tools to be used in sequence to complete a task.

react_multi_hop.parsing.parse_actions(generation)

Parse action selections from model output.

react_multi_hop.parsing.parse_answer_with_prefixes(...)

parses string into key-value pairs,

react_multi_hop.parsing.parse_citations(...)

Parses a grounded_generation (from parse_actions) and documents (from convert_to_documents) into a (generation, CohereCitation list) tuple.

react_multi_hop.parsing.parse_jsonified_tool_use_generation(...)

Parses model-generated jsonified actions.

react_multi_hop.prompt.convert_to_documents(...)

Converts observations into a 'document' dict

react_multi_hop.prompt.create_directly_answer_tool()

directly_answer is a special tool that's always presented to the model as an available tool.

react_multi_hop.prompt.multi_hop_prompt(...)

The returned function produces a BasePromptTemplate suitable for multi-hop.

react_multi_hop.prompt.render_intermediate_steps(...)

Renders an agent's intermediate steps into prompt content.

react_multi_hop.prompt.render_messages(messages)

Renders one or more BaseMessage implementations into prompt content.

react_multi_hop.prompt.render_observations(...)

Renders the 'output' part of an Agent's intermediate step into prompt content.

react_multi_hop.prompt.render_role(message)

Renders the role of a message into prompt content.

react_multi_hop.prompt.render_structured_preamble([...])

Renders the structured preamble part of the prompt content.

react_multi_hop.prompt.render_tool(tool)

Renders a tool into prompt content

react_multi_hop.prompt.render_tool_args(tool)

Renders the 'Args' section of a tool's prompt content.

react_multi_hop.prompt.render_tool_signature(tool)

Renders the signature of a tool into prompt content.

react_multi_hop.prompt.render_type(type_, ...)

Renders a tool's type into prompt content.

langchain_cohere.rerank

Classes

rerank.CohereRerank

Document compressor that uses Cohere Rerank API.