Skip to content

Commit

Permalink
house keeping of full model name
Browse files Browse the repository at this point in the history
  • Loading branch information
jochenkirstaetter committed Mar 22, 2024
1 parent 3f13ac1 commit 9a10e0a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/Mscc.GenerativeAI/Types/EmbedContentRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace Mscc.GenerativeAI
/// </summary>
public class EmbedContentRequest
{
public string Model { get; } = $"models/{GenerativeAI.Model.Embedding}";
public string Model { get; } = $"{GenerativeAI.Model.Embedding.SanitizeModelName()}";

/// <summary>
///
Expand Down
14 changes: 7 additions & 7 deletions tests/Mscc.GenerativeAI/GoogleAi_GeminiPro_Should.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand All @@ -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]
Expand All @@ -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]
Expand Down Expand Up @@ -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}"));
}
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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()
{
Expand Down
4 changes: 2 additions & 2 deletions tests/Mscc.GenerativeAI/VertexAi_Gemini15Pro_Should.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand Down
6 changes: 3 additions & 3 deletions tests/Mscc.GenerativeAI/VertexAi_GeminiPro_Should.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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]
Expand All @@ -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]
Expand Down

0 comments on commit 9a10e0a

Please sign in to comment.