diff --git a/README.md b/README.md index 2e5273d..dff0e39 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,7 @@ Alternatively, add the following line to your `.csproj` file. ```text - + ``` @@ -147,7 +147,7 @@ var prompt = "Write a story about a magic backpack."; var model = new GenerativeModel(apiKey: apiKey, model: Model.GeminiPro); -var response = model.GenerateContent(prompt).Result; +var response = await model.GenerateContent(prompt); Console.WriteLine(response.Text); ``` @@ -167,7 +167,7 @@ var vertex = new VertexAI(projectId: projectId, region: region); var model = vertex.GenerativeModel(model: Model.Gemini15Pro); model.AccessToken = accessToken; -var response = model.GenerateContent(prompt).Result; +var response = await model.GenerateContent(prompt); Console.WriteLine(response.Text); ``` @@ -187,6 +187,9 @@ var prompt = "Good morning! How are you?"; IGenerativeAI genAi = new GoogleAI(apiKey); var model = genAi.GenerativeModel(Model.Gemini15ProLatest, systemInstruction: systemInstruction); var request = new GenerateContentRequest(prompt); + +var response = await model.GenerateContent(prompt); +Console.WriteLine(response.Text); ``` The response might look similar to this: @@ -196,6 +199,20 @@ Shimmer me timbers, it's good to see a friendly face! What brings ye to these here waters? ``` +### Grounding with Google Search + +```csharp +var apiKey = "your_api_key"; +var prompt = "Who won Wimbledon this year?"; +IGenerativeAI genAi = new GoogleAI(apiKey); +var model = genAi.GenerativeModel("gemini-1.5-pro-002", + tools: [new Tool { GoogleSearchRetrieval = + new(DynamicRetrievalConfigMode.ModeUnspecified, 0.06f) }]); + +var response = await model.GenerateContent(prompt); +Console.WriteLine(response.Text); +``` + ### Text-and-image input ```csharp diff --git a/VERSION b/VERSION index 0bfbd57..fe4e75f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.8.2 \ No newline at end of file +1.8.3 \ No newline at end of file diff --git a/src/Mscc.GenerativeAI/CHANGELOG.md b/src/Mscc.GenerativeAI/CHANGELOG.md index 28333fe..372876f 100644 --- a/src/Mscc.GenerativeAI/CHANGELOG.md +++ b/src/Mscc.GenerativeAI/CHANGELOG.md @@ -15,6 +15,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed ### Fixed +## 1.8.3 + +### Added + +- add Grounding with Google Search +- add `ModelVersion` property + ## 1.8.2 ### Added