24 lines
664 B
C#
24 lines
664 B
C#
using GymLogAI.Application.Interfaces;
|
|
|
|
namespace GymLogAI.AI;
|
|
|
|
public sealed class StubEmbeddingService(OpenRouterEmbeddingClient embeddingClient) : IEmbeddingService
|
|
{
|
|
public async Task<float[]> GenerateEmbeddingAsync(string input, CancellationToken cancellationToken)
|
|
{
|
|
var remoteEmbedding = await embeddingClient.GenerateAsync(input, cancellationToken);
|
|
if (remoteEmbedding is not null)
|
|
{
|
|
return remoteEmbedding;
|
|
}
|
|
|
|
return
|
|
[
|
|
input.Length,
|
|
input.Count(char.IsLetter),
|
|
input.Count(char.IsDigit),
|
|
input.Count(char.IsWhiteSpace)
|
|
];
|
|
}
|
|
}
|