Skip to content

Commit d03a1c3

Browse files
bump version; update readme and changelog
1 parent f230e02 commit d03a1c3

File tree

5 files changed

+91
-0
lines changed

5 files changed

+91
-0
lines changed

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,65 @@ _ = await chat.SendMessage("Lastly, give a thorough definition for a CS graduate
174174
chat.History.ForEach(c => Console.WriteLine($"{c.Role}: {c.Parts[0].Text}"));
175175
```
176176

177+
### Create a tuned model
178+
179+
The Gemini API lets you tune models on your own data. Since it's your data and your tuned models this needs stricter access controls than API-Keys can provide.
180+
181+
Before you can create a tuned model, you'll need to [setup OAuth for your project](https://ai.google.dev/palm_docs/oauth_quickstart).
182+
183+
```csharp
184+
using Mscc.GenerativeAI;
185+
186+
var projectId = "your_google_project_id"; // the ID of a project, not its name.
187+
var accessToken = "your_access_token"; // use `gcloud auth application-default print-access-token` to get it.
188+
var model = new GenerativeModel(apiKey: null, model: Model.Gemini10Pro001)
189+
{
190+
AccessToken = accessToken,
191+
ProjectId = projectId
192+
};
193+
var request = new CreateTunedModelRequest()
194+
{
195+
BaseModel = $"models/{Model.Gemini10Pro001}",
196+
DisplayName = "Autogenerated Test model",
197+
TuningTask = new()
198+
{
199+
Hyperparameters = new() { BatchSize = 2, LearningRate = 0.001f, EpochCount = 3 },
200+
TrainingData = new()
201+
{
202+
Examples = new()
203+
{
204+
Examples = new()
205+
{
206+
new TrainingDataExample() { TextInput = "1", Output = "2" },
207+
new TrainingDataExample() { TextInput = "3", Output = "4" },
208+
new TrainingDataExample() { TextInput = "-3", Output = "-2" },
209+
new TrainingDataExample() { TextInput = "twenty two", Output = "twenty three" },
210+
new TrainingDataExample() { TextInput = "two hundred", Output = "two hundred one" },
211+
new TrainingDataExample() { TextInput = "ninety nine", Output = "one hundred" },
212+
new TrainingDataExample() { TextInput = "8", Output = "9" },
213+
new TrainingDataExample() { TextInput = "-98", Output = "-97" },
214+
new TrainingDataExample() { TextInput = "1,000", Output = "1,001" },
215+
new TrainingDataExample() { TextInput = "thirteen", Output = "fourteen" },
216+
new TrainingDataExample() { TextInput = "seven", Output = "eight" },
217+
}
218+
}
219+
}
220+
}
221+
};
222+
223+
// Act
224+
var response = await model.CreateTunedModel(request);
225+
Console.WriteLine($"Name: {response.Name}");
226+
Console.WriteLine($"Model: {response.Metadata.TunedModel} (Steps: {response.Metadata.TotalSteps})");
227+
```
228+
(This is still work in progress but operational. Future release will provide types to simplify the create request.)
229+
230+
Tuned models appear in your Google AI Studio library.
231+
232+
[![Tuned models are listed below My Library in Google AI Studio](./docs/GeminiTunedModels.png)](https://aistudio.google.com/app/library)
233+
234+
### More samples
235+
177236
The folders [samples](./samples/) and [tests](./tests/) contain more examples.
178237

179238
- [Simple console application](./samples/Console.Minimal.Prompt/)

docs/GeminiTunedModels.png

33.3 KB
Loading

src/Mscc.GenerativeAI.Google/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
### Changed
1212
### Fixed
1313

14+
## 0.7.1
15+
16+
### Changed
17+
18+
- bump version
19+
1420
## 0.7.0
1521

1622
### Added

src/Mscc.GenerativeAI.Web/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
### Changed
1212
### Fixed
1313

14+
## 0.7.1
15+
16+
### Changed
17+
18+
- bump version
19+
1420
## 0.5.1
1521

1622
### Changed

src/Mscc.GenerativeAI/CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Added
11+
12+
- provide types to simplify creation of tuned model
13+
1114
### Changed
1215
### Fixed
1316

17+
## 0.7.1
18+
19+
### Added
20+
21+
- implement model tuning (works with stable models only)
22+
- text-bison-001
23+
- gemini-1.0-pro-001
24+
- tests for model tuning
25+
-
26+
### Changed
27+
28+
- improved authentication regarding API key or OAuth/ADC
29+
- added scope https://www.googleapis.com/auth/generative-language.tuning
30+
- harmonized version among NuGet packages
31+
- provide empty response on Safety stop
32+
- merged regular and tuned ModelResponse
33+
1434
## 0.7.0
1535

1636
### Added

0 commit comments

Comments
 (0)