Skip to content

Commit 612ed9c

Browse files
committed
Add test that verifies embeddings aren't supported
xAI currently returns no embedding models, which is the reason we don't provide an IEmbeddingGenerator implementation. If this changes in the future, this new test will fail and we can fix that by providing an implementation then.
1 parent 060d138 commit 612ed9c

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/xAI.Protocol/Extensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ public async Task<IEnumerable<LanguageModel>> ListLanguageModelsAsync(Cancellati
1919
}
2020

2121
/// <summary>Lists available embedding models.</summary>
22-
public async Task<IEnumerable<EmbeddingModel>> ListEmbeddingModelsAsync(CancellationToken cancellation)
22+
public async Task<IEnumerable<EmbeddingModel>> ListEmbeddingModelsAsync(CancellationToken cancellation = default)
2323
{
2424
var models = await client.ListEmbeddingModelsAsync(new Empty(), cancellationToken: cancellation);
2525
return models.Models;

src/xAI.Tests/SanityChecks.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,21 @@ namespace xAI.Tests;
1010

1111
public class SanityChecks(ITestOutputHelper output)
1212
{
13+
[SecretsFact("CI_XAI_API_KEY")]
14+
public async Task NoEmbeddingModels()
15+
{
16+
var services = new ServiceCollection()
17+
.AddxAIProtocol(Environment.GetEnvironmentVariable("CI_XAI_API_KEY")!)
18+
.BuildServiceProvider();
19+
20+
var client = services.GetRequiredService<Models.ModelsClient>();
21+
22+
var embeddings = await client.ListEmbeddingModelsAsync();
23+
24+
Assert.NotNull(embeddings);
25+
Assert.Empty(embeddings);
26+
}
27+
1328
[SecretsFact("CI_XAI_API_KEY")]
1429
public async Task ListModelsAsync()
1530
{

0 commit comments

Comments
 (0)