Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions LLama/Extensions/LLamaExecutorExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ private sealed class LLamaExecutorChatClient(
public void Dispose() { }

/// <inheritdoc/>
public TService? GetService<TService>(object? key = null) where TService : class =>
typeof(TService) == typeof(ILLamaExecutor) ? (TService)_executor :
this as TService;
public object? GetService(Type serviceType, object? key = null) =>
key is not null ? null :
serviceType?.IsInstanceOfType(_executor) is true ? _executor :
serviceType?.IsInstanceOfType(this) is true ? this :
null;

/// <inheritdoc/>
public async Task<ChatCompletion> CompleteAsync(
Expand Down
8 changes: 5 additions & 3 deletions LLama/LLamaEmbedder.EmbeddingGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@ public partial class LLamaEmbedder
dimensions: EmbeddingSize);

/// <inheritdoc />
TService? IEmbeddingGenerator<string, Embedding<float>>.GetService<TService>(object? key) where TService : class =>
typeof(TService) == typeof(LLamaContext) ? (TService)(object)Context :
this as TService;
object? IEmbeddingGenerator<string, Embedding<float>>.GetService(Type serviceType, object? key) =>
key is not null ? null :
serviceType?.IsInstanceOfType(Context) is true ? Context :
serviceType?.IsInstanceOfType(this) is true ? this :
null;

/// <inheritdoc />
async Task<GeneratedEmbeddings<Embedding<float>>> IEmbeddingGenerator<string, Embedding<float>>.GenerateAsync(IEnumerable<string> values, EmbeddingGenerationOptions? options, CancellationToken cancellationToken)
Expand Down
2 changes: 1 addition & 1 deletion LLama/LLamaSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.AI.Abstractions" Version="9.0.0-preview.9.24556.5" />
<PackageReference Include="Microsoft.Extensions.AI.Abstractions" Version="9.0.1-preview.1.24570.5" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.0" />
<PackageReference Include="System.Numerics.Tensors" Version="9.0.0" />
</ItemGroup>
Expand Down
Loading