AIChatServiceOptions Class

Configuration options for the AIChatService.

Inheritance

Object

AIChatServiceOptions

Namespace: Radzen

Assembly: Radzen.Blazor.dll

Syntax

public class AIChatServiceOptions

Constructors

AIChatServiceOptionsLink to this section

Configuration options for the AIChatService.

Declaration
public AIChatServiceOptions()

Properties

ApiKeyLink to this section

Gets or sets the API key sent with the ApiKeyHeader header. Server-side only: configure it in Blazor Server or in the server that hosts a WebAssembly application and forwards the requests of Proxy. A key configured in the browser is visible to every user, so the service throws when a WebAssembly application sets one.

Declaration
public string ApiKey { get; set; }
Property Value
Type Description
stringGets or sets the API key sent with the ApiKeyHeader header. Server-side only: configure it in Blazor Server or in the server that hosts a WebAssembly application and forwards the requests of Proxy. A key configured in the browser is visible to every user, so the service throws when a WebAssembly application sets one.

ApiKeyHeaderLink to this section

Gets or sets the header name for the API key (e.g., 'Authorization' or 'api-key').

Declaration
public string ApiKeyHeader { get; set; }
Property Value
Type Description
stringGets or sets the header name for the API key (e.g., 'Authorization' or 'api-key').

EmbeddingsEndpointLink to this section

Gets or sets the embeddings endpoint URL. When not set it is derived from Endpoint by replacing chat/completions with embeddings.

Declaration
public string EmbeddingsEndpoint { get; set; }
Property Value
Type Description
stringGets or sets the embeddings endpoint URL. When not set it is derived from Endpoint by replacing chat/completions with embeddings.

EmbeddingsModelLink to this section

Gets or sets the embeddings model name (e.g., 'text-embedding-3-small').

Declaration
public string EmbeddingsModel { get; set; }
Property Value
Type Description
stringGets or sets the embeddings model name (e.g., 'text-embedding-3-small').

EmbeddingsProxyLink to this section

Gets or sets the proxy URL for embeddings requests, if any. When not set and Proxy is set it is derived from it by replacing chat/completions with embeddings.

Declaration
public string EmbeddingsProxy { get; set; }
Property Value
Type Description
stringGets or sets the proxy URL for embeddings requests, if any. When not set and Proxy is set it is derived from it by replacing chat/completions with embeddings.

EndpointLink to this section

Gets or sets the endpoint URL for the AI service.

Declaration
public string Endpoint { get; set; }
Property Value
Type Description
stringGets or sets the endpoint URL for the AI service.

MaxMessagesLink to this section

Gets or sets the maximum number of messages to keep in conversation memory.

Declaration
public int MaxMessages { get; set; }
Property Value
Type Description
intGets or sets the maximum number of messages to keep in conversation memory.

MaxTokensLink to this section

Gets or sets the maximum number of tokens to generate in the response.

Declaration
public int? MaxTokens { get; set; }
Property Value
Type Description
int?Gets or sets the maximum number of tokens to generate in the response.

ModelLink to this section

Gets or sets the model name to use for executing chat completions (e.g., 'gpt-3.5-turbo').

Declaration
public string Model { get; set; }
Property Value
Type Description
stringGets or sets the model name to use for executing chat completions (e.g., 'gpt-3.5-turbo').

ProxyLink to this section

Gets or sets the proxy URL for the AI service, if any. If set, this will override the Endpoint.

Declaration
public string Proxy { get; set; }
Property Value
Type Description
stringGets or sets the proxy URL for the AI service, if any. If set, this will override the Endpoint.

SessionMaxAgeHoursLink to this section

Gets or sets the maximum age in hours for conversation sessions before cleanup.

Declaration
public int SessionMaxAgeHours { get; set; }
Property Value
Type Description
intGets or sets the maximum age in hours for conversation sessions before cleanup.

SystemPromptLink to this section

Gets or sets the system prompt for the AI assistant.

Declaration
public string SystemPrompt { get; set; }
Property Value
Type Description
stringGets or sets the system prompt for the AI assistant.

TemperatureLink to this section

Gets or sets the temperature for the AI model (0.0 to 2.0). Set to 0.0 for deterministic responses, higher values for more creative outputs.

Declaration
public double Temperature { get; set; }
Property Value
Type Description
doubleGets or sets the temperature for the AI model (0.0 to 2.0). Set to 0.0 for deterministic responses, higher values for more creative outputs.

Methods

GetEmbeddingsEndpointLink to this section

Gets the effective embeddings endpoint: EmbeddingsEndpoint or the one derived from Endpoint.

Declaration
public string GetEmbeddingsEndpoint()
Returns
Type Description
string

GetEmbeddingsProxyLink to this section

Gets the effective embeddings proxy: EmbeddingsProxy or the one derived from Proxy, or null.

Declaration
public string GetEmbeddingsProxy()
Returns
Type Description
string
An error has occurred. This app may no longer respond until reloaded. Reload 🗙