Skip to content
DocsTry Aspire
DocsTry

AspireOllamaSharpExtensions Methods

ClassMethods8 members
Extension methods for setting up OllamaSharp client in an Hosting.IHostApplicationBuilder.
AddKeyedOllamaApiClient(IHostApplicationBuilder, string, Action<OllamaSharpSettings>)Section titled AddKeyedOllamaApiClient(IHostApplicationBuilder, string, Action<OllamaSharpSettings>)extensionAspireOllamaApiClientBuilder
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)
{
// ...
}
}
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.
connectionNamestringA name used to retrieve the connection string from the ConnectionStrings configuration section.
configureSettingsAction<OllamaSharpSettings>optionalAn optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration.
UriFormatExceptionThrown when no Ollama endpoint is provided.
AddKeyedOllamaApiClient(IHostApplicationBuilder, object, string, Action<OllamaSharpSettings>)Section titled AddKeyedOllamaApiClient(IHostApplicationBuilder, object, string, Action<OllamaSharpSettings>)extensionAspireOllamaApiClientBuilder
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)
{
// ...
}
}
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.
serviceKeyobjectA unique key that identifies this instance of the Ollama client service.
connectionNamestringA name used to retrieve the connection string from the ConnectionStrings configuration section.
configureSettingsAction<OllamaSharpSettings>optionalAn optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration.
UriFormatExceptionThrown when no Ollama endpoint is provided.
AddKeyedOllamaApiClient(IHostApplicationBuilder, object, OllamaSharpSettings)Section titled AddKeyedOllamaApiClient(IHostApplicationBuilder, object, OllamaSharpSettings)extensionAspireOllamaApiClientBuilder
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)
{
// ...
}
}
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.
serviceKeyobjectA unique key that identifies this instance of the Ollama client service.
settingsOllamaSharpSettingsThe settings required to configure the IOllamaApiClient.
UriFormatExceptionThrown 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)
{
// ...
}
}
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.
connectionNamestringA name used to retrieve the connection string from the ConnectionStrings configuration section.
configureSettingsAction<OllamaSharpSettings>optionalAn optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration.
InvalidOperationExceptionThrown 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)
{
// ...
}
}
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.
connectionNamestringA name used to retrieve the connection string from the ConnectionStrings configuration section.
configureSettingsAction<OllamaSharpSettings>optionalAn optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration.
InvalidOperationExceptionThrown when no Ollama endpoint is provided.
AddOllamaApiClient(IHostApplicationBuilder, string, Action<OllamaSharpSettings>)Section titled AddOllamaApiClient(IHostApplicationBuilder, string, Action<OllamaSharpSettings>)extensionAspireOllamaApiClientBuilder
Adds IOllamaApiClient services to the container.
public static class AspireOllamaSharpExtensions
{
public static AspireOllamaApiClientBuilder AddOllamaApiClient(
this IHostApplicationBuilder builder,
string connectionName,
Action<OllamaSharpSettings>? configureSettings = null)
{
// ...
}
}
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.
connectionNamestringA name used to retrieve the connection string from the ConnectionStrings configuration section.
configureSettingsAction<OllamaSharpSettings>optionalAn optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration.
UriFormatExceptionThrown 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)
{
// ...
}
}
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.
connectionNamestringA name used to retrieve the connection string from the ConnectionStrings configuration section.
configureSettingsAction<OllamaSharpSettings>optionalAn optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration.
InvalidOperationExceptionThrown 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)
{
// ...
}
}
builderIHostApplicationBuilderThe Hosting.IHostApplicationBuilder to read config from and add services to.
connectionNamestringA name used to retrieve the connection string from the ConnectionStrings configuration section.
configureSettingsAction<OllamaSharpSettings>optionalAn optional delegate that can be used for customizing options. It's invoked after the settings are read from the configuration.
InvalidOperationExceptionThrown when no Ollama endpoint is provided.