This commit is contained in:
54
e2e/csharp/tests/EmbedAsyncPendingTests.cs
generated
Normal file
54
e2e/csharp/tests/EmbedAsyncPendingTests.cs
generated
Normal file
@@ -0,0 +1,54 @@
|
||||
// This file is auto-generated by alef — DO NOT EDIT.
|
||||
// alef:hash:4e15143f4af1ae8bafbdb1506ef057da924484c66a19483966333558ad437e75
|
||||
// To regenerate: alef generate
|
||||
// To verify freshness: alef verify --exit-code
|
||||
// Issues & docs: https://github.com/kreuzberg-dev/alef
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
using System.Threading.Tasks;
|
||||
using Xunit;
|
||||
using Kreuzberg;
|
||||
using static Kreuzberg.KreuzbergLib;
|
||||
|
||||
namespace Kreuzberg
|
||||
{
|
||||
/// <summary>E2e tests for category: embed_async_pending.</summary>
|
||||
public class EmbedAsyncPendingTests
|
||||
{
|
||||
private static readonly JsonSerializerOptions ConfigOptions = new() { Converters = { new JsonStringEnumConverter(JsonNamingPolicy.SnakeCaseLower) }, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault };
|
||||
|
||||
[Fact]
|
||||
public async Task Test_EmbedTextsAsyncEmptyInput()
|
||||
{
|
||||
// embed_texts_async: empty text list
|
||||
var result = await KreuzbergLib.EmbedTextsAsync(new List<String>() { }, null);
|
||||
Assert.True(result.Count == 0);
|
||||
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Test_EmbedTextsAsyncHappy()
|
||||
{
|
||||
// embed_texts_async: basic async embedding
|
||||
var result = await KreuzbergLib.EmbedTextsAsync(new List<String>() { JsonSerializer.Deserialize<String>("\"First\"", ConfigOptions)!, JsonSerializer.Deserialize<String>("\"Second\"", ConfigOptions)! }, null);
|
||||
Assert.True(result.Count >= 2);
|
||||
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task Test_EmbedTextsAsyncPresetSwitch()
|
||||
{
|
||||
// embed_texts_async: preset override
|
||||
var result = await KreuzbergLib.EmbedTextsAsync(new List<String>() { JsonSerializer.Deserialize<String>("\"Text\"", ConfigOptions)! }, new EmbeddingConfig { Model = JsonSerializer.Deserialize<EmbeddingModelType>("{\"name\":\"balanced\",\"type\":\"preset\"}", ConfigOptions)! });
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user