Skip to content
Docs Try Aspire

AspireOllamaSharpExtensions Methods

Class Methods 8 members
Extension methods for setting up OllamaSharp client in an Hosting.IHostApplicationBuilder.
AddKeyedOllamaApiClient(IHostApplicationBuilder, string, Action<OllamaSharpSettings>) Section titled AddKeyedOllamaApiClient(IHostApplicationBuilder, string, Action<OllamaSharpSettings>) extension AspireOllamaApiClientBuilder
Adds IOllamaApiClient services to the container using the connectionName as the service key.
public static class AspireOllamaSharpExtensions
{
public static AspireOllamaApiClientBuilder AddKeyedOllamaApiClient(
this IHostApplicationBuilder builder,
string connectionName,
Action<OllamaSharpSettings>? configureSettings = null)
{
// ...
}
}
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to.
connectionName string A name used to retrieve the connection string from the ConnectionStrings configuration section.
configureSettings Action<OllamaSharpSettings> optional An optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration.
UriFormatException Thrown when no Ollama endpoint is provided.
AddKeyedOllamaApiClient(IHostApplicationBuilder, object, string, Action<OllamaSharpSettings>) Section titled AddKeyedOllamaApiClient(IHostApplicationBuilder, object, string, Action<OllamaSharpSettings>) extension AspireOllamaApiClientBuilder
Adds IOllamaApiClient services to the container using the specified serviceKey.
public static class AspireOllamaSharpExtensions
{
public static AspireOllamaApiClientBuilder AddKeyedOllamaApiClient(
this IHostApplicationBuilder builder,
object serviceKey,
string connectionName,
Action<OllamaSharpSettings>? configureSettings = null)
{
// ...
}
}
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to.
serviceKey object A unique key that identifies this instance of the Ollama client service.
connectionName string A name used to retrieve the connection string from the ConnectionStrings configuration section.
configureSettings Action<OllamaSharpSettings> optional An optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration.
UriFormatException Thrown when no Ollama endpoint is provided.
AddKeyedOllamaApiClient(IHostApplicationBuilder, object, OllamaSharpSettings) Section titled AddKeyedOllamaApiClient(IHostApplicationBuilder, object, OllamaSharpSettings) extension AspireOllamaApiClientBuilder
Adds IOllamaApiClient services to the container using the specified serviceKey.
public static class AspireOllamaSharpExtensions
{
public static AspireOllamaApiClientBuilder AddKeyedOllamaApiClient(
this IHostApplicationBuilder builder,
object serviceKey,
OllamaSharpSettings settings)
{
// ...
}
}
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to.
serviceKey object A unique key that identifies this instance of the Ollama client service.
settings OllamaSharpSettings The settings required to configure the IOllamaApiClient.
UriFormatException Thrown when no Ollama endpoint is provided.
AddKeyedOllamaSharpChatClient(IHostApplicationBuilder, string, Action<OllamaSharpSettings>) Section titled AddKeyedOllamaSharpChatClient(IHostApplicationBuilder, string, Action<OllamaSharpSettings>) extension
Adds IOllamaApiClient and AI.IChatClient services to the container using the connectionName as the service key.
public static class AspireOllamaSharpExtensions
{
public static void AddKeyedOllamaSharpChatClient(
this IHostApplicationBuilder builder,
string connectionName,
Action<OllamaSharpSettings>? configureSettings = null)
{
// ...
}
}
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to.
connectionName string A name used to retrieve the connection string from the ConnectionStrings configuration section.
configureSettings Action<OllamaSharpSettings> optional An optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration.
InvalidOperationException Thrown when no Ollama endpoint is provided.
AddKeyedOllamaSharpEmbeddingGenerator(IHostApplicationBuilder, string, Action<OllamaSharpSettings>) Section titled AddKeyedOllamaSharpEmbeddingGenerator(IHostApplicationBuilder, string, Action<OllamaSharpSettings>) extension
Adds IOllamaApiClient and AI.IEmbeddingGenerator`2 services to the container using the connectionName as the service key.
public static class AspireOllamaSharpExtensions
{
public static void AddKeyedOllamaSharpEmbeddingGenerator(
this IHostApplicationBuilder builder,
string connectionName,
Action<OllamaSharpSettings>? configureSettings = null)
{
// ...
}
}
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to.
connectionName string A name used to retrieve the connection string from the ConnectionStrings configuration section.
configureSettings Action<OllamaSharpSettings> optional An optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration.
InvalidOperationException Thrown when no Ollama endpoint is provided.
AddOllamaApiClient(IHostApplicationBuilder, string, Action<OllamaSharpSettings>) Section titled AddOllamaApiClient(IHostApplicationBuilder, string, Action<OllamaSharpSettings>) extension AspireOllamaApiClientBuilder
Adds IOllamaApiClient services to the container.
public static class AspireOllamaSharpExtensions
{
public static AspireOllamaApiClientBuilder AddOllamaApiClient(
this IHostApplicationBuilder builder,
string connectionName,
Action<OllamaSharpSettings>? configureSettings = null)
{
// ...
}
}
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to.
connectionName string A name used to retrieve the connection string from the ConnectionStrings configuration section.
configureSettings Action<OllamaSharpSettings> optional An optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration.
UriFormatException Thrown when no Ollama endpoint is provided.
AddOllamaSharpChatClient(IHostApplicationBuilder, string, Action<OllamaSharpSettings>) Section titled AddOllamaSharpChatClient(IHostApplicationBuilder, string, Action<OllamaSharpSettings>) extension
Adds IOllamaApiClient and AI.IChatClient services to the container.
public static class AspireOllamaSharpExtensions
{
public static void AddOllamaSharpChatClient(
this IHostApplicationBuilder builder,
string connectionName,
Action<OllamaSharpSettings>? configureSettings = null)
{
// ...
}
}
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to.
connectionName string A name used to retrieve the connection string from the ConnectionStrings configuration section.
configureSettings Action<OllamaSharpSettings> optional An optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration.
InvalidOperationException Thrown when no Ollama endpoint is provided.
AddOllamaSharpEmbeddingGenerator(IHostApplicationBuilder, string, Action<OllamaSharpSettings>) Section titled AddOllamaSharpEmbeddingGenerator(IHostApplicationBuilder, string, Action<OllamaSharpSettings>) extension
Adds IOllamaApiClient and AI.IEmbeddingGenerator`2 services to the container.
public static class AspireOllamaSharpExtensions
{
public static void AddOllamaSharpEmbeddingGenerator(
this IHostApplicationBuilder builder,
string connectionName,
Action<OllamaSharpSettings>? configureSettings = null)
{
// ...
}
}
builder IHostApplicationBuilder The Hosting.IHostApplicationBuilder to read config from and add services to.
connectionName string A name used to retrieve the connection string from the ConnectionStrings configuration section.
configureSettings Action<OllamaSharpSettings> optional An optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration.
InvalidOperationException Thrown when no Ollama endpoint is provided.