Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RavenDB-23471 Fixed CreateEmbeddingViaSmartComponentsLocalEmbedding a…
Browse files Browse the repository at this point in the history
…nd updated failing test
Lwiel committed Jan 9, 2025
1 parent 109b66c commit 3a4a789
Showing 2 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -146,7 +146,7 @@ private static VectorValue Quantize(ByteStringContext allocator, in VectorEmbedd
private static (IDisposable MemoryScope, Memory<byte> Memory, int UsedBytes) CreateEmbeddingViaSmartComponentsLocalEmbedding(ByteStringContext allocator, in string text, in int dimensions)
{
List ??= new List<string>(1);
List.Insert(0, text);
List.Add(text);

try
{
@@ -162,7 +162,7 @@ private static (IDisposable MemoryScope, Memory<byte> Memory, int UsedBytes) Cre
}
finally
{
List[0] = null;
List.Clear();
}
}

9 changes: 5 additions & 4 deletions test/SlowTests/Issues/RavenDB-23473.cs
Original file line number Diff line number Diff line change
@@ -46,7 +46,7 @@ public void CanIndexVectorWhenPreviousElementsAreNullWithoutExplicitVectorFieldC
var errors = Indexes.WaitForIndexingErrors(store, errorsShouldExists: false);
Assert.Null(errors);
}
/*

[RavenFact(RavenTestCategory.Vector | RavenTestCategory.Indexes)]
public async Task CanUpdateNoExplicitlyConfiguredVectorFieldViaSubscriptionWithLoadDocument()
{
@@ -71,8 +71,10 @@ public async Task CanUpdateNoExplicitlyConfiguredVectorFieldViaSubscriptionWithL
var localEmbedding = await session.LoadAsync<Embedding>(embeddingId);
if (localEmbedding == null)
{
var embedding = GenerateEmbeddings.FromText(allocator, new VectorOptions(), q.Body);
vector = embedding.GetEmbedding();
#pragma warning disable SKEXP0070
var embedding = await GenerateEmbeddings.Embedder.Value.GenerateEmbeddingsAsync(new List<string> {q.Body });
#pragma warning restore SKEXP0070
vector = embedding[0].ToArray().ToList();
localEmbedding = new Embedding { Vector = vector };
await session.StoreAsync(localEmbedding, embeddingId);
}
@@ -120,7 +122,6 @@ public async Task CanUpdateNoExplicitlyConfiguredVectorFieldViaSubscriptionWithL
}
}
}
*/

private class VectorIndex : AbstractIndexCreationTask<Question>
{

0 comments on commit 3a4a789

Please sign in to comment.