Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cohere-ai/notebooks
Code examples and jupyter notebooks for the Cohere Platform
https://github.com/cohere-ai/notebooks
Last synced: about 22 hours ago
JSON representation
Code examples and jupyter notebooks for the Cohere Platform
- Host: GitHub
- URL: https://github.com/cohere-ai/notebooks
- Owner: cohere-ai
- License: mit
- Created: 2021-10-06T16:51:34.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2024-12-06T16:57:56.000Z (15 days ago)
- Last Synced: 2024-12-06T17:39:30.272Z (15 days ago)
- Language: Jupyter Notebook
- Size: 65 MB
- Stars: 493
- Watchers: 17
- Forks: 134
- Open Issues: 24
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
- jimsghstars - cohere-ai/notebooks - Code examples and jupyter notebooks for the Cohere Platform (Jupyter Notebook)
README
# Cohere Examples
Welcome! This repository provides a collection of examples to help you build LLM-powered applications with the [Cohere API](https://docs.cohere.com/). 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](#getting-started)**: A Cohere 101 guide. Build your first Cohere application – an onboarding assistant for new hires.
2. **[LLM University](#llm-university)**: The code companion to the [LLM University](https://cohere.com/llmu) course containing a comprehensive list of modules.
3. **[Cookbook](#cookbook)**: Deep dive into various techniques in the following topics: [RAG](#rag), [Agents](#agents), [Search & embeddings](#search-and-embeddings), [Summarization](#summarization), and [Others](#others)Interested to contribute? Read the [contributing guide](#contributing).
# 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](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/getting-started/v2/tutorial_pt1_v2.ipynb) | |
| [Part 2: Text generation](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/getting-started/v2/tutorial_pt2_v2.ipynb) | |
| [Part 3: Chatbots](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/getting-started/v2/tutorial_pt3_v2.ipynb) | |
| [Part 4: Semantic search](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/getting-started/v2/tutorial_pt4_v2.ipynb) | |
| [Part 5: Reranking](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/getting-started/v2/tutorial_pt5_v2.ipynb) | |
| [Part 6: Retrieval-augmented generation \(RAG\)](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/getting-started/v2/tutorial_pt6_v2.ipynb) | |
| [Part 7: Agents with tool use](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/getting-started/v2/tutorial_pt7_v2.ipynb) | |
# LLM University
This section contains the code companion to the [LLM University](https://cohere.com/llmu) course containing a comprehensive list of modules.| Module | Title | Colab |
|---|---|---|
| What are Large Language Models? | [Similarity Between Words and Sentences](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/What_Is_Similarity_Between_Sentences.ipynb) | |
| Text Representation | [Introduction to Text Embeddings, Semantic Search, and Clustering](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/Introduction_Text_Embeddings.ipynb) | |
| | [Topic Modeling](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/Analyzing_Hacker_News_with_Six_Language_Understanding_Methods.ipynb) | |
| | [Few-Shot Classification](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/Classify_Endpoint.ipynb) | |
| | [Fine-Tuning for Classification](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/Fine_Tuning_for_Classify.ipynb) | |
| Text Generation | [Building a Chatbot](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/Building_a_Chatbot.ipynb) | |
| | [Parameters for Controlling Outputs](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/Parameters_for_Controlling_Outputs.ipynb) | |
| | [Prompt Engineering Basics](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/Prompt_Engineering_Basics.ipynb) | |
| | [Fine-Tuning for Chat](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/Fine_Tuning_for_Chat.ipynb) | |
| Deployment | [Deploying with Streamlit](https://github.com/cohere-ai/notebooks/tree/main/notebooks/llmu/examples/deploy_streamlit) | N/A |
| | [Deploying with FastAPI](https://github.com/cohere-ai/notebooks/tree/main/notebooks/llmu/examples/deploy_fastapi) | N/A |
| | [Deploying on Google Sheets with Google Apps Script](https://github.com/cohere-ai/notebooks/tree/main/notebooks/llmu/examples/deploy_google_apps_script) | N/A |
| | [Deploying as a Chrome Extension](https://github.com/cohere-ai/sandbox-condense) | N/A |
| Semantic Search | [What is Semantic Search?](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/What_is_Semantic_Search.ipynb) | |
| | [Keyword Search, Dense Retrieval, Reranking, and Generating Answers](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/End_To_End_Wikipedia_Search.ipynb) | |
| Prompt Engineering | [Constructing Prompts](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/Constructing_Prompt_Commands.ipynb) | |
| | [Use Case Patterns](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/Command_Model_Use_Case_Patterns.ipynb) | |
| | [Validating Outputs](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/Validating_Large_Language_Model_Outputs.ipynb) | |
| Retrieval-Augmented Generation (RAG) | [Getting Started with RAG](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/Introduction_to_RAG.ipynb) | |
| | [RAG with Chat, Embed, and Rerank](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/RAG_with_Chat_Embed_and_Rerank.ipynb) | |
| | [RAG with Connectors](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/RAG_with_Connectors.ipynb) | |
| | [RAG with Quickstart Connectors](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/RAG_with_Quickstart_Connectors.ipynb) | |
| | [RAG over Large-Scale Data](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/RAG_over_Large_Scale_Data.ipynb) | |
| Tool Use | [Tool Use Anatomy](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/tool_use_anatomy.ipynb) | |
| | [Single-Step Tool Use](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/single_step_tool_use.ipynb) | |
| | [Multi-Step Tool Use](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/multi_step_tool_use.ipynb) | |
| | [Tool Use with LangChain](https://github.com/cohere-ai/notebooks/blob/main/notebooks/agents/Data_Analyst_Agent_Cohere_and_Langchain.ipynb) | |
| Cohere on AWS | [Text generation on Bedrock](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/co_aws_ch3_text_generation.ipynb) | |
| | [Semantic search on Bedrock](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/co_aws_ch4_semantic_search.ipynb) | |
| | [Reranking on SageMaker](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/co_aws_ch5_rerank_sm.ipynb) | |
| | [RAG on Bedrock and SageMaker](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/co_aws_ch6_rag_bedrock_sm.ipynb) | |
| | [Tool use on Bedrock](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/co_aws_ch7_tool_use.ipynb) | |
| | [Fine-tuning on Bedrock/SageMaker](https://github.com/cohere-ai/notebooks/blob/main/notebooks/llmu/co_aws_ch8_ft_command.ipynb) | |
# Cookbook
This section provides a deep dive into various techniques in the following topics:
- [RAG](#rag)
- [Agents](#agents)
- [Search & embeddings](#search-and-embeddings)
- [Summarization](#summarization)
- [Others](#others)
## RAG
| Title | Components | Colab |
|--------------------------------------------------------------|----------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|
| [Basic RAG](https://github.com/cohere-ai/notebooks/blob/main/notebooks/Vanilla_RAG.ipynb) | Chat, Embed, Rerank | [](https://colab.research.google.com/github/cohere-ai/notebooks/blob/main/notebooks/Vanilla_RAG.ipynb) |
| [End-to-end RAG using Elasticsearch and Cohere](https://github.com/cohere-ai/notebooks/blob/main/notebooks/Cohere_Elastic_Guide.ipynb) | Chat, Embed, Rerank, Elasticsearch | [](https://colab.research.google.com/github/cohere-ai/notebooks/blob/main/notebooks/Cohere_Elastic_Guide.ipynb) |
| [Chunking Strategies](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/Chunking_strategies.ipynb) | Chat, Embed, Rerank, LlamaIndex, LangChain | [](https://colab.research.google.com/github/cohere-ai/notebooks/blob/main/notebooks/guides/Chunking_strategies.ipynb) |
| [Migrating Monolithic Prompts to Command-R with RAG](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/Migrating_Monolithic_Prompts_to_Command_R_with_RAG.ipynb) | Chat | [](https://colab.research.google.com/github/cohere-ai/notebooks/blob/main/notebooks/guides/Migrating_Monolithic_Prompts_to_Command_R_with_RAG.ipynb) |
| [RAG With Chat Embed and Rerank via Pinecone](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/RAG_with_Chat_Embed_and_Rerank_via_Pinecone.ipynb) | Chat, Embed, Rerank, Pinecone | [](https://colab.research.google.com/github/cohere-ai/notebooks/blob/main/notebooks/guides/RAG_with_Chat_Embed_and_Rerank_via_Pinecone.ipynb) |
| [Creating a QA Bot From Technical Documentation](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/Creating_a_QA_bot_from_technical_documentation.ipynb) | Chat, Embed, Rerank, LlamaIndex | [](https://colab.research.google.com/github/cohere-ai/notebooks/blob/main/notebooks/guides/Creating_a_QA_bot_from_technical_documentation.ipynb) |
| [Analysis of Form 10-K/10-Q Using Cohere and RAG](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/Analysis_of_Form_10_K_Using_Cohere_and_RAG.ipynb) | Cohere, Embed, Rerank, LlamaIndex, Langchain | [](https://colab.research.google.com/github/cohere-ai/notebooks/blob/main/notebooks/guides/Analysis_of_Form_10_K_Using_Cohere_and_RAG.ipynb) |
| [Adaptive RAG](https://github.com/cohere-ai/notebooks/blob/main/notebooks/agents/Multi_Step_Tool_Use.ipynb) | Chat, LangChain | [](https://colab.research.google.com/github/cohere-ai/notebooks/blob/main/notebooks/agents/Multi_Step_Tool_Use.ipynb) |## Agents
| Title | Components | Colab |
|--------------------------------------------------------------|--------------------------------|-----------------|
| [Basic Tool Use](https://github.com/cohere-ai/notebooks/blob/main/notebooks/agents/Vanilla_Tool_Use.ipynb) | Chat | |
| [Multi-Step Tool Use](https://github.com/cohere-ai/notebooks/blob/main/notebooks/agents/Vanilla_Multi_Step_Tool_Use.ipynb) | Chat, Embed, LangChain | |
| [Calendar Agent with Native Multi Step Tool](https://github.com/cohere-ai/notebooks/blob/main/notebooks/agents/Tool_Use.ipynb) | Chat | |
| [A Data Analyst Agent Built with Cohere and Langchain](https://github.com/cohere-ai/notebooks/blob/main/notebooks/agents/Data_Analyst_Agent_Cohere_and_Langchain.ipynb) | Chat, LangChain | |
| [Short-Term Memory Handling for Agents](https://github.com/cohere-ai/notebooks/blob/main/notebooks/agents/agent_memory_walkthrough.ipynb) | Chat, LangChain | |
| [Agent API Calls](https://github.com/cohere-ai/notebooks/blob/main/notebooks/agents/agents_with_deterministic_functions.ipynb) | Chat, LangChain | |
| [Financial CSV Agent with Langchain](https://github.com/cohere-ai/notebooks/blob/main/notebooks/agents/financial-csv-agent/financial_csv_publication.ipynb) | Chat, LangChain | |
| [Agentic RAG for PDFs with mixed data](https://github.com/cohere-ai/notebooks/blob/main/notebooks/agents/agentic-RAG/agentic_rag_langchain.ipynb) | Chat, Embed, Rerank, LangChain | |
| [SQL Agent](https://github.com/cohere-ai/notebooks/blob/main/notebooks/agents/sql_agent/sql_agent.ipynb) | Chat, LangChain | |
| [Financial CSV Agent with Native Multi-Step Cohere API](https://github.com/cohere-ai/notebooks/blob/main/notebooks/agents/financial-csv-agent/financial_csv_publication_native.ipynb) | Chat, LangChain | |
| [PDF Extractor with Native Multi Step Tool Use](https://github.com/cohere-ai/notebooks/blob/main/notebooks/agents/pdf-extractor/pdf_extractor.ipynb)
| Chat, Unstructured | |
| [Agentic Multi-Stage RAG with Cohere Tools API](https://github.com/cohere-ai/notebooks/blob/main/notebooks/agents/agentic-RAG/agentic_multi_stage_rag_native.ipynb) | Chat, Embed | |
| [Agentic RAG with an Evaluator, Web Search, Human Input, and Python Tool](https://github.com/cohere-ai/notebooks/blob/main/notebooks/agents/agentic-RAG/multi_purpose_agent.ipynb) | Chat, Embed, LangChain | |
## Search and Embeddings
| Title | Components | Colab |
|--------------------------------------------------------------|-----------------|------------------------------------------------------------------------|
| [Basic Semantic Search](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/Basic_Semantic_Search.ipynb) | Embed | |
| [Basic Reranking](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/rerank-demo.ipynb) | Rerank | |
| [Wikipedia Semantic Search with Cohere Embedding Archives](https://github.com/cohere-ai/notebooks/blob/main/notebooks/Wikipedia_Semantic_Search_With_Cohere_Embeddings_Archives.ipynb) | Embed | |
| [Semantic Search with Cohere Embed Jobs and Pinecone serverless Solution](https://github.com/cohere-ai/notebooks/blob/main/notebooks/Embed_Jobs_Serverless_Pinecone_Semantic_Search.ipynb) | Embed, Pinecone | |
| [Semantic Search with Cohere Embed Jobs](https://github.com/cohere-ai/notebooks/blob/main/notebooks/Embed_Jobs_Semantic_Search.ipynb) | Embed, Rerank | |
| [Wikipedia Semantic Search with Cohere + Weaviate](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/Wikipedia_search_demo_cohere_weaviate.ipynb) | Embed, Weaviate | |## Summarization
| Title | Components | Colab |
|--------------------------------------------------------------|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Long Form General Strategies](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/Long_form_General_Strategies.ipynb) | Chat, Embed, Rerank | |
| [Summarization Evals](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/Summarization_Evals.ipynb) | Chat | |
| [Grounded Summarization Using Command R](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/Grounded_summarisation_using_Command_R.ipynb) | Chat, Embed | |## Others
| Title | Components | Colab |
|--------------------------------------------------------------|-----------------------|------------------------------------------------------------------------|
| [Advanced Document Parsing For Enterprises](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/Document_Parsing_For_Enterprises.ipynb) | Chat, Embed, Rerank | |
| [Analyzing Hacker News with Six Language Understanding Methods](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/Analyzing_Hacker_News_with_Six_Language_Understanding_Methods.ipynb) | Embed | |
| [Text Classification Using Embeddings](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/Text_Classification_Using_Embeddings.ipynb) | Embed | |
| [Article Recommender with Text Embedding Classification Extraction](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/Article_Recommender_with_Text_Embedding_Classification_Extraction.ipynb) | Chat, Embed, Classify | |
| [Fueling Generative Content with Keyword Research](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/Fueling_Generative_Content_with_Keyword_Research.ipynb) | Chat, Embed | |
| [Topic Modeling AI Papers](https://github.com/cohere-ai/notebooks/blob/main/notebooks/guides/Topic_Modeling_AI_Papers.ipynb) | Embed | |
# 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!