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

V2 docs #93

Merged
merged 67 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
27548e0
add v2 docs - first batch
mrmer1 Aug 29, 2024
23d8799
add v2 docs
mrmer1 Sep 3, 2024
7eceabc
update image paths
mrmer1 Sep 3, 2024
e2347f9
temp remove param types docs
mrmer1 Sep 3, 2024
b1db954
misc updates
mrmer1 Sep 3, 2024
a60bd0f
add models section and update yml
mrmer1 Sep 4, 2024
42f20fa
Merge branch 'main' into v2-docs
mkozakov Sep 4, 2024
eeddc41
multi step tool use updates
mrmer1 Sep 5, 2024
b8dfa2b
Merge branch 'v2-docs' of https://github.com/cohere-ai/cohere-develop…
mrmer1 Sep 5, 2024
269c8e5
Update fern/pages/fine-tuning/chat-fine-tuning/chat-starting-the-trai…
mrmer1 Sep 9, 2024
cf56167
Update fern/pages/fine-tuning/chat-fine-tuning/chat-starting-the-trai…
mrmer1 Sep 9, 2024
2809511
Update fern/pages/v2/models/the-command-family-of-models/command-r.mdx
mrmer1 Sep 9, 2024
90fef1a
Update fern/pages/v2/text-generation/chat-api.mdx
mrmer1 Sep 9, 2024
7499811
Update fern/pages/v2/text-generation/migrating-v1-to-v2.mdx
mrmer1 Sep 9, 2024
a4e100b
Update fern/pages/v2/text-generation/migrating-v1-to-v2.mdx
mrmer1 Sep 9, 2024
be98296
clean up migration guide
mrmer1 Sep 9, 2024
464df0b
Merge branch 'v2-docs' of https://github.com/cohere-ai/cohere-develop…
mrmer1 Sep 9, 2024
df55891
update text gen docs
mrmer1 Sep 9, 2024
874e5aa
update command model to latest
mrmer1 Sep 10, 2024
fc03f63
add tool use param types docs
mrmer1 Sep 10, 2024
2ff01ca
ft updates
mrmer1 Sep 11, 2024
53dcde2
update tool content to accept string
mrmer1 Sep 13, 2024
e55f173
update agent getting started nb
mrmer1 Sep 16, 2024
4b51010
safety mode
mrmer1 Sep 17, 2024
7d1f1d9
update fern
mrmer1 Sep 17, 2024
daa7534
upd search query gen and web search for v2
mrmer1 Sep 18, 2024
bd0483c
change RAG documents to top level param
mrmer1 Sep 18, 2024
880d89f
remove gen->chat migration, misc updates
mrmer1 Sep 18, 2024
a0cf402
embedding types required
mrmer1 Sep 18, 2024
5b86c44
update rag query generation
mrmer1 Sep 18, 2024
b1f4a52
chg term - preamble to system message
mrmer1 Sep 18, 2024
4f29c8a
update client to use v2 for misc endpoints
mrmer1 Sep 18, 2024
74567ea
multi step updates
mrmer1 Sep 19, 2024
10509d3
Merge branch 'main' into v2-docs
mrmer1 Sep 19, 2024
37991b1
update getting started tutorials
mrmer1 Sep 19, 2024
e227070
update migration guide title
mrmer1 Sep 19, 2024
e2f896c
update migration guide
mrmer1 Sep 19, 2024
abfd2bd
Update preview-docs.yml (#143)
billytrend-cohere Sep 19, 2024
17f3bed
update chat
mrmer1 Sep 19, 2024
b7edd54
Revert "Update preview-docs.yml (#143)" (#144)
billytrend-cohere Sep 19, 2024
70d51b6
update links
mrmer1 Sep 19, 2024
feaa066
Merge branch 'v2-docs' of https://github.com/cohere-ai/cohere-develop…
mrmer1 Sep 19, 2024
f3f7c23
Apply suggestions from code review
mrmer1 Sep 19, 2024
0d317e2
Apply suggestions from code review
mrmer1 Sep 19, 2024
7c01b8a
chat api updates
mrmer1 Sep 19, 2024
49c603c
Merge branch 'v2-docs' of https://github.com/cohere-ai/cohere-develop…
mrmer1 Sep 19, 2024
95869e1
update web search and search query gen migration guide
mrmer1 Sep 19, 2024
5e810e5
fix formatting
mrmer1 Sep 19, 2024
9c544c6
search query gen upd
mrmer1 Sep 19, 2024
3139bfd
add 2 missing pages
mrmer1 Sep 20, 2024
986f109
v2 slug change
mrmer1 Sep 20, 2024
a4bb0a1
Apply suggestions from code review
mrmer1 Sep 20, 2024
364e38d
migration guide - simplify chat history
mrmer1 Sep 20, 2024
183e78c
Merge branch 'v2-docs' of https://github.com/cohere-ai/cohere-develop…
mrmer1 Sep 20, 2024
2c8984b
update links to point to v2
mrmer1 Sep 20, 2024
bb3fdba
update RAG responses
mrmer1 Sep 20, 2024
0bf4029
update streaming docs
mrmer1 Sep 20, 2024
0815994
update deployment options and misc
mrmer1 Sep 24, 2024
a8215c6
deployment options edits
mrmer1 Sep 24, 2024
8591e07
v1 usage notes
mrmer1 Sep 24, 2024
8bc8dac
fix formatting
mrmer1 Sep 24, 2024
749afbd
update meta desc
mrmer1 Sep 24, 2024
e2c4bf6
update meta desc
mrmer1 Sep 24, 2024
5a24597
updates on tool use structure and migration guide, + misc
mrmer1 Sep 25, 2024
f2f9327
make v2 default
mrmer1 Sep 25, 2024
3962269
fix links
mrmer1 Sep 25, 2024
f0bd80c
Merge branch 'main' into v2-docs
mrmer1 Sep 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions fern/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ title: Cohere
default-language: python

versions:
- display-name: v2
path: v2.yml
slug: v2
- display-name: v1
path: v1.yml
slug: v1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -248,9 +248,9 @@ create_response = co.finetuning.create_finetuned_model(
)
```

## Calling your Chat Model with co.chat()
## Calling your Chat Model with the Chat API

Once your model completes training, you can call it via [co.chat()](/docs/chat-api) and pass your custom model's `model_id`.
Once your model completes training, you can call it via the [Chat API](/docs/chat-api) and pass your custom model's ID via the `model` parameter.

Please note, the `model_id` is the `id` returned by the fine-tuned model object with the `"-ft"` suffix.

Expand Down
92 changes: 92 additions & 0 deletions fern/pages/v2/deployment-options/cohere-on-aws/amazon-bedrock.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
title: Amazon Bedrock
slug: v2/docs/amazon-bedrock
hidden: false
description: >-
This document provides a guide for using Cohere's models on Amazon Bedrock.
image: ../../../../assets/images/8dbcb80-cohere_meta_image.jpg
keywords: 'Cohere on AWS, language models on AWS, Amazon Bedrock, Amazon SageMaker'
createdAt: 'Thu Feb 01 2024 18:08:37 GMT+0000 (Coordinated Universal Time)'
updatedAt: 'Thu May 30 2024 16:00:53 GMT+0000 (Coordinated Universal Time)'
---
<Info title="Note">
The code examples in this section use the Cohere v1 API. The v2 API is not yet supported for cloud deployments and will be coming soon.
</Info>
In an effort to make our language-model capabilities more widely available, we've partnered with a few major platforms to create hosted versions of our offerings.

Here, you'll learn how to use Amazon Bedrock to deploy both the Cohere Command and the Cohere Embed models on the AWS cloud computing platform. The following models are available on Bedrock:

- Command R
- Command R+
- Command Light
- Command
- Embed - English
- Embed - Multilingual

## Prerequisites

Here are the steps you'll need to get set up in advance of running Cohere models on Amazon Bedrock.

- Subscribe to Cohere's models on Amazon Bedrock. For more details, [see here](https://docs.aws.amazon.com/bedrock/latest/userguide/model-access.html).
- You'll also need to install the AWS Python SDK and some related tooling. Run:
- `pip install cohere-aws` (or `pip install --upgrade cohere-aws` if you need to upgrade). You can also install from source with `python setup.py install`.
- For more details, see this [GitHub repo](https://github.com/cohere-ai/cohere-aws/) and [related notebooks](https://github.com/cohere-ai/cohere-aws/tree/main/notebooks/bedrock).
- Finally, you'll have to configure your authentication credentials for AWS. This [document](https://boto3.amazonaws.com/v1/documentation/api/latest/guide/quickstart.html#configuration) has more information.

## Embeddings

You can use this code to invoke Cohere's Embed English v3 model (`cohere.embed-english-v3`) or Embed Multilingual v3 model (`cohere.embed-multilingual-v3`) on Amazon Bedrock:

```python PYTHON
import cohere

co = cohere.BedrockClient(
aws_region="us-east-1",
aws_access_key="...",
aws_secret_key="...",
aws_session_token="...",
)

# Input parameters for embed. In this example we are embedding hacker news post titles.
texts = ["Interesting (Non software) books?",
"Non-tech books that have helped you grow professionally?",
"I sold my company last month for $5m. What do I do with the money?",
"How are you getting through (and back from) burning out?",
"I made $24k over the last month. Now what?",
"What kind of personal financial investment do you do?",
"Should I quit the field of software development?"]
input_type = "clustering"
truncate = "NONE" # optional
model_id = "cohere.embed-english-v3" # or "cohere.embed-multilingual-v3"


# Invoke the model and print the response
result = co.embed(
model=model_id,
input_type=input_type,
texts=texts,
truncate=truncate) # aws_client.invoke_model(**params)

print(result)
```

## Text Generation

You can use this code to invoke either Command R (`cohere.command-r-v1:0`), Command R+ (`cohere.command-r-plus-v1:0`), Command (`cohere.command-text-v14`), or Command light (`cohere.command-light-text-v14`) on Amazon Bedrock:

```python PYTHON
import cohere

co = cohere.BedrockClient(
aws_region="us-east-1",
aws_access_key="...",
aws_secret_key="...",
aws_session_token="...",
)

result = co.chat(message="Write a LinkedIn post about starting a career in tech:",
model='cohere.command-r-plus-v1:0' # or 'cohere.command-r-v1:0'
)

print(result)
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
---
title: "Amazon SageMaker"
slug: "v2/docs/amazon-sagemaker-setup-guide"

hidden: false
description: "This document will guide you through enabling development teams to access Cohere’s offerings on Amazon SageMaker."
image: "../../../../assets/images/6330341-cohere_meta_image.jpg"
keywords: "Amazon SageMaker, Generative AI on AWS"

createdAt: "Wed Jun 28 2023 14:29:11 GMT+0000 (Coordinated Universal Time)"
updatedAt: "Thu May 30 2024 16:01:40 GMT+0000 (Coordinated Universal Time)"
---
<Info title="Note">
The code examples in this section use the Cohere v1 API. The v2 API is not yet supported for cloud deployments and will be coming soon.
</Info>
In an effort to make our language-model capabilities more widely available, we've partnered with a few major platforms to create hosted versions of our offerings.

This document will guide you through enabling development teams to access [Cohere’s offerings on Amazon SageMaker](https://aws.amazon.com/marketplace/seller-profile?id=87af0c85-6cf9-4ed8-bee0-b40ce65167e0).

## Prerequisites

In order to successfully subscribe to Cohere’s offerings on Amazon SageMaker, the user will need the following **Identity and Access Management (IAM)** permissions:

- **AmazonSageMakerFullAccess**
- **aws-marketplace:ViewSubscriptions**
- **aws-marketplace:Subscribe**
- **aws-marketplace:Unsubscribe**

These permissions allow a user to manage your organization’s Amazon SageMaker subscriptions. Learn more about [managing Amazon’s IAM Permissions here](https://aws.amazon.com/iam/?trk=cf28fddb-12ed-4ffd-981b-b89c14793bf1&sc_channel=ps&ef_id=CjwKCAjwsvujBhAXEiwA_UXnAJ4JEQ3KgW0eFBzr5nuwt9L5S7w3A0f3wqensQJgUQ7Mf_ZEdArZRxoCjKQQAvD_BwE:G:s&s_kwcid=AL!4422!3!652240143562!e!!g!!amazon%20iam!19878797467!148973348604). Contact your AWS administrator if you have questions about account permissions.

You'll also need to install the AWS Python SDK and some related tooling. Run:

- `pip install cohere-aws` (or `pip install --upgrade cohere-aws` if you want to upgrade to the most recent version of the SDK).

## Cohere with Amazon SageMaker Setup

First, navigate to [Cohere’s SageMaker Marketplace](https://aws.amazon.com/marketplace/seller-profile?id=87af0c85-6cf9-4ed8-bee0-b40ce65167e0) to view the available product offerings. Select the product offering to which you are interested in subscribing.

Next, explore the tools on the **Product Detail** page to evaluate how you want to configure your subscription. It contains information related to:

- Pricing: This section allows you to estimate the cost of running inference on different types of instances.
- Usage: This section contains the technical details around supported data formats for each model, and offers links to documentation and notebooks that will help developers scope out the effort required to integrate with Cohere’s models.
- Subscribing: This section will once again present you with both the pricing details and the EULA for final review before you accept the offer. This information is identical to the information on Product Detail page.
- Configuration: The primary goal of this section is to retrieve the [Amazon Resource Name (ARN)](https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html) for the product you have subscribed to.

## Embeddings

You can use this code to invoke Cohere's embed model on Amazon SageMaker:

```python PYTHON
import cohere

co = cohere.SageMakerClient(
aws_region="us-east-1",
aws_access_key="...",
aws_secret_key="...",
aws_session_token="...",
)

# Input parameters for embed. In this example we are embedding hacker news post titles.
texts = ["Interesting (Non software) books?",
"Non-tech books that have helped you grow professionally?",
"I sold my company last month for $5m. What do I do with the money?",
"How are you getting through (and back from) burning out?",
"I made $24k over the last month. Now what?",
"What kind of personal financial investment do you do?",
"Should I quit the field of software development?"]
input_type = "clustering"
truncate = "NONE" # optional
model_id = "<YOUR ENDPOINT NAME>" # On SageMaker, you create a model name that you'll pass here.


# Invoke the model and print the response
result = co.embed(
model=model_id,
input_type=input_type,
texts=texts,
truncate=truncate)

print(result)
```

## Text Generation

You can use this code to invoke Cohere's Command models on Amazon SageMaker:

```python PYTHON
import cohere

co = cohere.SageMakerClient(
aws_region="us-east-1",
aws_access_key="...",
aws_secret_key="...",
aws_session_token="...",
)

# Invoke the model and print the response
result = co.chat(message="Write a LinkedIn post about starting a career in tech:",
model="<YOUR ENDPOINT NAME>") # On SageMaker, you create a model name that you'll pass here.

print(result)
```

## Next Steps

With your selected configuration and Product ARN available, you now have everything you need to integrate with Cohere’s model offerings on SageMaker.

Cohere recommends your next step be to find the appropriate notebook in [Cohere's list of Amazon SageMaker notebooks](https://github.com/cohere-ai/cohere-aws/tree/main/notebooks/sagemaker), and follow the instructions there, or provide the link to Cohere’s SageMaker notebooks to your development team to implement. The notebooks are thorough, developer-centric guides that will enable your team to begin leveraging Cohere’s endpoints in production for live inference.

If you have further questions about subscribing or configuring Cohere’s product offerings on Amazon SageMaker, please contact our team at [[email protected]](mailto:[email protected]).
Loading
Loading