Skip to content

Commit c85fb9c

Browse files
committed
fix
1 parent 43e0f69 commit c85fb9c

File tree

2 files changed

+46
-10
lines changed

2 files changed

+46
-10
lines changed

articles/ai-foundry/model-inference/includes/code-create-chat-reasoning.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ from azure.ai.inference.models import SystemMessage, UserMessage
1414

1515
response = client.complete(
1616
messages=[
17-
UserMessage(content="Explain Riemann's conjecture in 1 paragraph"),
17+
UserMessage(content="How many languages are in the world?"),
1818
],
1919
model="DeepSeek-R1"
2020
)
@@ -26,7 +26,7 @@ print(response.choices[0].message.content)
2626

2727
```javascript
2828
var messages = [
29-
{ role: "user", content: "Explain Riemann's conjecture in 1 paragraph" },
29+
{ role: "user", content: "How many languages are in the world?" },
3030
];
3131

3232
var response = await client.path("/chat/completions").post({
@@ -45,7 +45,7 @@ console.log(response.choices[0].message.content)
4545
requestOptions = new ChatCompletionsOptions()
4646
{
4747
Messages = {
48-
new ChatRequestUserMessage("Explain Riemann's conjecture in 1 paragraph")
48+
new ChatRequestUserMessage("How many languages are in the world?")
4949
},
5050
Model = "DeepSeek-R1"
5151
};
@@ -58,7 +58,7 @@ Console.WriteLine($"Response: {response.Value.Content}");
5858

5959
```java
6060
List<ChatRequestMessage> chatMessages = new ArrayList<>();
61-
chatMessages.add(new ChatRequestUserMessage("Explain Riemann's conjecture in 1 paragraph"));
61+
chatMessages.add(new ChatRequestUserMessage("How many languages are in the world?"));
6262

6363
ChatCompletions chatCompletions = client.complete(new ChatCompletionsOptions(chatMessages, "DeepSeek-R1"));
6464

@@ -83,7 +83,7 @@ Content-Type: application/json
8383
"messages": [
8484
{
8585
"role": "user",
86-
"content": "Explain Riemann's conjecture in 1 paragraph"
86+
"content": "How many languages are in the world?"
8787
}
8888
],
8989
"model": "DeepSeek-R1"

articles/ai-foundry/model-inference/tutorials/get-started-deepseek-r1.md

Lines changed: 41 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ ms.service: azure-ai-model-inference
77
ms.topic: tutorial
88
ms.date: 03/01/2025
99
ms.reviewer: fasantia
10-
ms.author: msakande
11-
author: mopeakande
10+
ms.author: mopeakande
11+
author: msakande
1212
---
1313

1414
# Tutorial: Get started with DeepSeek-R1 reasoning model in Azure AI model inference
@@ -25,7 +25,7 @@ In this tutorial, you learn:
2525

2626
To complete this article, you need:
2727

28-
* An Azure subscription. If you're using [GitHub Models](https://docs.github.com/en/github-models/), you can upgrade your experience and create an Azure subscription in the process. Read [Upgrade from GitHub Models to Azure AI model inference](../../how-to/quickstart-github-models.md) if that's your case.
28+
* An Azure subscription. If you're using [GitHub Models](https://docs.github.com/en/github-models/), you can upgrade your experience and create an Azure subscription in the process. Read [Upgrade from GitHub Models to Azure AI model inference](../how-to/quickstart-github-models.md) if that's your case.
2929

3030
[!INCLUDE [about-reasoning](../includes/use-chat-reasoning/about-reasoning.md)]
3131

@@ -58,7 +58,7 @@ To create an Azure AI project that supports model inference for DeepSeek-R1, fol
5858
| Resource group | The main container for all the resources in Azure. This helps get resources that work together organized. It also helps to have a scope for the costs associated with the entire project. |
5959
| Location | The region of the resources that you're creating. |
6060
| Hub | The main container for AI projects in Azure AI Foundry. Hubs promote collaboration and allow you to store information for your projects. |
61-
| AI Services | The resource enabling access to the flagship models in Azure AI model catalog. In this tutorial, a new account is created, but Azure AI services resources can be shared across multiple hubs and projects. Hubs use a connection to the resource to have access to the model deployments available there. To learn how, you can create connections between projects and Azure AI Services to consume Azure AI model inference you can read [Connect your AI project](../../how-to/configure-project-connection.md). |
61+
| AI Services | The resource enabling access to the flagship models in Azure AI model catalog. In this tutorial, a new account is created, but Azure AI services resources can be shared across multiple hubs and projects. Hubs use a connection to the resource to have access to the model deployments available there. To learn how, you can create connections between projects and Azure AI Services to consume Azure AI model inference you can read [Connect your AI project](../how-to/configure-project-connection.md). |
6262

6363
8. Select **Create**. The resources creation process starts.
6464

@@ -93,7 +93,7 @@ Let's now create a new model deployment for DeepSeek-R1:
9393

9494
8. Select **Deploy**.
9595

96-
:::image type="content" source="../media/quickstart-get-started-deepseek-r1/models-deploy.png" alt-text="Screenshot showing how to deploy the model." lightbox="../media/quickstart-get-started-deepseek-r1/models-deploy.png":::
96+
:::image type="content" source="../media/quickstart-get-started-deepseek-r1/model-deploy.png" alt-text="Screenshot showing how to deploy the model." lightbox="../media/quickstart-get-started-deepseek-r1/model-deploy.png":::
9797

