Код: Выделить всё
public class EmbeddingService
{
private readonly OpenAIClient _client;
private readonly string _model;
public EmbeddingService(string apiKey, string model = "text-embedding-3-large")
{
_client = new OpenAIClient(apiKey);
_model = model;
}
public async Task CreateEmbeddingAsync(string text)
{
if (string.IsNullOrWhiteSpace(text))
return Array.Empty();
// Use the official Embeddings API
var response = await _client.Embeddings.CreateEmbeddingAsync(
model: _model,
input: text
);
// The new SDK returns a list of embeddings in response.Data[0].Embedding
return response.Data?[0].Embedding?.ToArray() ?? Array.Empty();
}
}
- Семантического поиска
- Сходства документов
- Классификации по намерениям
Подробнее здесь: https://stackoverflow.com/questions/798 ... ings-error