Commit c804629
.Net: Add Gemini usage metadata CachedContentTokenCount and ThoughtsTokenC… (#13208)
Add missing usage variables in GeminiMetadata class
### Motivation and Context
Gemini gives us CachedContentTokenCount and ThoughtsTokenCount to know
how much of cost have the request.
The total input as Gemini eyes is not only PromptTokenCount, but a sum
of these 3 variables.
### Description
Added CachedContentTokenCount and ThoughtsTokenCount variables, filled
by the response and add test.
**As I am beginner in C#, I can build and pass the test, also I can make
an .nupkg of the code changed, but I can't test on other projects, so
PLEASE check that before submitting changes. Thank you so much**
### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [X ] The code builds clean without any errors or warnings
- [X ] The PR follows the [SK Contribution
Guidelines](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
and the [pre-submission formatting
script](https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md#development-scripts)
raises no violations
- [X ] All unit tests pass, and I have added new tests where possible
- [ X] I didn't break anyone 😄
---------
Co-authored-by: Rodrigo <[email protected]>
Co-authored-by: Mark Wallace <[email protected]>
Co-authored-by: Roger Barreto <[email protected]>1 parent d595e48 commit c804629
File tree
6 files changed
+50
-4
lines changed- dotnet/src
- Connectors
- Connectors.Google.UnitTests/Core/Gemini/Clients
- Connectors.Google
- Core/Gemini
- Clients
- Models
- Models/Gemini
- IntegrationTests/Connectors/Google/Gemini
6 files changed
+50
-4
lines changeddotnet/src/Connectors/Connectors.Google.UnitTests/Core/Gemini/Clients/GeminiChatGenerationTests.cs
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
| 167 | + | |
| 168 | + | |
167 | 169 | | |
168 | 170 | | |
169 | 171 | | |
| |||
207 | 209 | | |
208 | 210 | | |
209 | 211 | | |
| 212 | + | |
| 213 | + | |
210 | 214 | | |
211 | 215 | | |
212 | 216 | | |
| |||
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
| 177 | + | |
| 178 | + | |
177 | 179 | | |
178 | 180 | | |
179 | 181 | | |
| |||
218 | 220 | | |
219 | 221 | | |
220 | 222 | | |
| 223 | + | |
| 224 | + | |
221 | 225 | | |
222 | 226 | | |
223 | 227 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
791 | 791 | | |
792 | 792 | | |
793 | 793 | | |
| 794 | + | |
| 795 | + | |
794 | 796 | | |
795 | 797 | | |
796 | 798 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
42 | 54 | | |
43 | 55 | | |
44 | 56 | | |
| |||
Lines changed: 22 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
47 | | - | |
| 47 | + | |
48 | 48 | | |
49 | | - | |
| 49 | + | |
50 | 50 | | |
51 | | - | |
52 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
53 | 62 | | |
54 | 63 | | |
55 | 64 | | |
| |||
61 | 70 | | |
62 | 71 | | |
63 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
64 | 82 | | |
65 | 83 | | |
66 | 84 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
435 | 435 | | |
436 | 436 | | |
437 | 437 | | |
| 438 | + | |
| 439 | + | |
438 | 440 | | |
439 | 441 | | |
440 | 442 | | |
| |||
459 | 461 | | |
460 | 462 | | |
461 | 463 | | |
| 464 | + | |
| 465 | + | |
462 | 466 | | |
463 | 467 | | |
464 | 468 | | |
465 | 469 | | |
| 470 | + | |
| 471 | + | |
466 | 472 | | |
467 | 473 | | |
468 | 474 | | |
| |||
0 commit comments