Commit 4c789c9
committed
Merged PR 48177: Update IChatClient to support multiple return messages
Update IChatClient to support multiple return messages
- IChatClient no longer bakes mutation of the messages into the contract. The messages are now an `IEnumerable<ChatMessage>` rather than an `IList<ChatMessage>`.
- The purpose for mutation was to allow for multiple messages to be generated as part of an operation. All messages generated are now returned as part of the ChatResponse, which has a Messages rather than Message property.
- Choices have been removed from the surface area, e.g. no ChatResponse.Choices and no ChatResponseUpdate.ChoiceIndex.
----
#### AI description (iteration 1)
#### PR Classification
New feature
#### PR Summary
This pull request updates the `IChatClient` to support multiple return messages.
- `src/Libraries/Microsoft.Extensions.AI/ChatCompletion/FunctionInvokingChatClient.cs`: Refactored `GetResponseAsync` and `GetStreamingResponseAsync` methods to handle multiple return messages, aggregate usage data, and process function calls across multiple iterations.
<!-- GitOpsUserAgent=GitOps.Apps.Server.pullrequestcopilot -->File tree
109 files changed
+1881
-1976
lines changed- src
- Libraries
- Microsoft.Extensions.AI.Abstractions
- ChatCompletion
- Contents
- Embeddings
- Utilities
- Microsoft.Extensions.AI.AzureAIInference
- Microsoft.Extensions.AI.Evaluation.Quality
- Utilities
- Microsoft.Extensions.AI.Evaluation.Reporting.Azure/Storage
- Microsoft.Extensions.AI.Evaluation.Reporting/CSharp
- Storage
- Microsoft.Extensions.AI.Evaluation
- Microsoft.Extensions.AI.Ollama
- Microsoft.Extensions.AI.OpenAI
- Microsoft.Extensions.AI
- ChatCompletion
- Embeddings
- Functions
- ProjectTemplates/Microsoft.Extensions.AI.Templates/src/ChatWithCustomData/ChatWithCustomData.Web-CSharp/Services
- Ingestion
- test/Libraries
- Microsoft.Extensions.AI.Abstractions.Tests
- ChatCompletion
- Embeddings
- Utilities
- Microsoft.Extensions.AI.AzureAIInference.Tests
- Microsoft.Extensions.AI.Evaluation.Integration.Tests
- Microsoft.Extensions.AI.Evaluation.Reporting.Tests
- Microsoft.Extensions.AI.Integration.Tests
- Microsoft.Extensions.AI.Ollama.Tests
- Microsoft.Extensions.AI.OpenAI.Tests
- Microsoft.Extensions.AI.Tests
- ChatCompletion
- Embeddings
- Functions
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
109 files changed
+1881
-1976
lines changedLines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
204 | 216 | | |
205 | 217 | | |
206 | 218 | | |
| |||
Lines changed: 9 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | | - | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
27 | | - | |
| 28 | + | |
28 | 29 | | |
29 | 30 | | |
30 | 31 | | |
| |||
33 | 34 | | |
34 | 35 | | |
35 | 36 | | |
36 | | - | |
37 | | - | |
38 | | - | |
| 37 | + | |
39 | 38 | | |
40 | 39 | | |
41 | | - | |
| 40 | + | |
42 | 41 | | |
43 | 42 | | |
44 | 43 | | |
| |||
67 | 66 | | |
68 | 67 | | |
69 | 68 | | |
70 | | - | |
71 | | - | |
72 | | - | |
| 69 | + | |
73 | 70 | | |
74 | | - | |
75 | | - | |
| 71 | + | |
76 | 72 | | |
77 | 73 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
| 74 | + | |
93 | 75 | | |
94 | 76 | | |
95 | 77 | | |
| |||
112 | 94 | | |
113 | 95 | | |
114 | 96 | | |
115 | | - | |
| 97 | + | |
116 | 98 | | |
117 | 99 | | |
118 | 100 | | |
| |||
Lines changed: 45 additions & 62 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
13 | 20 | | |
14 | 21 | | |
15 | | - | |
16 | | - | |
| 22 | + | |
| 23 | + | |
17 | 24 | | |
18 | 25 | | |
19 | | - | |
20 | | - | |
21 | | - | |
| 26 | + | |
22 | 27 | | |
23 | | - | |
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
27 | | - | |
| 31 | + | |
| 32 | + | |
28 | 33 | | |
29 | 34 | | |
30 | 35 | | |
31 | | - | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
32 | 45 | | |
33 | 46 | | |
34 | | - | |
35 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
36 | 50 | | |
37 | | - | |
38 | | - | |
| 51 | + | |
| 52 | + | |
39 | 53 | | |
40 | 54 | | |
41 | | - | |
| 55 | + | |
42 | 56 | | |
43 | | - | |
44 | | - | |
| 57 | + | |
| 58 | + | |
45 | 59 | | |
46 | 60 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
| 61 | + | |
60 | 62 | | |
61 | 63 | | |
62 | 64 | | |
| |||
67 | 69 | | |
68 | 70 | | |
69 | 71 | | |
70 | | - | |
| 72 | + | |
71 | 73 | | |
72 | 74 | | |
73 | 75 | | |
| |||
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
| 101 | + | |
119 | 102 | | |
120 | 103 | | |
121 | 104 | | |
| |||
135 | 118 | | |
136 | 119 | | |
137 | 120 | | |
138 | | - | |
139 | | - | |
| 121 | + | |
| 122 | + | |
140 | 123 | | |
141 | | - | |
| 124 | + | |
| 125 | + | |
142 | 126 | | |
143 | | - | |
144 | | - | |
| 127 | + | |
| 128 | + | |
145 | 129 | | |
146 | 130 | | |
147 | | - | |
148 | 131 | | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
154 | 137 | | |
155 | 138 | | |
156 | 139 | | |
| |||
161 | 144 | | |
162 | 145 | | |
163 | 146 | | |
164 | | - | |
| 147 | + | |
165 | 148 | | |
166 | 149 | | |
167 | 150 | | |
| |||
0 commit comments