EasySession
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) #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) #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) #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.
public Task<TurnInfo> ChatAsync(String text, CancellationToken cancellationToken = null) #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) #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) #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) #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 ValueTask DisposeAsync() #ValueTaskDisposes the underlying client asynchronously.
public async Task EnsureLoggedInAsync(CancellationToken cancellationToken = null) #TaskEnsures 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) #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) #IDisposableSubscribes 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.
Inherited Methods
public override Boolean Equals(Object obj) #BooleanParameters
- obj Object
Properties
public IntelligenceXClient Client { get; } #Gets the underlying client instance.