Skip to content

Commit a2e8121

Browse files
House keeping
1 parent e5148ce commit a2e8121

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

src/Mscc.GenerativeAI/GenerativeModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -511,7 +511,7 @@ public async Task<string> TransferOwnership(string model, string emailAddress)
511511
public async Task<UploadMediaResponse> UploadFile(string uri,
512512
string? displayName = null,
513513
bool resumable = false,
514-
[EnumeratorCancellation] CancellationToken cancellationToken = default)
514+
CancellationToken cancellationToken = default)
515515
{
516516
if (uri == null) throw new ArgumentNullException(nameof(uri));
517517
if (!File.Exists(uri)) throw new FileNotFoundException(nameof(uri));
@@ -686,8 +686,8 @@ public async Task<GenerateContentResponse> GenerateContent(GenerateContentReques
686686
{
687687
case FinishReason.Safety:
688688
return content;
689-
break;
690-
case FinishReason.FinishReasonUnspecified:
689+
// break;
690+
// case FinishReason.FinishReasonUnspecified:
691691
default:
692692
fullText.Append(content.Text);
693693
break;

src/Mscc.GenerativeAI/GoogleAI.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public GoogleAI(string? apiKey = null, string? accessToken = null) : this()
5858
/// <param name="safetySettings">Optional. A list of unique SafetySetting instances for blocking unsafe content.</param>
5959
/// <param name="tools">Optional. A list of Tools the model may use to generate the next response.</param>
6060
/// <param name="systemInstruction">Optional. </param>
61-
/// <exception cref="ArgumentNullException">Thrown when both <paramref name="apiKey"/> and <paramref name="accessToken"/> are <see langword="null"/>.</exception>
61+
/// <exception cref="ArgumentNullException">Thrown when both "apiKey" and "accessToken" are <see langword="null"/>.</exception>
6262
/// <returns>Generative model instance.</returns>
6363
public GenerativeModel GenerativeModel(string model = Model.Gemini15Pro,
6464
GenerationConfig? generationConfig = null,
@@ -67,8 +67,7 @@ public GenerativeModel GenerativeModel(string model = Model.Gemini15Pro,
6767
Content? systemInstruction = null)
6868
{
6969
if (_apiKey is null && _accessToken is null)
70-
throw new ArgumentNullException("apiKey or accessToken",
71-
message: "Either API key or access token is required.");
70+
throw new ArgumentNullException(message: "Either API key or access token is required.", null);
7271

7372
_generativeModel = new GenerativeModel(_apiKey,
7473
model,
@@ -87,7 +86,7 @@ public GenerativeModel GenerativeModel(string model = Model.Gemini15Pro,
8786
/// <inheritdoc cref="IGenerativeAI"/>
8887
public async Task<ModelResponse> GetModel(string model)
8988
{
90-
return await _generativeModel?.GetModel(model);
89+
return await _generativeModel?.GetModel(model)!;
9190
}
9291
}
9392
}

src/Mscc.GenerativeAI/VertexAI.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,16 +63,16 @@ public VertexAI(string projectId, string? region = null) : this()
6363
/// <param name="safetySettings">Optional. A list of unique SafetySetting instances for blocking unsafe content.</param>
6464
/// <param name="tools">Optional. A list of Tools the model may use to generate the next response.</param>
6565
/// <param name="systemInstruction">Optional. </param>
66-
/// <exception cref="ArgumentNullException">Thrown when <paramref name="projectId"/> or <paramref name="region"/> is <see langword="null"/>.</exception>
66+
/// <exception cref="ArgumentNullException">Thrown when "projectId" or "region" is <see langword="null"/>.</exception>
6767
/// <returns>Generative model instance.</returns>
6868
public GenerativeModel GenerativeModel(string model = Model.Gemini15Pro,
6969
GenerationConfig? generationConfig = null,
7070
List<SafetySetting>? safetySettings = null,
7171
List<Tool>? tools = null,
7272
Content? systemInstruction = null)
7373
{
74-
if (_projectId is null) throw new ArgumentNullException("projectId");
75-
if (_region is null) throw new ArgumentNullException("region");
74+
if (_projectId is null) throw new ArgumentNullException(message: "ProjectId has not been set", null);
75+
if (_region is null) throw new ArgumentNullException(message: "Region has not been set", null);
7676

7777
_generativeModel = new GenerativeModel(_projectId,
7878
_region,
@@ -97,17 +97,17 @@ public Task<ModelResponse> GetModel(string model)
9797
/// <returns></returns>
9898
public ImageGenerationModel ImageGenerationModel(string model = Model.ImageGeneration)
9999
{
100-
if (_projectId is null) throw new ArgumentNullException("projectId");
101-
if (_region is null) throw new ArgumentNullException("region");
100+
if (_projectId is null) throw new ArgumentNullException(message: "ProjectId has not been set", null);
101+
if (_region is null) throw new ArgumentNullException(message: "Region has not been set", null);
102102

103103
_imageGenerationModel = new ImageGenerationModel(_projectId, _region, model);
104104
return _imageGenerationModel;
105105
}
106106

107107
public ImageTextModel ImageTextModel(string model = Model.ImageText)
108108
{
109-
if (_projectId is null) throw new ArgumentNullException("projectId");
110-
if (_region is null) throw new ArgumentNullException("region");
109+
if (_projectId is null) throw new ArgumentNullException(message: "ProjectId has not been set", null);
110+
if (_region is null) throw new ArgumentNullException(message: "Region has not been set", null);
111111

112112
_imageTextModel = new ImageTextModel(_projectId, _region, model);
113113
return _imageTextModel;

0 commit comments

Comments
 (0)