|
22 | 22 | "* Register for a valid Azure account with subscription \n", |
23 | 23 | "* 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", |
24 | 24 | "* 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", |
26 | 26 | "\n", |
27 | 27 | " > 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", |
28 | 28 | "\n", |
|
67 | 67 | "source": [ |
68 | 68 | "To use `cohere`, create a client and configure it as follows:\n", |
69 | 69 | "\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", |
71 | 71 | "- `api_key`: Use your API key." |
72 | 72 | ] |
73 | 73 | }, |
|
80 | 80 | "outputs": [], |
81 | 81 | "source": [ |
82 | 82 | "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", |
84 | 85 | ")" |
85 | 86 | ] |
86 | 87 | }, |
|
141 | 142 | "]\n", |
142 | 143 | "\n", |
143 | 144 | "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", |
145 | 146 | " documents=[yaml.dump(doc, sort_keys=False) for doc in documents],\n", |
146 | 147 | " query=\"What emails have been about returning items?\",\n", |
147 | 148 | " top_n=5,\n", |
|
152 | 153 | "cell_type": "markdown", |
153 | 154 | "metadata": {}, |
154 | 155 | "source": [ |
155 | | - "## Aditional resources\n", |
| 156 | + "## Additional resources\n", |
156 | 157 | "\n", |
157 | 158 | "Here are some additional reference: \n", |
158 | 159 | "\n", |
|
0 commit comments