You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
state =await ctx.get_executor_state() or {"items": []}
978
978
state["items"].append(msg)
979
-
await ctx.set_state(state)
979
+
await ctx.set_executor_state(state)
980
980
iflen(state["items"]) >=2:
981
981
await ctx.yield_output(" | ".join(state["items"])) # ALL join
982
982
@@ -1404,7 +1404,7 @@ AutoGen's `Team` abstraction does not provide built-in checkpointing capabilitie
1404
1404
1405
1405
Agent Framework provides comprehensive checkpointing through `FileCheckpointStorage` and the `with_checkpointing()` method on `WorkflowBuilder`. Checkpoints capture:
1406
1406
1407
-
-**Executor state**: Local state for each executor using `ctx.set_state()`
1407
+
-**Executor state**: Local state for each executor using `ctx.set_executor_state()`
1408
1408
-**Shared state**: Cross-executor state using `ctx.set_shared_state()`
1409
1409
-**Message queues**: Pending messages between executors
1410
1410
-**Workflow position**: Current execution progress and next steps
@@ -1424,9 +1424,9 @@ class ProcessingExecutor(Executor):
Copy file name to clipboardExpand all lines: agent-framework/migration-guide/from-semantic-kernel/samples.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,7 @@ ms.service: agent-framework
13
13
14
14
::: zone pivot="programming-language-csharp"
15
15
16
-
See the [Agent Framework repository](https://github.com/microsoft/agent-framework/tree/main/dotnet/samples/SemanticKernelMigration) for detailed per agent type code samples showing the the Agent Framework equivalent code for Semantic Kernel features.
16
+
See the [Semantic Kernel repository](https://github.com/microsoft/semantic-kernel/tree/main/dotnet/samples/AgentFrameworkMigration) for detailed per agent type code samples showing the the Agent Framework equivalent code for Semantic Kernel features.
Copy file name to clipboardExpand all lines: agent-framework/tutorials/agents/memory.md
+22-8Lines changed: 22 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,9 +27,9 @@ For prerequisites and installing NuGet packages, see the [Create and run a simpl
27
27
`AIContextProvider` is an abstract class that you can inherit from, and which can be associated with the `AgentThread` for a `ChatClientAgent`.
28
28
It allows you to:
29
29
30
-
1.run custom logic before and after the agent invokes the underlying inference service
31
-
1.provide additional context to the agent before it invokes the underlying inference service
32
-
1.inspect all messages provided to and produced by the agent
30
+
1.Run custom logic before and after the agent invokes the underlying inference service.
31
+
1.Provide additional context to the agent before it invokes the underlying inference service.
32
+
1.Inspect all messages provided to and produced by the agent.
33
33
34
34
### Pre and post invocation events
35
35
@@ -63,12 +63,20 @@ internal sealed class UserInfo
63
63
Then you can implement the `AIContextProvider` to manage the memories.
64
64
The `UserInfoMemory` class below contains the following behavior:
65
65
66
-
1. It uses a`IChatClient` to look for the user's name and age in user messages when new messages are added to the thread at the end of each run.
66
+
1. It uses an`IChatClient` to look for the user's name and age in user messages when new messages are added to the thread at the end of each run.
67
67
1. It provides any current memories to the agent before each invocation.
68
-
1. If not memories are available, it instructs the agent to ask the user for the missing information, and not to answer any questions until the information is provided.
68
+
1. If no memories are available, it instructs the agent to ask the user for the missing information, and not to answer any questions until the information is provided.
69
69
1. It also implements serialization to allow persisting the memories as part of the thread state.
@@ -140,6 +148,12 @@ To use the custom `AIContextProvider`, you need to provide an `AIContextProvider
140
148
When creating a `ChatClientAgent` it is possible to provide a `ChatClientAgentOptions` object that allows providing the `AIContextProviderFactory` in addition to all other agent options.
141
149
142
150
```csharp
151
+
usingSystem;
152
+
usingAzure.AI.OpenAI;
153
+
usingAzure.Identity;
154
+
usingOpenAI.Chat;
155
+
usingOpenAI;
156
+
143
157
ChatClientchatClient=newAzureOpenAIClient(
144
158
newUri("https://<myresource>.openai.azure.com"),
145
159
newAzureCliCredential())
@@ -189,9 +203,9 @@ For prerequisites and installing packages, see the [Create and run a simple agen
189
203
`ContextProvider` is an abstract class that you can inherit from, and which can be associated with an `AgentThread` for a `ChatAgent`.
190
204
It allows you to:
191
205
192
-
1.run custom logic before and after the agent invokes the underlying inference service
193
-
1.provide additional context to the agent before it invokes the underlying inference service
194
-
1.inspect all messages provided to and produced by the agent
206
+
1.Run custom logic before and after the agent invokes the underlying inference service.
207
+
1.Provide additional context to the agent before it invokes the underlying inference service.
208
+
1.Inspect all messages provided to and produced by the agent.
@@ -123,7 +139,7 @@ Now, when executing the agent with a query that invokes a function, the middlewa
123
139
outputting the function name and call result.
124
140
125
141
```csharp
126
-
awaitmiddlewareEnabledAgent.RunAsync("What's the current time?");
142
+
Console.WriteLine(awaitmiddlewareEnabledAgent.RunAsync("What's the current time?"));
127
143
```
128
144
129
145
## Step 6: Create Chat Client Middleware
@@ -134,15 +150,20 @@ In this case, it's possible to use middleware for the `IChatClient`.
134
150
Here is an example of chat client middleware that can inspect and/or modify the input and output for the request to the inference service that the chat client provides.
-[.NET 8.0 SDK or later](https://dotnet.microsoft.com/download)
26
26
-[Azure OpenAI service endpoint and deployment configured](/azure/ai-foundry/openai/how-to/create-resource)
27
27
-[Azure CLI installed](/cli/azure/install-azure-cli) and [authenticated (for Azure credential authentication)](/cli/azure/authenticate-azure-cli)
28
28
-[User has the `Cognitive Services OpenAI User` or `Cognitive Services OpenAI Contributor` roles for the Azure OpenAI resource.](/azure/ai-foundry/openai/how-to/role-based-access-control)
@@ -38,8 +38,8 @@ Before you begin, ensure you have the following prerequisites:
38
38
To use Microsoft Agent Framework with Azure OpenAI, you need to install the following NuGet packages:
Copy file name to clipboardExpand all lines: agent-framework/tutorials/agents/structured-output.md
+6-11Lines changed: 6 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,15 +30,15 @@ The `ChatClientAgent` uses the support for structured output that's provided by
30
30
When creating the agent, you have the option to provide the default <xref:Microsoft.Extensions.AI.ChatOptions> instance to use for the underlying chat client.
31
31
This `ChatOptions` instance allows you to pick a preferred <xref:Microsoft.Extensions.AI.ChatResponseFormat>.
32
32
33
-
Various options are supported:
33
+
Various options for `ResponseFormat`are available:
34
34
35
-
-<xref:Microsoft.Extensions.AI.ChatResponseFormat.Text?displayProperty=nameWithType>: The response will be plain text.
36
-
-<xref:Microsoft.Extensions.AI.ChatResponseFormat.Json?displayProperty=nameWithType>: The response will be a JSON object without any particular schema.
37
-
-<xref:Microsoft.Extensions.AI.ChatResponseFormatJson>: The response will be a JSON object that conforms to the provided schema.
35
+
-A built-in <xref:Microsoft.Extensions.AI.ChatResponseFormat.Text?displayProperty=nameWithType> property: The response will be plain text.
36
+
-A built-in <xref:Microsoft.Extensions.AI.ChatResponseFormat.Json?displayProperty=nameWithType> property: The response will be a JSON object without any particular schema.
37
+
-A custom <xref:Microsoft.Extensions.AI.ChatResponseFormatJson> instance: The response will be a JSON object that conforms to a specific schema.
38
38
39
39
This example creates an agent that produces structured output in the form of a JSON object that conforms to a specific schema.
40
40
41
-
The easiest way to produce the schema is to define a C# class that represents the structure of the output you want from the agent, and then use the `AIJsonUtilities.CreateJsonSchema` method to create a schema from the type.
41
+
The easiest way to produce the schema is to define a type that represents the structure of the output you want from the agent, and then use the `AIJsonUtilities.CreateJsonSchema` method to create a schema from the type.
0 commit comments