Skip to content

Latest commit

 

History

History
154 lines (126 loc) · 32.8 KB

README.md

File metadata and controls

154 lines (126 loc) · 32.8 KB

Cohere Examples

Welcome! This repository provides a collection of examples to help you build LLM-powered applications with the Cohere API. They contain step-by-step guides, with code examples and explanations, to help you understand and use the API effectively.

The examples are grouped into 3 categories:

  1. Getting started: A Cohere 101 guide. Build your first Cohere application – an onboarding assistant for new hires.
  2. LLM University: The code companion to the LLM University course containing a comprehensive list of modules.
  3. Cookbook: Deep dive into various techniques in the following topics: RAG, Agents, Search & embeddings, Summarization, and Others

Interested to contribute? Read the contributing guide.


Getting Started

This is a Cohere 101 guide. Build your first Cohere application: An onboarding assistant for new hires. Duration: ~15 mins.

Title Colab
Part 1: Installation and setup Open In Colab
Part 2: Text generation Open In Colab
Part 3: Chatbots Open In Colab
Part 4: Semantic search Open In Colab
Part 5: Reranking Open In Colab
Part 6: Retrieval-augmented generation (RAG) Open In Colab
Part 7: Agents with tool use Open In Colab

LLM University

This section contains the code companion to the LLM University course containing a comprehensive list of modules.

Module Title Colab
What are Large Language Models? Similarity Between Words and Sentences Open In Colab
Text Representation Introduction to Text Embeddings, Semantic Search, and Clustering Open In Colab
Topic Modeling Open In Colab
Few-Shot Classification Open In Colab
Fine-Tuning for Classification Open In Colab
Text Generation Building a Chatbot Open In Colab
Parameters for Controlling Outputs Open In Colab
Prompt Engineering Basics Open In Colab
Fine-Tuning for Chat Open In Colab
Deployment Deploying with Streamlit N/A
Deploying with FastAPI N/A
Deploying on Google Sheets with Google Apps Script N/A
Deploying as a Chrome Extension N/A
Semantic Search What is Semantic Search? Open In Colab
Keyword Search, Dense Retrieval, Reranking, and Generating Answers Open In Colab
Prompt Engineering Constructing Prompts Open In Colab
Use Case Patterns Open In Colab
Validating Outputs Open In Colab
Retrieval-Augmented Generation (RAG) Getting Started with RAG Open In Colab
RAG with Chat, Embed, and Rerank Open In Colab
RAG with Connectors Open In Colab
RAG with Quickstart Connectors Open In Colab
RAG over Large-Scale Data Open In Colab
Tool Use Tool Use Anatomy Open In Colab
Single-Step Tool Use Open In Colab
Multi-Step Tool Use Open In Colab
Tool Use with LangChain Open In Colab
Cohere on AWS Text generation on Bedrock Open In Colab
Semantic search on Bedrock Open In Colab
Reranking on SageMaker Open In Colab
RAG on Bedrock and SageMaker Open In Colab
Tool use on Bedrock Open In Colab
Fine-tuning on Bedrock/SageMaker Open In Colab

Cookbook

This section provides a deep dive into various techniques in the following topics:


RAG

Title Components Colab
Basic RAG Chat, Embed, Rerank Open In Colab
End-to-end RAG using Elasticsearch and Cohere Chat, Embed, Rerank, Elasticsearch Open In Colab
Chunking Strategies Chat, Embed, Rerank, LlamaIndex, LangChain Open In Colab
Migrating Monolithic Prompts to Command-R with RAG Chat Open In Colab
RAG With Chat Embed and Rerank via Pinecone Chat, Embed, Rerank, Pinecone Open In Colab
Creating a QA Bot From Technical Documentation Chat, Embed, Rerank, LlamaIndex Open In Colab
Analysis of Form 10-K/10-Q Using Cohere and RAG Cohere, Embed, Rerank, LlamaIndex, Langchain Open In Colab
Adaptive RAG Chat, LangChain Open In Colab

Agents

Title Components Colab
Basic Tool Use Chat Open In Colab
Multi-Step Tool Use Chat, Embed, LangChain Open In Colab
Calendar Agent with Native Multi Step Tool Chat Open In Colab
A Data Analyst Agent Built with Cohere and Langchain Chat, LangChain Open In Colab
Short-Term Memory Handling for Agents Chat, LangChain Open In Colab
Agent API Calls Chat, LangChain Open In Colab
Financial CSV Agent with Langchain Chat, LangChain Open In Colab
Agentic RAG for PDFs with mixed data Chat, Embed, Rerank, LangChain Open In Colab
SQL Agent Chat, LangChain Open In Colab
Financial CSV Agent with Native Multi-Step Cohere API Chat, LangChain Open In Colab
PDF Extractor with Native Multi Step Tool Use
Chat, Unstructured Open In Colab
Agentic Multi-Stage RAG with Cohere Tools API Chat, Embed Open In Colab
Agentic RAG with an Evaluator, Web Search, Human Input, and Python Tool Chat, Embed, LangChain Open In Colab

Search and Embeddings

Title Components Colab
Basic Semantic Search Embed Open In Colab
Basic Reranking Rerank Open In Colab
Wikipedia Semantic Search with Cohere Embedding Archives Embed Open In Colab
Semantic Search with Cohere Embed Jobs and Pinecone serverless Solution Embed, Pinecone Open In Colab
Semantic Search with Cohere Embed Jobs Embed, Rerank Open In Colab
Wikipedia Semantic Search with Cohere + Weaviate Embed, Weaviate Open In Colab

Summarization

Title Components Colab
Long Form General Strategies Chat, Embed, Rerank Open In Colab
Summarization Evals Chat Open In Colab
Grounded Summarization Using Command R Chat, Embed Open In Colab

Others

Title Components Colab
Advanced Document Parsing For Enterprises Chat, Embed, Rerank Open In Colab
Analyzing Hacker News with Six Language Understanding Methods Embed Open In Colab
Text Classification Using Embeddings Embed Open In Colab
Article Recommender with Text Embedding Classification Extraction Chat, Embed, Classify Open In Colab
Fueling Generative Content with Keyword Research Chat, Embed Open In Colab
Topic Modeling AI Papers Embed Open In Colab

Contributing

Thank you for your interest in contributing! We appreciate your input and encourage you to share your ideas and improvements. Here are some ways you can contribute:

  • New Examples and Guides: If you have an idea for a new example or guide, please share it with us! Create an issue to discuss your proposal, gather feedback, and get started. This ensures your contribution aligns with the project's scope and avoids duplication.

  • Improvements and Updates: You can contribute by enhancing existing examples and guides. This could involve adding more detailed explanations, code snippets, error handling, or exploring advanced usage. Your insights and expertise will make our examples more useful.

  • Feedback and Suggestions: Your feedback is invaluable. If you have suggestions for improving the structure, content, or overall user experience of this repository, please create an issue or contact us directly. We want to ensure this resource is as helpful as possible.

Please review existing issues and pull requests before starting your contribution to avoid duplication of efforts. We value your unique insights and contributions, and we want to ensure they are well-aligned with the project's goals.

Thank you for your contributions and for helping to make this repository a valuable resource for the developer community!