Skip to content

Commit e2b7980

Browse files
authored
Rename ChatThreadId to ConversationId (#46002)
1 parent 1af5cc0 commit e2b7980

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

docs/ai/microsoft-extensions-ai.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,15 @@ When working with a stateless service, callers maintain a list of all messages.
181181

182182
:::code language="csharp" source="snippets/microsoft-extensions-ai/ConsoleAI.StatelessStateful/Program.cs" id="Snippet1":::
183183

184-
For stateful services, you might already know the identifier used for the relevant conversation. You can put that identifier into <xref:Microsoft.Extensions.AI.ChatOptions.ChatThreadId?displayProperty=nameWithType>. Usage then follows the same pattern, except there's no need to maintain a history manually.
184+
For stateful services, you might already know the identifier used for the relevant conversation. You can put that identifier into <xref:Microsoft.Extensions.AI.ChatOptions.ConversationId?displayProperty=nameWithType>. Usage then follows the same pattern, except there's no need to maintain a history manually.
185185

186186
:::code language="csharp" source="snippets/microsoft-extensions-ai/ConsoleAI.StatelessStateful/Program.cs" id="Snippet2":::
187187

188-
Some services might support automatically creating a thread ID for a request that doesn't have one. In such cases, you can transfer the <xref:Microsoft.Extensions.AI.ChatResponse.ChatThreadId?displayProperty=nameWithType> over to the `ChatOptions.ChatThreadId` for subsequent requests. For example:
188+
Some services might support automatically creating a thread ID for a request that doesn't have one. In such cases, you can transfer the <xref:Microsoft.Extensions.AI.ChatResponse.ConversationId?displayProperty=nameWithType> over to the `ChatOptions.ConversationId` for subsequent requests. For example:
189189

190190
:::code language="csharp" source="snippets/microsoft-extensions-ai/ConsoleAI.StatelessStateful/Program.cs" id="Snippet3":::
191191

192-
If you don't know ahead of time whether the service is stateless or stateful, you can check the response <xref:Microsoft.Extensions.AI.ChatResponse.ChatThreadId> and act based on its value. If it's set, then that value is propagated to the options and the history is cleared so as to not resend the same history again. If the response `ChatThreadId` isn't set, then the response message is added to the history so that it's sent back to the service on the next turn.
192+
If you don't know ahead of time whether the service is stateless or stateful, you can check the response <xref:Microsoft.Extensions.AI.ChatResponse.ConversationId> and act based on its value. If it's set, then that value is propagated to the options and the history is cleared so as to not resend the same history again. If the response `ConversationId` isn't set, then the response message is added to the history so that it's sent back to the service on the next turn.
193193

194194
:::code language="csharp" source="snippets/microsoft-extensions-ai/ConsoleAI.StatelessStateful/Program.cs" id="Snippet4":::
195195

docs/ai/snippets/microsoft-extensions-ai/AI.Shared/AI.Shared.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10-
<PackageReference Include="Microsoft.Extensions.AI" Version="9.4.0-preview.1.25207.5" />
10+
<PackageReference Include="Microsoft.Extensions.AI" Version="9.4.4-preview.1.25259.16" />
1111
<PackageReference Include="System.Threading.RateLimiting" Version="10.0.0-preview.4.25258.110" />
1212
</ItemGroup>
1313

docs/ai/snippets/microsoft-extensions-ai/ConsoleAI.StatelessStateful/Program.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
// </Snippet1>
1919

2020
// <Snippet2>
21-
ChatOptions statefulOptions = new() { ChatThreadId = "my-conversation-id" };
21+
ChatOptions statefulOptions = new() { ConversationId = "my-conversation-id" };
2222
while (true)
2323
{
2424
Console.Write("Q: ");
@@ -38,7 +38,7 @@
3838
ChatResponse response = await client.GetResponseAsync(message, options);
3939
Console.WriteLine(response);
4040

41-
options.ChatThreadId = response.ChatThreadId;
41+
options.ConversationId = response.ConversationId;
4242
}
4343
// </Snippet3>
4444

@@ -53,8 +53,8 @@
5353
ChatResponse response = await client.GetResponseAsync(chatHistory);
5454
Console.WriteLine(response);
5555

56-
chatOptions.ChatThreadId = response.ChatThreadId;
57-
if (response.ChatThreadId is not null)
56+
chatOptions.ConversationId = response.ConversationId;
57+
if (response.ConversationId is not null)
5858
{
5959
chatHistory.Clear();
6060
}

docs/ai/snippets/microsoft-extensions-ai/ConsoleAI/ConsoleAI.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
</PropertyGroup>
99

1010
<ItemGroup>
11-
<PackageReference Include="Microsoft.Extensions.AI" Version="9.4.0-preview.1.25207.5" />
11+
<PackageReference Include="Microsoft.Extensions.AI" Version="9.4.4-preview.1.25259.16" />
1212
</ItemGroup>
1313

1414
<ItemGroup>

0 commit comments

Comments
 (0)