Skip to content

Commit 016b095

Browse files
fix: Update rerank notebook for latest models (#3752)
* fix: Update rerank notebook for latest models * Update sdk/python/foundation-models/cohere/rerank-cohere-client.ipynb Co-authored-by: Michael <michael.kozakov@gmail.com> * fix typo * remove empty cell * refine base_url for clarity * fix formatting --------- Co-authored-by: Michael <michael.kozakov@gmail.com>
1 parent 647dec0 commit 016b095

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

sdk/python/foundation-models/cohere/rerank-cohere-client.ipynb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"* Register for a valid Azure account with subscription \n",
2323
"* Make sure you have access to [Azure AI Studio](https://learn.microsoft.com/en-us/azure/ai-studio/what-is-ai-studio?tabs=home)\n",
2424
"* Create a project and resource group\n",
25-
"* Select `Cohere Rerank V3 (English)` or `Cohere Rerank V3 (multilingual)`.\n",
25+
"* Select `Cohere Rerank V3.5`, `Cohere Rerank V4 Fast` or `Cohere Rerank V4 Pro`.\n",
2626
"\n",
2727
" > Notice that some models may not be available in all the regions in Azure AI and Azure Machine Learning. On those cases, you can create a workspace or project in the region where the models are available and then consume it with a connection from a different one. To learn more about using connections see [Consume models with connections](https://learn.microsoft.com/en-us/azure/ai-studio/how-to/deployments-connections)\n",
2828
"\n",
@@ -67,7 +67,7 @@
6767
"source": [
6868
"To use `cohere`, create a client and configure it as follows:\n",
6969
"\n",
70-
"- `endpoint`: Use the endpoint URL from your deployment. Include `/v1` at the end of the endpoint.\n",
70+
"- `base_url`: Use the endpoint URL from your deployment. Include everything except the final API route (eg: omit `/v2/rerank`).\n",
7171
"- `api_key`: Use your API key."
7272
]
7373
},
@@ -80,7 +80,8 @@
8080
"outputs": [],
8181
"source": [
8282
"co = cohere.ClientV2(\n",
83-
" base_url=\"https://<endpoint>.<region>.inference.ai.azure.com/v1\", api_key=\"<key>\"\n",
83+
" base_url=\"https://<endpoint>.services.ai.azure.com/providers/cohere/\",\n",
84+
" api_key=\"<key>\",\n",
8485
")"
8586
]
8687
},
@@ -141,7 +142,7 @@
141142
"]\n",
142143
"\n",
143144
"response = co.rerank(\n",
144-
" model=\"azureai\",\n",
145+
" model=\"azureai\", # NOTE: For rerank v4, you must specify the model e.g. `Cohere-rerank-v4.0-fast` or `Cohere-rerank-v4.0-pro`\n",
145146
" documents=[yaml.dump(doc, sort_keys=False) for doc in documents],\n",
146147
" query=\"What emails have been about returning items?\",\n",
147148
" top_n=5,\n",
@@ -152,7 +153,7 @@
152153
"cell_type": "markdown",
153154
"metadata": {},
154155
"source": [
155-
"## Aditional resources\n",
156+
"## Additional resources\n",
156157
"\n",
157158
"Here are some additional reference: \n",
158159
"\n",

0 commit comments

Comments
 (0)