New Embed, Rerank, Chat, and Classify APIs
We’re excited to introduce improvements to our Chat, Classify, Embed, and Rerank APIs in a major version upgrade, making it easier and faster to build with Cohere. We are also releasing new versions of our Python, TypeScript, Java, and Go SDKs which feature cohere.ClientV2
for access to the new API.
New at a glance
- V2 Chat, Classify, Embed, and Rerank:
model
is a required parameter - V2 Embed:
embedding_types
is a required parameter - V2 Chat: Message and chat history are combined in a single
messages
array - V2 Chat: Tools are defined in JSON schema
- V2 Chat: Introduces
tool_call_ids
to match tool calls with tool results - V2 Chat:
documents
supports a list of strings or a list of objects with document metadata - V2 Chat streaming: Uses server-sent events
Other updates
We are simplifying the Chat API by removing support for the following parameters available in V1:
search_queries_only
, which generates only a search query given a user’s message input.search_queries_only
is not supported in the V2 Chat API today, but will be supported at a later date.connectors
, which enables users to register a data source with Cohere for RAG queries. To use the Chat V2 API with web search, see our migration guide for instructios to implement a web search tool.conversation_id
, used to manage chat history on behalf of the developer. This will not be supported in the V2 Chat API.prompt_truncation
, used to automatically rerank and remove documents if the query did not fit in the model’s context limit. This will not be supported in the V2 Chat API.force_single_step
, which forced the model to finish tool calling in one set of turns. This will not be supported in the V2 Chat API.preamble
, used for giving the model task, context, and style instructions. Use a system turn at the beginning of yourmessages
array in V2.citation_quality
, for users to select betweenfast
citations,accurate
citations (slightly higher latency than fast), or citationsoff
. In V2 Chat, we are introducing a top levelcitation_options
parameter for all citation settings.citation_quality
will be replaced by amode
parameter withincitation_options
.
See our Chat API migration guide for detailed instructions to update your implementation.
These APIs are in Beta and are subject to updates. We welcome feedback in our Discord channel.