9898
9. Once the deployment completes, the new model is listed in the page and it's ready to be used.
9999

@@ -117,10 +117,46 @@ You can get started by using the model in the playground to have an idea of the
117117

118118
## Use the model in code
119119

120+
[!INCLUDE [code-create-chat-client](../includes/code-create-chat-client.md)]
121+
120122
[!INCLUDE [code-chat-reasoning](../includes/code-create-chat-reasoning.md)]
121123

122124
Reasoning may generate longer responses and consume a larger amount of tokens. You can see the [rate limits](../quotas-limits.md) that apply to DeepSeek-R1 models. Consider having a retry strategy to handle rate limits being applied. You can also [request increases to the default limits](../quotas-limits.md#request-increases-to-the-default-limits).
123125

126+
### Reasoning content
127+
128+
Some reasoning models, like DeepSeek-R1, generate completions and include the reasoning behind it. The reasoning associated with the completion is included in the response's content within the tags `<think>` and `</think>`. The model may select on which scenarios to generate reasoning content. You following example shows how to do it in Python:
129+
130+
```python
131+
import re
132+
133+
match = re.match(r"<think>(.*?)</think>(.*)", response.choices[0].message.content, re.DOTALL)
134+
135+
print("Response:", )
136+
if match:
137+
print("\tThinking:", match.group(1))
138+
print("\tAnswer:", match.group(2))
139+
else:
140+
print("\tAnswer:", response.choices[0].message.content)
141+
print("Model:", response.model)
142+
print("Usage:")
143+
print("\tPrompt tokens:", response.usage.prompt_tokens)
144+
print("\tTotal tokens:", response.usage.total_tokens)
145+
print("\tCompletion tokens:", response.usage.completion_tokens)
146+
```
147+
148+
```console
149+
Thinking: Okay, the user is asking how many languages exist in the world. I need to provide a clear and accurate answer. Let's start by recalling the general consensus from linguistic sources. I remember that the number often cited is around 7,000, but maybe I should check some reputable organizations.\n\nEthnologue is a well-known resource for language data, and I think they list about 7,000 languages. But wait, do they update their numbers? It might be around 7,100 or so. Also, the exact count can vary because some sources might categorize dialects differently or have more recent data. \n\nAnother thing to consider is language endangerment. Many languages are endangered, with some having only a few speakers left. Organizations like UNESCO track endangered languages, so mentioning that adds context. Also, the distribution isn't even. Some countries have hundreds of languages, like Papua New Guinea with over 800, while others have just a few. \n\nA user might also wonder why the exact number is hard to pin down. It's because the distinction between a language and a dialect can be political or cultural. For example, Mandarin and Cantonese are considered dialects of Chinese by some, but they're mutually unintelligible, so others classify them as separate languages. Also, some regions are under-researched, making it hard to document all languages. \n\nI should also touch on language families. The 7,000 languages are grouped into families like Indo-European, Sino-Tibetan, Niger-Congo, etc. Maybe mention a few of the largest families. But wait, the question is just about the count, not the families. Still, it's good to provide a bit more context. \n\nI need to make sure the information is up-to-date. Let me think – recent estimates still hover around 7,000. However, languages are dying out rapidly, so the number decreases over time. Including that note about endangerment and language extinction rates could be helpful. For instance, it's often stated that a language dies every few weeks. \n\nAnother point is sign languages. Does the count include them? Ethnologue includes some, but not all sources might. If the user is including sign languages, that adds more to the count, but I think the 7,000 figure typically refers to spoken languages. For thoroughness, maybe mention that there are also over 300 sign languages. \n\nSummarizing, the answer should state around 7,000, mention Ethnologue's figure, explain why the exact number varies, touch on endangerment, and possibly note sign languages as a separate category. Also, a brief mention of Papua New Guinea as the most linguistically diverse country. \n\nWait, let me verify Ethnologue's current number. As of their latest edition (25th, 2022), they list 7,168 living languages. But I should check if that's the case. Some sources might round to 7,000. Also, SIL International publishes Ethnologue, so citing them as reference makes sense. \n\nOther sources, like Glottolog, might have a different count because they use different criteria. Glottolog might list around 7,000 as well, but exact numbers vary. It's important to highlight that the count isn't exact because of differing definitions and ongoing research. \n\nIn conclusion, the approximate number is 7,000, with Ethnologue being a key source, considerations of endangerment, and the challenges in counting due to dialect vs. language distinctions. I should make sure the answer is clear, acknowledges the variability, and provides key points succinctly.
150+
151+
Answer: The exact number of languages in the world is challenging to determine due to differences in definitions (e.g., distinguishing languages from dialects) and ongoing documentation efforts. However, widely cited estimates suggest there are approximately **7,000 languages** globally.
152+
Model: DeepSeek-R1
153+
Usage:
154+
Prompt tokens: 11
155+
Total tokens: 897
156+
Completion tokens: 886
157+
```
158+
159+
124160
### Parameters
125161

126162
In general, reasoning models don't support the following parameters you can find in chat completion models:

0 commit comments

Comments
 (0)