Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add v2 docs #213

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open

Add v2 docs #213

wants to merge 7 commits into from

Conversation

mrmer1
Copy link
Contributor

@mrmer1 mrmer1 commented Sep 4, 2024

This PR introduces a new tutorial for the Cohere platform, which is a hands-on introduction to the Cohere API. The tutorial is split into seven parts, each focusing on a specific use case:

  • Installation and Setup
  • Text Generation
  • Chatbots
  • Semantic Search
  • Reranking
  • Retrieval-Augmented Generation (RAG)
  • Agents with Tool Use

The tutorial uses a fictional company called Co1t to demonstrate the use cases. It recommends following the parts sequentially, but each part can also work as a standalone tutorial.

The tutorial starts by introducing the Cohere platform, which allows developers to access large language model (LLM) capabilities with a few lines of code. It covers the installation of the Cohere Python SDK and the creation of a client using the Cohere API key. It also provides information on accessing Cohere from other platforms, such as Amazon Bedrock, Amazon SageMaker, Microsoft Azure, and Oracle Cloud Infrastructure (OCI) Generative AI Service.

The tutorial then moves on to the first use case, text generation, which is performed using the Chat endpoint. It covers basic text generation, prompt engineering, parameters for controlling output, structured output generation, and streamed output.

The next use case is chatbots, which are built using the Chat endpoint. The tutorial covers creating a custom preamble, creating a single-turn conversation, building the conversation memory, running a multi-turn conversation, and viewing the chat history.

The third use case is semantic search, which is performed using the Embed endpoint. The tutorial covers embedding documents, embedding queries, performing semantic search, multilingual semantic search, and changing embedding compression types.

The fourth use case is reranking, which is performed using the Rerank endpoint. The tutorial covers reranking lexical/semantic search results, reranking semi-structured data, reranking tabular data, and multilingual reranking.

The fifth use case is RAG, which combines the strengths of pre-trained language models with the ability to retrieve information from a large corpus of documents. The tutorial covers basic RAG, search query generation, retrieval with Embed, and response and citation generation.

The sixth use case is tool use, which extends the ideas from RAG by leveraging a much bigger set of tools. The tutorial covers creating tools, tool planning and calling, tool execution, response and citation generation, and multi-step tool use.

The tutorial concludes with a summary of the use cases covered and provides further resources for learning, including LLM University, Cookbooks, Cohere's documentation, and the Cohere API reference.

Copy link

@trentfowlercohere trentfowlercohere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a few comments, but this looks good to me.

"source": [
"import cohere, json\n",
"API_KEY = \"...\" # fill in your Cohere API key here\n",
"co = cohere.Client(API_KEY)"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mrmer1 Should it not be the V2 client?

"import cohere\n",
"import os\n",
"import json\n",
"co = cohere.ClientV2(os.getenv(\"COHERE_API_KEY\"))"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, there's one down here. Why is this duplicated?

"- `top_n`: The top reranked documents to select\n",
"- `model`: We choose Rerank English 3\n",
"\n",
"Looking at the results, we see that the given a query about getting to know the team, the document that talks about joining Slack channels is now ranked higher (1st) compared to earlier (3rd).\n",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a typo, how about:
"Looking at the results, we see that since the query is about getting to know the team, the document..."

"cell_type": "markdown",
"metadata": {},
"source": [
"Finally we reach the step that we saw in the earlier `Basic RAG` section.\n",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think 'Basic RAG' should be in code-tense.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants