diff --git a/src/Mscc.GenerativeAI/Types/EmbedContentRequest.cs b/src/Mscc.GenerativeAI/Types/EmbedContentRequest.cs index ac73d16..6e1bd50 100644 --- a/src/Mscc.GenerativeAI/Types/EmbedContentRequest.cs +++ b/src/Mscc.GenerativeAI/Types/EmbedContentRequest.cs @@ -10,7 +10,7 @@ namespace Mscc.GenerativeAI /// public class EmbedContentRequest { - public string Model { get; } = $"models/{GenerativeAI.Model.Embedding}"; + public string Model { get; } = $"{GenerativeAI.Model.Embedding.SanitizeModelName()}"; /// /// diff --git a/tests/Mscc.GenerativeAI/GoogleAi_GeminiPro_Should.cs b/tests/Mscc.GenerativeAI/GoogleAi_GeminiPro_Should.cs index 4bd273e..29f2b47 100644 --- a/tests/Mscc.GenerativeAI/GoogleAi_GeminiPro_Should.cs +++ b/tests/Mscc.GenerativeAI/GoogleAi_GeminiPro_Should.cs @@ -46,7 +46,7 @@ public void Initialize_Using_GoogleAI() // Assert model.Should().NotBeNull(); - model.Name.Should().Be($"models/{expected}"); + model.Name.Should().Be($"{expected.SanitizeModelName()}"); } [Fact] @@ -61,7 +61,7 @@ public void Initialize_EnvVars() // Assert model.Should().NotBeNull(); - model.Name.Should().Be($"models/{expected}"); + model.Name.Should().Be($"{expected.SanitizeModelName()}"); } [Fact] @@ -75,7 +75,7 @@ public void Initialize_Default_Model() // Assert model.Should().NotBeNull(); - model.Name.Should().Be($"models/{expected}"); + model.Name.Should().Be($"{expected.SanitizeModelName()}"); } [Fact] @@ -89,7 +89,7 @@ public void Initialize_Model() // Assert model.Should().NotBeNull(); - model.Name.Should().Be($"models/{expected}"); + model.Name.Should().Be($"{expected.SanitizeModelName()}"); } [Fact] @@ -166,7 +166,7 @@ public async void Get_Model_Information(string modelName) // Assert sut.Should().NotBeNull(); - // sut.Name.Should().Be($"models/{modelName}"); + // sut.Name.Should().Be($"{modelName.SanitizeModelName()}"); output.WriteLine($"Model: {sut.DisplayName} ({sut.Name})"); sut.SupportedGenerationMethods.ForEach(m => output.WriteLine($" Method: {m}")); } @@ -195,7 +195,7 @@ public async void Get_Model_Information_Using_OAuth(string modelName) var model = new GenerativeModel { AccessToken = fixture.AccessToken }; var expected = modelName; if (!expected.Contains("/")) - expected = $"models/{expected}"; + expected = $"{expected.SanitizeModelName()}"; // Act var sut = await model.GetModel(model: modelName); @@ -1068,7 +1068,7 @@ public async void Create_Tuned_Model() }; var request = new CreateTunedModelRequest() { - BaseModel = $"models/{Model.Gemini10Pro001}", + BaseModel = $"{Model.Gemini10Pro001.SanitizeModelName()}", DisplayName = "Autogenerated Test model", TuningTask = new() { diff --git a/tests/Mscc.GenerativeAI/VertexAi_Gemini15Pro_Should.cs b/tests/Mscc.GenerativeAI/VertexAi_Gemini15Pro_Should.cs index 8e636de..dbcc75b 100644 --- a/tests/Mscc.GenerativeAI/VertexAi_Gemini15Pro_Should.cs +++ b/tests/Mscc.GenerativeAI/VertexAi_Gemini15Pro_Should.cs @@ -46,7 +46,7 @@ public void Initialize_Default_Model() // Assert model.Should().NotBeNull(); - model.Name.Should().Be(Model.Gemini10Pro); + model.Name.Should().Be(Model.Gemini10Pro.SanitizeModelName()); } [Fact] @@ -60,7 +60,7 @@ public void Initialize_Model() // Assert model.Should().NotBeNull(); - model.Name.Should().Be(Model.Gemini15Pro); + model.Name.Should().Be(this.model.SanitizeModelName()); } [Fact] diff --git a/tests/Mscc.GenerativeAI/VertexAi_GeminiPro_Should.cs b/tests/Mscc.GenerativeAI/VertexAi_GeminiPro_Should.cs index e7361c5..4b39c5a 100644 --- a/tests/Mscc.GenerativeAI/VertexAi_GeminiPro_Should.cs +++ b/tests/Mscc.GenerativeAI/VertexAi_GeminiPro_Should.cs @@ -47,7 +47,7 @@ public void Initialize_Using_VertexAI() // Assert model.Should().NotBeNull(); - model.Name.Should().Be($"models/{expected}"); + model.Name.Should().Be($"{expected.SanitizeModelName()}"); } [Fact] @@ -61,7 +61,7 @@ public void Initialize_Default_Model() // Assert model.Should().NotBeNull(); - model.Name.Should().Be($"models/{Model.Gemini10Pro}"); + model.Name.Should().Be($"{Model.Gemini10Pro.SanitizeModelName()}"); } [Fact] @@ -75,7 +75,7 @@ public void Initialize_Model() // Assert model.Should().NotBeNull(); - model.Name.Should().Be($"models/{Model.Gemini10Pro}"); + model.Name.Should().Be($"{Model.Gemini10Pro.SanitizeModelName()}"); } [Fact]