Skip to content

Commit

Permalink
Fixed PR comments (sonar warnings)
Browse files Browse the repository at this point in the history
  • Loading branch information
LuisM000 committed Mar 7, 2024
1 parent 4c2ab1d commit 560de83
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public interface ISemanticTextSplitter
/// </summary>
/// <param name="text">The input text to be split.</param>
/// <param name="embeddingsGenerator">A function to generate embeddings for a list of strings.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests. The default is <see cref="CancellationToken.None"/>.</param>
/// <param name="cancellationToken">The <see cref="CancellationToken"/> to monitor for cancellation requests.</param>
/// <returns>A collection of text splits.</returns>
Task<IEnumerable<string>> SplitAsync(string text, Func<IList<string>, CancellationToken, Task<IList<ReadOnlyMemory<float>>>> embeddingsGenerator, CancellationToken cancellationToken = default);
Task<IEnumerable<string>> SplitAsync(string text, Func<IList<string>, CancellationToken, Task<IList<ReadOnlyMemory<float>>>> embeddingsGenerator, CancellationToken cancellationToken);
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public SemanticTextSplitter(IOptionsMonitor<SemanticTextSplitterOptions> options
}

/// <inheritdoc/>
public async Task<IEnumerable<string>> SplitAsync(string text, Func<IList<string>, CancellationToken, Task<IList<ReadOnlyMemory<float>>>> embeddingsGenerator, CancellationToken cancellationToken = default)
public async Task<IEnumerable<string>> SplitAsync(string text, Func<IList<string>, CancellationToken, Task<IList<ReadOnlyMemory<float>>>> embeddingsGenerator, CancellationToken cancellationToken)
{
// Code inspired by
// https://github.com/run-llama/llama_index/blob/8ed753df970f068f6afc8a83fd51a1f40880de9e/llama-index-packs/llama-index-packs-node-parser-semantic-chunking/llama_index/packs/node_parser_semantic_chunking/base.py
Expand Down
4 changes: 2 additions & 2 deletions tst/Encamina.Enmarcha.AI.Tests/SemanticTextSplitterTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task SplitText_Succeeds()
});

// Act...
var splits = (await semanticTextSplitter.SplitAsync(text, embeddingsGeneratorMock.Object)).ToList();
var splits = (await semanticTextSplitter.SplitAsync(text, embeddingsGeneratorMock.Object, CancellationToken.None)).ToList();

// Assert...
Assert.Equal(2, splits.Count);
Expand All @@ -50,7 +50,7 @@ public async Task SplitText_With_SingleSentence_Returns_OriginalText()
var semanticTextSplitter = new SemanticTextSplitter(optionsMonitor);

// Act...
var splits = (await semanticTextSplitter.SplitAsync(singleSentence, embeddingsGeneratorMock.Object)).ToList();
var splits = (await semanticTextSplitter.SplitAsync(singleSentence, embeddingsGeneratorMock.Object, CancellationToken.None)).ToList();

// Assert...
Assert.Single(splits);
Expand Down

0 comments on commit 560de83

Please sign in to comment.