diff --git a/fern/pages/models/models.mdx b/fern/pages/models/models.mdx
index 6407c467..ed221cd1 100644
--- a/fern/pages/models/models.mdx
+++ b/fern/pages/models/models.mdx
@@ -104,13 +104,14 @@ In this table, we provide some important context for using Cohere Embed models o
The Rerank model can improve created models by re-organizing their results based on certain parameters. This can be used to improve search algorithms.
-| Model Name | Description | Modalities | Context Length | Endpoints |
-| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------- | ---------------|---------------------------- |
-| `rerank-english-v3.0` | A model that allows for re-ranking English Language documents and semi-structured data (JSON). This model has a context length of 4096 tokens. | Text | 4k | [Rerank](/reference/rerank) |
-| `rerank-multilingual-v3.0` | A model for documents and semi-structure data (JSON) that are not in English. Supports the same languages as embed-multilingual-v3.0. This model has a context length of 4096 tokens. | Text | 4k | [Rerank](/reference/rerank) |
-| | | | | |
-| `rerank-english-v2.0` | A model that allows for re-ranking English language documents. | Text | 512 | [Rerank](/reference/rerank) |
-| `rerank-multilingual-v2.0` | A model for documents that are not in English. Supports the same languages as `embed-multilingual-v3.0`. | Text | 512 | [Rerank](/reference/rerank) |
+| Latest Model | Description | Modality | Max Tokens | Endpoints |
+| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|------------|-------------------|
+| `rerank-v3.5` | A model for documents and semi-structured data (JSON). State-of-the-art performance in English and non-English languages; supports the same languages as embed-multilingual-v3.0. This model has a context length of 4096 tokens | Text | N/A | [Rerank](/reference/rerank) |
+| `rerank-english-v3.0` | A model that allows for re-ranking English Language documents and semi-structured data (JSON). This model has a context length of 4096 tokens. | Text | N/A | [Rerank](/reference/rerank) |
+| `rerank-multilingual-v3.0` | A model for documents and semi-structure data (JSON) that are not in English. Supports the same languages as `embed-multilingual-v3.0`. This model has a context length of 4096 tokens. | Text | N/A | [Rerank](/reference/rerank) |
+| `rerank-english-v2.0` | A model that allows for re-ranking English language documents. This model has a context length of 512 tokens. | Text | N/A | [Rerank](/reference/rerank) |
+| `rerank-multilingual-v2.0` | A model for documents that are not in English. Supports the same languages as `embed-multilingual-v3.0`. This model has a context length of 512 tokens. | Text | N/A | [Rerank](/reference/rerank) |
+
### Using Rerank Models on Different Platforms
@@ -118,10 +119,9 @@ In this table, we provide some important context for using Cohere Rerank models
| Model Name | Amazon Bedrock Model ID | Amazon SageMaker | Azure AI Studio Model ID | Oracle OCI Generative AI Service |
| :------------------------- | :---------------------- | :-------------------- | :----------------------- | :------------------------------- |
-| `rerank-english-v3.0` | Not yet available | Unique per deployment | Not yet available | N/A |
-| `rerank-multilingual-v3.0` | Not yet available | Unique per deployment | Not yet available | N/A |
-| `rerank-english-v2.0` | N/A | N/A | N/A | N/A |
-| `rerank-multilingual-v2.0` | N/A | N/A | N/A | N/A |
+| `rerank-v3.5` | Not yet available | Unique per deployment | Coming soon | N/A |
+| `rerank-english-v3.0` | Not available | Unique per deployment | Not yet available | N/A |
+| `rerank-multilingual-v3.0` | Not available | Unique per deployment | Not yet available | N/A |
diff --git a/fern/pages/models/rerank-2.mdx b/fern/pages/models/rerank-2.mdx
index 069869dc..a8aa9548 100644
--- a/fern/pages/models/rerank-2.mdx
+++ b/fern/pages/models/rerank-2.mdx
@@ -13,12 +13,13 @@ updatedAt: "Mon Apr 08 2024 17:42:11 GMT+0000 (Coordinated Universal Time)"
---
Rerank models sort text inputs by semantic relevance to a specified query. They are often used to sort search results returned from an existing search solution. Learn more about using Rerank in the [best practices guide](/docs/reranking-best-practices).
-| Latest Model | Description | Modality | Max Tokens | Endpoints |
-| -------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| ---------|------------|-------------------|
-| `rerank-english-v3.0` | A model that allows for re-ranking English Language documents and semi-structured data (JSON). This model has a context length of 4096 tokens. | Text | N/A | [Rerank](/reference/rerank) |
-| `rerank-multilingual-v3.0` | A model for documents and semi-structure data (JSON) that are not in English. Supports the same languages as `embed-multilingual-v3.0`. This model has a context length of 4096 tokens.| Text | N/A | [Rerank](/reference/rerank) |
-| `rerank-english-v2.0` | A model that allows for re-ranking English language documents. This model has a context length of 512 tokens. | Text | N/A | [Rerank](/reference/rerank) |
-| `rerank-multilingual-v2.0` | A model for documents that are not in English. Supports the same languages as `embed-multilingual-v3.0`. This model has a context length of 512 tokens. | Text | N/A | [Rerank](/reference/rerank) |
+| Latest Model | Description | Modality | Max Tokens | Endpoints |
+| -------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|------------|-------------------|
+| `rerank-english-v3.5` | A model for documents and semi-structured data (JSON). State-of-the-art performance in English and non-English languages; supports the same languages as embed-multilingual-v3.0. This model has a context length of 4096 tokens | Text | N/A | [Rerank](/reference/rerank) |
+| `rerank-english-v3.0` | A model that allows for re-ranking English Language documents and semi-structured data (JSON). This model has a context length of 4096 tokens. | Text | N/A | [Rerank](/reference/rerank) |
+| `rerank-multilingual-v3.0` | A model for documents and semi-structure data (JSON) that are not in English. Supports the same languages as `embed-multilingual-v3.0`. This model has a context length of 4096 tokens. | Text | N/A | [Rerank](/reference/rerank) |
+| `rerank-english-v2.0` | A model that allows for re-ranking English language documents. This model has a context length of 512 tokens. | Text | N/A | [Rerank](/reference/rerank) |
+| `rerank-multilingual-v2.0` | A model for documents that are not in English. Supports the same languages as `embed-multilingual-v3.0`. This model has a context length of 512 tokens. | Text | N/A | [Rerank](/reference/rerank) |
For each document included in a request, Rerank combines the tokens from the query with the tokens from the document and the combined total counts toward the context limit for a single document. If the combined number of tokens from the query and a given document exceeds the model’s context length for a single document, the document will automatically get chunked and processed in multiple inferences. See our [best practice guide](/docs/reranking-best-practices) for more info about formatting documents for the Rerank endpoint.
diff --git a/fern/pages/text-embeddings/reranking/overview.mdx b/fern/pages/text-embeddings/reranking/overview.mdx
index 89523f60..ad64c042 100644
--- a/fern/pages/text-embeddings/reranking/overview.mdx
+++ b/fern/pages/text-embeddings/reranking/overview.mdx
@@ -4,7 +4,7 @@ slug: "docs/overview"
hidden: false
-description: "This page describes how Cohere's ReRank models work."
+description: "This page describes how Cohere's Rerank models work."
image: "../../../assets/images/f1cc130-cohere_meta_image.jpg"
keywords: "Cohere, reranking models, large language models"
@@ -36,7 +36,7 @@ docs = [
"Charlotte Amalie is the capital and largest city of the United States Virgin Islands. It has about 20,000 people. The city is on the island of Saint Thomas.",
"Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district. The President of the USA and many major national government offices are in the territory. This makes it the political center of the United States of America.",
"Capital punishment (the death penalty) has existed in the United States since before the United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states. The federal government (including the United States military) also uses capital punishment."]
-results = co.rerank(model="rerank-english-v3.0", query=query, documents=docs, top_n=5, return_documents=True)
+results = co.rerank(model="rerank-v3.5", query=query, documents=docs, top_n=5, return_documents=True)
```
**Response**
@@ -107,7 +107,7 @@ docs = [
{"Title":"The Capital of United States Virgin Islands","Content":"Charlotte Amalie is the capital and largest city of the United States Virgin Islands. It has about 20,000 people. The city is on the island of Saint Thomas."},
{"Title":"Washington D.C.","Content":"Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district. The President of the USA and many major national government offices are in the territory. This makes it the political center of the United States of America."},
{"Title":"Capital Punishment in the US","Content":"Capital punishment (the death penalty) has existed in the United States since before the United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states. The federal government (including the United States military) also uses capital punishment."}]
-results = co.rerank(model="rerank-english-v3.0", query=query, documents=docs, rank_fields=['Title','Content'],top_n=5, return_documents=True)
+results = co.rerank(model="rerank-v3.5", query=query, documents=docs, rank_fields=['Title','Content'],top_n=5, return_documents=True)
```
@@ -172,7 +172,7 @@ In the `docs` parameter, we are passing in a list of objects which have the key
## Multilingual Reranking
-Cohere offers a multilingual model, `rerank-multilingual-v3.0`. Please note that performance may vary across languages. The model is trained on the following languages:
+Cohere's `rerank-v3.5` and `rerank-multilingual-v3.0` models have been trained for performance across a variety of languages. Please note that performance may vary across languages. The model is trained on the following languages:
| ISO Code | Language Name |
| -------- | -------------- |
diff --git a/fern/pages/text-embeddings/reranking/reranking-best-practices.mdx b/fern/pages/text-embeddings/reranking/reranking-best-practices.mdx
index 1ba0bb92..80ba3cf8 100644
--- a/fern/pages/text-embeddings/reranking/reranking-best-practices.mdx
+++ b/fern/pages/text-embeddings/reranking/reranking-best-practices.mdx
@@ -13,6 +13,15 @@ updatedAt: 'Thu May 30 2024 15:16:00 GMT+0000 (Coordinated Universal Time)'
In the following two tables, you'll find recommendations for getting the best Rerank performance, organized by model family.
+### Rerank-v3.5
+
+| Constraint | Minimum | Maximum | Default Value |
+| ----------------------------- | ------- | ------------------------------------------------------------------------------------------------------- | :------------ |
+| Number of Documents | 1 | 10,000 | N/A |
+| Max Number of Chunks | 1 | N/A | 4000 |
+| Number of Tokens per Document | 1 | N/A (see [below ](/docs/reranking-best-practices#document-chunking)for more info) | N/A |
+| Number of Tokens per Query | 1 | 2048 | N/A |
+
### Rerank-v3.0
| Constraint | Minimum | Maximum | Default Value |
@@ -33,11 +42,11 @@ In the following two tables, you'll find recommendations for getting the best Re
## Document Chunking
-For `rerank-v3.0`, the model breaks documents into 4094 token chunks. For example, if your query is 100 tokens and your document is 10,000 tokens, your document will be broken into the following chunks:
+For rerank-v3.0 and rerank-v3.5, the model breaks documents into 4096 token chunks. For example, if your query is 100 tokens and your document is 10,000 tokens, your document will be broken into the following chunks:
1. `relevance_score_1 = `
-2. `relevance_score_2 = `
-3. `relevance_score_3 = `
+2. `relevance_score_2 = `
+3. `relevance_score_3 = `
4. `relevance_score = max(relevance_score_1, relevance_score_2, relevance_score_3)`
If you would like more control over how chunking is done, we recommend that you chunk your documents yourself.
@@ -46,7 +55,7 @@ If you would like more control over how chunking is done, we recommend that you
### Rerank-v3.0 Models
-When using `rerank-v3.0` models, the endpoint will throw an error if the user tries to pass more than 1000 documents at a time. The maximum number of documents that can be passed to the endpoint is calculated with the following inequality: `Number of documents * max_chunks_per_doc >1000`.
+When using `rerank-v3.0` models, the endpoint will throw an error if the user attempts to pass more than 1000 documents at a time. The maximum number of documents that can be passed to the endpoint is calculated with the following inequality: `Number of documents * max_chunks_per_doc >1000`.
If `Number of documents * max_chunks_per_doc` exceeds `1000`, the endpoint will return an error. By default, the `max_chunks_per_doc` is set to `1` for `rerank-v3.0` models; given that the model has a context length of 4096, the maximum number of tokens for each call would be 4,096,000.
@@ -54,29 +63,29 @@ If `Number of documents * max_chunks_per_doc` exceeds `1000`, the endpoint will
When using `rerank-v2.0`, the endpoint will throw an error if the user tries to pass more than 10,000 documents at a time. The maximum number of documents that can be passed to the endpoint is calculated with the following inequality: `Number of documents * max_chunks_per_doc >10,000`.
-If `Number of documents * max_chunks_per_doc` exceeds `10,000`, the endpoint will return an error. By default, the `max_chunks_per_doc` is set to `10` for `rerank-v2.0` models; given that the model has a context length of 512, the maximum number of tokens for each call would be 5,120,000.
+If `Number of documents * max_chunks_per_doc` exceeds `1000`, the endpoint will return an error. By default, the `max_chunks_per_doc` is set to `1` for `rerank-v3.0` models; given that the model has a context length of 4096, the maximum number of tokens for each call would be 4,096,000.
## Queries
-Our `rerank-v3.0` models are trained with a context length of 4096 tokens. The model takes into account both the input from the query and document. If your query is larger than 2048 tokens, it will be truncated to the first 2048 tokens. For v2.0 models, if your query is larger than 256 tokens, it will be truncated to the first 256 tokens.
+Our `rerank-v3.0` and `rerank-v3.5` models are trained with a context length of 4096 tokens. The model takes into account both the input from the query and document. If your query is larger than 2048 tokens, it will be truncated to the first 2048 tokens. For `rerank-v2.0` models, if your query is larger than 256 tokens, it will be truncated to the first 256 tokens
## Semi-Structured Data Support
-Our `rerank-v3.0` models support semi-structured data reranking through a list of JSON objects. The `rank_fields` parameter will default to a field parameter called `text` unless otherwise specified. If the `rank_fields` parameter is unspecified _and_ none of your JSON objects have a `text` field, the endpoint will return an error.
+Our rerank-v3.0 models support semi-structured data reranking through a list of JSON objects. The `rank_fields` parameter will default to a field parameter called `text` unless otherwise specified. If the `rank_fields` parameter is unspecified and none of your JSON objects have a `text` field, the endpoint will return an error.
```json JSON
[
{
- "Title":"How to fix a dishwasher"
- "Author":"John Smith"
- "Date":"August 1st 2023"
+ "Title": "How to fix a dishwasher",
+ "Author": "John Smith",
+ "Date": "August 1st 2023",
"Content": "Fixing a dishwasher depends on the specific problem you're facing. Here are some common issues and their potential solutions:...."
},
{
- "Title":"How to fix a leaky sink"
- "Date":"July 25th 2024"
+ "Title": "How to fix a leaky sink",
+ "Date": "July 25th 2024",
"Content": "Fixing a leaky sink will depend on the source of the leak. Here are general steps you can take to address common types of sink leaks:....."
- },.....
+ }
]
```
@@ -86,11 +95,11 @@ Looking at the example above, passing in `rank_fields=["Title","Content"]` would
The most important output from the [Rerank API endpoint](/reference/rerank-1) is the absolute rank exposed in the response object. The score is query dependent, and could be higher or lower depending on the query and passages sent in. In the example below, what matters is that Ottawa is more relevant than Toronto, but the user should not assume that Ottawa is two times more relevant than Ontario.
-```python PYTHON
-[
- RerankResult,
- RerankResult,
- RerankResult
+```
+[
+ RerankResult,
+ RerankResult,
+ RerankResult
]
```
diff --git a/fern/pages/v2/text-embeddings/reranking/overview.mdx b/fern/pages/v2/text-embeddings/reranking/overview.mdx
index 1deca035..c97f0f94 100644
--- a/fern/pages/v2/text-embeddings/reranking/overview.mdx
+++ b/fern/pages/v2/text-embeddings/reranking/overview.mdx
@@ -4,7 +4,7 @@ slug: "v2/docs/overview"
hidden: false
-description: "This page describes how Cohere's ReRank models work."
+description: "This page describes how Cohere's Rerank models work."
image: "../../../../assets/images/f1cc130-cohere_meta_image.jpg"
keywords: "Cohere, reranking models, large language models"
@@ -19,7 +19,7 @@ The [Rerank API endpoint](/reference/rerank-1), powered by the [Rerank models](/
### Example with Texts
-In the example below, we use the [Rerank API endpoint](/reference/rerank-1) to index the list of `docs` from most to least relevant to the query ` What is the capital of the United States?`.
+In the example below, we use the [Rerank API endpoint](/reference/rerank-1) to index the list of `documents` from most to least relevant to the query `"What is the capital of the United States?"`.
**Request**
@@ -27,91 +27,112 @@ In this example, the documents being passed in are a list of strings:
```python PYTHON
import cohere
-co = cohere.ClientV2(api_key="")
+co = cohere.ClientV2()
query = "What is the capital of the United States?"
docs = [
- "Carson City is the capital city of the American state of Nevada. At the 2010 United States Census, Carson City had a population of 55,274.",
- "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean that are a political division controlled by the United States. Its capital is Saipan.",
- "Charlotte Amalie is the capital and largest city of the United States Virgin Islands. It has about 20,000 people. The city is on the island of Saint Thomas.",
- "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district. The President of the USA and many major national government offices are in the territory. This makes it the political center of the United States of America.",
- "Capital punishment (the death penalty) has existed in the United States since before the United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states. The federal government (including the United States military) also uses capital punishment."]
-results = co.rerank(model="rerank-english-v3.0", query=query, documents=docs, top_n=5, return_documents=True)
+ "Carson City is the capital city of the American state of Nevada. At the 2010 United States Census, Carson City had a population of 55,274.",
+ "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean that are a political division controlled by the United States. Its capital is Saipan.",
+ "Charlotte Amalie is the capital and largest city of the United States Virgin Islands. It has about 20,000 people. The city is on the island of Saint Thomas.",
+ "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district. The President of the USA and many major national government offices are in the territory. This makes it the political center of the United States of America.",
+ "Capital punishment has existed in the United States since before the United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states. The federal government (including the United States military) also uses capital punishment."
+]
+
+results = co.rerank(
+ model="rerank-v3.5",
+ query=query,
+ documents=docs,
+ top_n=5)
```
**Response**
```jsx
{
- "id": "97813271-fe74-465d-b9d5-577e77079253",
- "results": [
- {
- "document": {
- "text": "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district. The President of the USA and many major national government offices are in the territory. This makes it the political center of the United States of America."
- },
- "index": 3,
- "relevance_score": 0.9990564
- },
- {
- "document": {
- "text": "Capital punishment (the death penalty) has existed in the United States since before the United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states. The federal government (including the United States military) also uses capital punishment."
- },
- "index": 4,
- "relevance_score": 0.7516481
- },
- {
- "document": {
- "text": "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean that are a political division controlled by the United States. Its capital is Saipan."
- },
- "index": 1,
- "relevance_score": 0.08882029
- },
- {
- "document": {
- "text": "Carson City is the capital city of the American state of Nevada. At the 2010 United States Census, Carson City had a population of 55,274."
- },
- "index": 0,
- "relevance_score": 0.058238626
- },
- {
- "document": {
- "text": "Charlotte Amalie is the capital and largest city of the United States Virgin Islands. It has about 20,000 people. The city is on the island of Saint Thomas."
- },
- "index": 2,
- "relevance_score": 0.019946935
- }
- ],
- "meta": {
- "api_version": {
- "version": "2022-12-06"
- },
- "billed_units": {
- "search_units": 1
- }
- }
+ "id": "97813271-fe74-465d-b9d5-577e77079253",
+ "results": [
+ {
+ "index": 3, // "Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) ..."
+ "relevance_score": 0.9990564
+ },
+ {
+ "index": 4, // "Capital punishment has existed in the United States since before the United States was a country. As of 2017 ..."
+ "relevance_score": 0.7516481
+ },
+ {
+ "index": 1, // "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean that are a political division ..."
+ "relevance_score": 0.08882029
+ },
+ {
+ "index": 0, // "Carson City is the capital city of the American state of Nevada. At the 2010 United States Census, Carson City had a ..."
+ "relevance_score": 0.058238626
+ },
+ {
+ "index": 2, // ""Charlotte Amalie is the capital and largest city of the United States Virgin Islands. It has about 20,000 people ..."
+ "relevance_score": 0.019946935
+ }
+ ],
+ "meta": {
+ "api_version": {
+ "version": "2"
+ },
+ "billed_units": {
+ "search_units": 1
+ }
+ }
}
```
-### Example with Semi-structured Data:
+### Example with Structured Data:
-Alternatively, you can pass in a JSON object and specify the fields you'd like to rank over. If you do not pass in any `rank_fields`, it will default to the text key.
+If your documents contain structured data, for best performance we recommend formatting them as YAML strings.
**Request**
```python PYTHON
+
+import yaml
+import cohere
+
+co = cohere.ClientV2()
+
query = "What is the capital of the United States?"
docs = [
- {"Title":"Facts about Carson City","Content":"Carson City is the capital city of the American state of Nevada. At the 2010 United States Census, Carson City had a population of 55,274."},
- {"Title":"The Commonwealth of Northern Mariana Islands","Content":"The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean that are a political division controlled by the United States. Its capital is Saipan."},
- {"Title":"The Capital of United States Virgin Islands","Content":"Charlotte Amalie is the capital and largest city of the United States Virgin Islands. It has about 20,000 people. The city is on the island of Saint Thomas."},
- {"Title":"Washington D.C.","Content":"Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district. The President of the USA and many major national government offices are in the territory. This makes it the political center of the United States of America."},
- {"Title":"Capital Punishment in the US","Content":"Capital punishment (the death penalty) has existed in the United States since before the United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states. The federal government (including the United States military) also uses capital punishment."}]
-results = co.rerank(model="rerank-english-v3.0", query=query, documents=docs, rank_fields=['Title','Content'],top_n=5, return_documents=True)
+ {
+ "Title": "Facts about Carson City",
+ "Content": "Carson City is the capital city of the American state of Nevada. At the 2010 United States Census, Carson City had a population of 55,274."
+ },
+ {
+ "Title": "The Commonwealth of Northern Mariana Islands",
+ "Content": "The Commonwealth of the Northern Mariana Islands is a group of islands in the Pacific Ocean that are a political division controlled by the United States. Its capital is Saipan."
+ },
+ {
+ "Title": "The Capital of United States Virgin Islands",
+ "Content": "Charlotte Amalie is the capital and largest city of the United States Virgin Islands. It has about 20,000 people. The city is on the island of Saint Thomas."
+ },
+ {
+ "Title": "Washington D.C.",
+ "Content":"Washington, D.C. (also known as simply Washington or D.C., and officially as the District of Columbia) is the capital of the United States. It is a federal district. The President of the USA and many major national government offices are in the territory. This makes it the political center of the United States of America."
+ },
+ {
+ "Title": "Capital Punishment in the US",
+ "Content": "Capital punishment has existed in the United States since before the United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states. The federal government (including the United States military) also uses capital punishment."
+ }
+]
+
+yaml_docs = [yaml.dump(doc, sort_keys=False) for doc in docs]
+
+results = co.rerank(
+ model="rerank-v3.5",
+ query=query,
+ documents=yaml_docs,
+ top_n=5
+)
```
-In the `docs` parameter, we are passing in a list of objects which have the key values: `[Title ,Content]`. As part of the Rerank call, we are specifying which keys to rank over, as well as the order in which the key value pairs should be considered.
+In the `documents` parameter, we are passing in a list YAML strings, representing the structured data.
```python PYTHON
{
@@ -126,7 +147,7 @@ In the `docs` parameter, we are passing in a list of objects which have the key
"relevance_score": 0.9987405
},
{
- "document": {
+ "document": {
"Content": "Capital punishment (the death penalty) has existed in the United States since before the United States was a country. As of 2017, capital punishment is legal in 30 of the 50 states. The federal government (including the United States military) also uses capital punishment.",
"Title": "Capital Punishment in the US"
},
@@ -172,7 +193,7 @@ In the `docs` parameter, we are passing in a list of objects which have the key
## Multilingual Reranking
-Cohere offers a multilingual model, `rerank-multilingual-v3.0`. Please note that performance may vary across languages. The model is trained on the following languages:
+Cohere's `rerank-v3.5` and `rerank-multilingual-v3.0` models have been trained for performance across a variety of languages. Please note that performance may vary across languages. The model is trained on the following languages:
| ISO Code | Language Name |
| -------- | -------------- |