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
Copy file name to clipboardExpand all lines: agent-framework/tutorials/agents/function-tools-approvals.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
@@ -66,7 +66,7 @@ Since you now have a function that requires approval, the agent might respond wi
66
66
You can check the response content for any `FunctionApprovalRequestContent` instances, which indicates that the agent requires user approval for a function.
67
67
68
68
```csharp
69
-
AgentThreadthread=agent.GetNewThread();
69
+
AgentThreadthread=awaitagent.GetNewThreadAsync();
70
70
AgentResponseresponse=awaitagent.RunAsync("What is the weather like in Amsterdam?", thread);
Copy file name to clipboardExpand all lines: agent-framework/tutorials/agents/memory.md
+9-6Lines changed: 9 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -146,6 +146,8 @@ To use the custom `AIContextProvider`, you need to provide an `AIContextProvider
146
146
147
147
When creating a `ChatClientAgent` it is possible to provide a `ChatClientAgentOptions` object that allows providing the `AIContextProviderFactory` in addition to all other agent options.
148
148
149
+
The factory is an async function that receives a context object and a cancellation token.
150
+
149
151
```csharp
150
152
usingSystem;
151
153
usingAzure.AI.OpenAI;
@@ -161,19 +163,20 @@ ChatClient chatClient = new AzureOpenAIClient(
When creating a new thread, the `AIContextProvider` will be created by `GetNewThread`
174
+
When creating a new thread, the `AIContextProvider` will be created by `GetNewThreadAsync`
172
175
and attached to the thread. Once memories are extracted it is therefore possible to access the memory component via the thread's `GetService` method and inspect the memories.
173
176
174
177
```csharp
175
178
// Create a new thread for the conversation.
176
-
AgentThreadthread=agent.GetNewThread();
179
+
AgentThreadthread=awaitagent.GetNewThreadAsync();
177
180
178
181
Console.WriteLine(awaitagent.RunAsync("Hello, what is the square root of 9?", thread));
179
182
Console.WriteLine(awaitagent.RunAsync("My name is Ruaidhrí", thread));
Copy file name to clipboardExpand all lines: agent-framework/tutorials/agents/multi-turn-conversation.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -27,10 +27,10 @@ For prerequisites and creating the agent, see the [Create and run a simple agent
27
27
Agents are stateless and do not maintain any state internally between calls.
28
28
To have a multi-turn conversation with an agent, you need to create an object to hold the conversation state and pass this object to the agent when running it.
29
29
30
-
To create the conversation state object, call the `GetNewThread` method on the agent instance.
30
+
To create the conversation state object, call the `GetNewThreadAsync` method on the agent instance.
31
31
32
32
```csharp
33
-
AgentThreadthread=agent.GetNewThread();
33
+
AgentThreadthread=awaitagent.GetNewThreadAsync();
34
34
```
35
35
36
36
You can then pass this thread object to the `RunAsync` and `RunStreamingAsync` methods on the agent instance, along with the user input.
@@ -52,8 +52,8 @@ These threads can then be used to maintain separate conversation states for each
52
52
The conversations will be fully independent of each other, since the agent does not maintain any state internally.
Copy file name to clipboardExpand all lines: agent-framework/user-guide/agents/agent-rag.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,14 +21,17 @@ The `TextSearchProvider` class is an out-of-the-box implementation of a RAG cont
21
21
22
22
It can easily be attached to a `ChatClientAgent` using the `AIContextProviderFactory` option to provide RAG capabilities to the agent.
23
23
24
+
The factory is an async function that receives a context object and a cancellation token.
25
+
24
26
```csharp
25
27
// Create the AI agent with the TextSearchProvider as the AI context provider.
26
28
AIAgentagent=azureOpenAIClient
27
29
.GetChatClient(deploymentName)
28
30
.AsAIAgent(newChatClientAgentOptions
29
31
{
30
32
ChatOptions=new() { Instructions="You are a helpful support specialist for Contoso Outdoors. Answer questions using the provided context and cite the source document when available." },
0 commit comments