Skip to main content

Module cohere

Module cohere 

Source
Expand description

Parser implementations for different model formats

This module contains concrete parser implementations for various model-specific tool/function call formats. Cohere Command model tool call parser

Parses tool calls from <|START_ACTION|>...<|END_ACTION|> blocks. Supports both CMD3 and CMD4 formats.

§Format

Cohere models output tool calls in the following format:

<|START_RESPONSE|>Let me help with that.<|END_RESPONSE|>
<|START_ACTION|>
{"tool_name": "search", "parameters": {"query": "rust programming"}}
<|END_ACTION|>

Or for multiple tool calls:

<|START_ACTION|>
[
  {"tool_name": "search", "parameters": {"query": "rust"}},
  {"tool_name": "get_weather", "parameters": {"city": "Paris"}}
]
<|END_ACTION|>

§Field Mapping

  • tool_namename
  • parametersarguments

Structs§

CohereParser
Cohere Command model tool call parser