From 3eb4918987dcd95dbac9c0e4f588976c22234734 Mon Sep 17 00:00:00 2001 From: Daniel Cazzulino Date: Mon, 5 Jan 2026 13:09:33 -0300 Subject: [PATCH] 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. --- src/xAI.Protocol/Extensions.cs | 2 +- src/xAI.Tests/SanityChecks.cs | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/xAI.Protocol/Extensions.cs b/src/xAI.Protocol/Extensions.cs index 9f9e37d..85e5b09 100644 --- a/src/xAI.Protocol/Extensions.cs +++ b/src/xAI.Protocol/Extensions.cs @@ -19,7 +19,7 @@ public async Task> ListLanguageModelsAsync(Cancellati } /// Lists available embedding models. - public async Task> ListEmbeddingModelsAsync(CancellationToken cancellation) + public async Task> ListEmbeddingModelsAsync(CancellationToken cancellation = default) { var models = await client.ListEmbeddingModelsAsync(new Empty(), cancellationToken: cancellation); return models.Models; diff --git a/src/xAI.Tests/SanityChecks.cs b/src/xAI.Tests/SanityChecks.cs index f324183..6a078b1 100644 --- a/src/xAI.Tests/SanityChecks.cs +++ b/src/xAI.Tests/SanityChecks.cs @@ -10,6 +10,21 @@ namespace xAI.Tests; public class SanityChecks(ITestOutputHelper output) { + [SecretsFact("CI_XAI_API_KEY")] + public async Task NoEmbeddingModels() + { + var services = new ServiceCollection() + .AddxAIProtocol(Environment.GetEnvironmentVariable("CI_XAI_API_KEY")!) + .BuildServiceProvider(); + + var client = services.GetRequiredService(); + + var embeddings = await client.ListEmbeddingModelsAsync(); + + Assert.NotNull(embeddings); + Assert.Empty(embeddings); + } + [SecretsFact("CI_XAI_API_KEY")] public async Task ListModelsAsync() {