Welcome to the Cohere Cookbook! This repository provides a collection of examples to help you get started with the Cohere API. These examples contain step-by-step guides, with code examples and explanations, to help you understand and use the API effectively.
The cookbook is grouped into two categories. To get started, go to any of the categories below.
Category | Description |
---|---|
Guides | Tutorials and step-by-step guides covering a range of topics, providing practical guidance and code examples. |
LLM University | Guides for getting started with Cohere, starting with basic usage and progressing to advanced topics. The code companion to the full LLM University course. |
Agents | Walkthrough of how to build agents with Cohere, starting with basic tool use and progressing to advanced agentic RAG examples. |
If you are looking for a quick tour of the Cohere API, the following notebooks will help you get up and running.
-
Text Generation: Get started with the Command R+ model by building a chatbot using Cohere’s Chat endpoint. Build a chatbot that can respond to user messages and maintain the context of the conversation.
-
Text Embeddings: Get started with the Embed model by generating text embeddings for a dataset. Observe graphically the relationships between documents and explore how to leverage embeddings for semantic search and clustering.
-
Retrieval-Augmented Generation: Build a RAG-powered chatbot that can extract relevant information from external documents and produce verifiable, inline citations in its responses. This leverages the Chat endpoint as well as the Embed v3 and Rerank 3 models.
-
Multi-Step Tool Use: Multi-step tool use allows an LLM to call more than one tool in a sequence of steps, using the results from one tool call in a subsequent step. In this example, build a simple data analyst agent that is able to search the web and run code in a Python interpreter. This agent uses Cohere's Command R+ model and Langchain.
-
Tool Use: Tool use allows you to connect LLMs to external tools like search engines, APIs, functions, databases, etc. In this example, build an assistant that that can query sales reports and a product catalog and provide its analysis.