AsposeLLMApi.SendMessageAsync

AsposeLLMApi.SendMessageAsync method

Sends a user message to the current chat session, creating one first if CurrentChatSessionId is empty.

When a session already exists, the preset argument is NOT re-applied to the existing session — the session keeps the parameters it was started with. To change parameters mid-conversation, start a new session via StartNewChatAsync with the desired preset and then send through SendMessageToSessionAsync.

public Task<string> SendMessageAsync(string message, IEnumerable<byte[]>? media = null,
    PresetCoreBase? preset = null, CancellationToken cancellationToken = default)
ParameterTypeDescription
messageStringThe message text to send.
mediaIEnumerable`1Optional media payloads for multimodal sessions.
presetPresetCoreBasePreset that supplies chat / context / sampler parameters when a fresh session is created by this call. Null → DefaultPreset.
cancellationTokenCancellationTokenCancellation token.

Return Value

Assistant response text.

Exceptions

exceptioncondition
ObjectDisposedExceptionThrown when the API has been disposed.
ExceptionThrown when no license is set.

See Also