IntelligenceX
Class

EasySession

Namespace IntelligenceX.OpenAI
Assembly IntelligenceX
Implements
IDisposable IAsyncDisposable
Modifiers sealed

Provides a simplified session wrapper for chat interactions.

Inheritance

  • Object
  • EasySession

Methods

public async Task<EasyChatResult> AskAsync(String text, EasyChatOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task<EasyChatResult>

Sends a text-only chat request and returns a simplified result.

Parameters

text System.String
Prompt text.
options IntelligenceX.OpenAI.EasyChatOptions = null
Optional chat options.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task<EasyChatResult> AskWithImagePathAsync(String text, String imagePath, EasyChatOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task<EasyChatResult>

Sends a chat request with a local image and returns a simplified result.

Parameters

text System.String
Prompt text.
imagePath System.String
Local image path.
options IntelligenceX.OpenAI.EasyChatOptions = null
Optional chat options.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task<EasyChatResult> AskWithImageUrlAsync(String text, String imageUrl, EasyChatOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task<EasyChatResult>

Sends a chat request with an image URL and returns a simplified result.

Parameters

text System.String
Prompt text.
imageUrl System.String
Image URL.
options IntelligenceX.OpenAI.EasyChatOptions = null
Optional chat options.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
ChatAsync 2 overloads
public Task<TurnInfo> ChatAsync(String text, CancellationToken cancellationToken = null) #
Returns: Task<TurnInfo>

Sends a text-only chat request.

Parameters

text System.String
Prompt text.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task<TurnInfo> ChatAsync(ChatInput input, EasyChatOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task<TurnInfo>

Sends a chat request with the specified input.

Parameters

input IntelligenceX.OpenAI.Chat.ChatInput
Chat input payload.
options IntelligenceX.OpenAI.EasyChatOptions = null
Optional chat options.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public Task<TurnInfo> ChatWithImagePathAsync(String text, String imagePath, EasyChatOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task<TurnInfo>

Sends a chat request with a local image and returns the raw turn info.

Parameters

text System.String
Prompt text.
imagePath System.String
Local image path.
options IntelligenceX.OpenAI.EasyChatOptions = null
Optional chat options.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public Task<TurnInfo> ChatWithImageUrlAsync(String text, String imageUrl, EasyChatOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task<TurnInfo>

Sends a chat request with an image URL and returns the raw turn info.

Parameters

text System.String
Prompt text.
imageUrl System.String
Image URL.
options IntelligenceX.OpenAI.EasyChatOptions = null
Optional chat options.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public virtual Void Dispose() #
Returns: Void

Disposes the underlying client synchronously.

public virtual ValueTask DisposeAsync() #
Returns: ValueTask

Disposes the underlying client asynchronously.

public async Task EnsureLoggedInAsync(CancellationToken cancellationToken = null) #
Returns: Task

Ensures the session is authenticated before issuing requests.

Parameters

cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public static async Task<EasySession> StartAsync(EasySessionOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task<EasySession>

Creates and initializes a new easy session.

Parameters

options IntelligenceX.OpenAI.EasySessionOptions = null
Optional session options.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public IDisposable SubscribeDelta(Action<String> onDelta) #
Returns: IDisposable

Subscribes to streaming text deltas.

Parameters

onDelta System.Action{System.String}
Callback invoked for each delta.

Returns

A subscription token that should be disposed to unsubscribe.

Properties

public IntelligenceXClient Client { get; } #

Gets the underlying client instance.