Eliassen.Ollama
0.1.85
dotnet add package Eliassen.Ollama --version 0.1.85
NuGet\Install-Package Eliassen.Ollama -Version 0.1.85
<PackageReference Include="Eliassen.Ollama" Version="0.1.85" />
paket add Eliassen.Ollama --version 0.1.85
#r "nuget: Eliassen.Ollama, 0.1.85"
// Install Eliassen.Ollama as a Cake Addin #addin nuget:?package=Eliassen.Ollama&version=0.1.85 // Install Eliassen.Ollama as a Cake Tool #tool nuget:?package=Eliassen.Ollama&version=0.1.85
Eliassen.Ollama
Eliassen.Ollama provides functionality for interacting with the Ollama API, including text embedding, message completion, and language model responses. Let's explore its features:
IOllamaApiClientFactory
Represents a factory for creating instances of the OllamaApiClient.
Methods
- Build: Builds an instance of the OllamaApiClient for the specified host.
OllamaApiClientExtensions
Provides extension methods for the OllamaSharp.OllamaApiClient
class.
Methods
- EnsureModelExistsAsync(ollama, modelName, logger): Ensures that the specified model exists in the Ollama API client.
- GetEmbeddingSingle(client, text, modelName): Retrieves the embedding for the specified text using the specified model synchronously.
- GetEmbeddingSingleAsync(client, text, modelName): Retrieves the embedding for the specified text using the specified model asynchronously.
- GetEmbeddingDouble(client, text, modelName): Retrieves the embedding for the specified text using the specified model synchronously.
- GetEmbeddingDoubleAsync(client, text, modelName): Retrieves the embedding for the specified text using the specified model asynchronously.
OllamaApiClientFactory
Factory class for creating instances of the OllamaSharp.OllamaApiClient
.
Methods
- Constructor(options): Initializes a new instance of the
Eliassen.Ollama.OllamaApiClientFactory
class with the specified options. - Build: Builds a new instance of the
OllamaSharp.OllamaApiClient
with the specified host.
OllamaApiClientOptions
Represents the configuration options for the Ollama API client.
Properties
- Url: Gets or initializes the URL of the Ollama API.
- DefaultModel: Gets or initializes the default model to use with the Ollama API.
OllamaMessageCompletion
Responsible for generating message completions using the Ollama API.
Methods
- Constructor(client): Initializes a new instance of the
Eliassen.Ollama.OllamaMessageCompletion
class. - GetCompletionAsync(modelName, prompt): Generates a completion for the given prompt using the specified model asynchronously.
- GetResponseAsync(promptDetails, userInput): Retrieves a response from the language model based on the provided prompt details and user input asynchronously.
- GetStreamedResponseAsync(promptDetails, userInput, cancellationToken): Gets a streamed response asynchronously based on the provided prompt details and user input.
ServiceCollectionExtensions
Provides extension methods for configuring services related to Ollama.
Methods
- TryAddOllamaServices(services, configuration, ollamaApiClientOptionSection): Configures services for Ollama.
Eliassen.Ollama facilitates easy integration with the Ollama API, enabling various text-related tasks such as embedding, completion, and language model responses.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net8.0
- Eliassen.AI.Abstractions (>= 0.1.85)
- Eliassen.Search.Abstractions (>= 0.1.85)
- Microsoft.Extensions.Configuration.Abstractions (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Diagnostics.HealthChecks (>= 8.0.8)
- Microsoft.Extensions.Logging.Abstractions (>= 8.0.1)
- Microsoft.Extensions.Options.ConfigurationExtensions (>= 8.0.0)
- OllamaSharp (>= 2.1.3)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Eliassen.Ollama:
Package | Downloads |
---|---|
Eliassen.Common.Extensions
Package Description |
GitHub repositories
This package is not used by any popular GitHub repositories.