IntelligenceX
Class

IntelligenceXClient

Namespace IntelligenceX.OpenAI
Assembly IntelligenceX
Implements
IDisposable IAsyncDisposable
Modifiers sealed

Main client for OpenAI app-server and native transports.

Inheritance

  • Object
  • IntelligenceXClient

Methods

ChatAsync 2 overloads
public async Task<TurnInfo> ChatAsync(ChatInput input, ChatOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task<TurnInfo>

Sends a text-only chat request.

Parameters

text System.String
Prompt text.
model System.String = null
Optional model override.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
ChatAsync(IntelligenceX.OpenAI.Chat.ChatInput input, IntelligenceX.OpenAI.Chat.ChatOptions options, System.Threading.CancellationToken cancellationToken) #

Sends a chat request with a structured input.

Parameters

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

Sends a chat request with a local image.

Parameters

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

Sends a chat request with an image URL.

Parameters

text System.String
Prompt text.
imageUrl System.String
Image URL.
options IntelligenceX.OpenAI.Chat.ChatOptions = null
Chat options.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public IntelligenceXClient ConfigureDefaults(String model = null, String workingDirectory = null, String approvalPolicy = null, SandboxPolicy sandboxPolicy = null) #
Returns: IntelligenceXClient

Configures default model and execution settings.

Parameters

model System.String = null
Default model override.
workingDirectory System.String = null
Default working directory.
approvalPolicy System.String = null
Default approval policy.
sandboxPolicy IntelligenceX.OpenAI.AppServer.SandboxPolicy = null
Default sandbox policy.

Returns

The current client instance.

public IntelligenceXClient ConfigureWorkspace(String workingDirectory, Boolean allowNetwork = false) #
Returns: IntelligenceXClient

Configures defaults for workspace-based tool access.

Parameters

workingDirectory System.String
Workspace path.
allowNetwork System.Boolean = false
Whether network access is allowed.

Returns

The current client instance.

public static async Task<IntelligenceXClient> ConnectAsync(IntelligenceXClientOptions options = null, CancellationToken cancellationToken = null) #
Returns: Task<IntelligenceXClient>

Connects to the configured transport and returns a ready client.

Parameters

options IntelligenceX.OpenAI.IntelligenceXClientOptions = null
Optional client options.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public virtual Void Dispose() #
Returns: Void

Disposes the client and underlying transport.

public virtual ValueTask DisposeAsync() #
Returns: ValueTask

Disposes the client and underlying transport asynchronously.

public Task<AccountInfo> GetAccountAsync(CancellationToken cancellationToken = null) #
Returns: Task<AccountInfo>

Retrieves account information.

Parameters

cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public Task<HealthCheckResult> HealthCheckAsync(String method = null, Nullable<TimeSpan> timeout = null, CancellationToken cancellationToken = null) #
Returns: Task<HealthCheckResult>

Executes a health check call.

Parameters

method System.String = null
Optional method name to call.
timeout System.Nullable{System.TimeSpan} = null
Optional timeout.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public Task InitializeAsync(ClientInfo clientInfo, CancellationToken cancellationToken = null) #
Returns: Task

Initializes the transport with client metadata.

Parameters

clientInfo IntelligenceX.OpenAI.AppServer.ClientInfo
Client identity information.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public Task<ModelListResult> ListModelsAsync(CancellationToken cancellationToken = null) #
Returns: Task<ModelListResult>

Lists available models.

Parameters

cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public Task LoginApiKeyAsync(String apiKey, CancellationToken cancellationToken = null) #
Returns: Task

Logs in using an API key (app-server transport only).

Parameters

apiKey System.String
API key.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public async Task LoginChatGptAndWaitAsync(Action<String> onUrl = null, Func<String, Task<String>> onPrompt = null, Boolean useLocalListener = true, Nullable<TimeSpan> timeout = null, CancellationToken cancellationToken = null) #
Returns: Task

Starts a ChatGPT login flow and waits for completion.

Parameters

onUrl System.Action{System.String} = null
Callback for the login URL.
onPrompt System.Func{System.String,System.Threading.Tasks.Task{System.String}} = null
Callback for interactive prompts.
useLocalListener System.Boolean = true
Whether to use a local listener.
timeout System.Nullable{System.TimeSpan} = null
Optional timeout.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
LoginChatGptAsync 2 overloads
public Task<ChatGptLoginStart> LoginChatGptAsync(CancellationToken cancellationToken = null) #
Returns: Task<ChatGptLoginStart>

Starts a ChatGPT login flow.

Parameters

cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public Task<ChatGptLoginStart> LoginChatGptAsync(Action<String> onUrl, Func<String, Task<String>> onPrompt, Boolean useLocalListener = true, Nullable<TimeSpan> timeout = null, CancellationToken cancellationToken = null) #
Returns: Task<ChatGptLoginStart>

Starts a ChatGPT login flow with callbacks and options.

Parameters

onUrl System.Action{System.String}
Callback for the login URL.
onPrompt System.Func{System.String,System.Threading.Tasks.Task{System.String}}
Callback for interactive prompts.
useLocalListener System.Boolean = true
Whether to use a local listener.
timeout System.Nullable{System.TimeSpan} = null
Optional timeout.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public Task LogoutAsync(CancellationToken cancellationToken = null) #
Returns: Task

Logs out of the current session.

Parameters

cancellationToken System.Threading.CancellationToken = null
Cancellation token.
public AppServerClient RequireAppServer() #
Returns: AppServerClient

Returns the underlying app-server client or throws if not active.

public async Task<ThreadInfo> StartNewThreadAsync(String model = null, String currentDirectory = null, String approvalPolicy = null, String sandbox = null, CancellationToken cancellationToken = null) #
Returns: Task<ThreadInfo>

Starts a new thread and sets it as the current thread.

Parameters

model System.String = null
Optional model override.
currentDirectory System.String = null
Optional working directory.
approvalPolicy System.String = null
Optional approval policy.
sandbox System.String = null
Optional sandbox policy name.
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.

public Task<ThreadInfo> UseThreadAsync(String threadId, CancellationToken cancellationToken = null) #
Returns: Task<ThreadInfo>

Resumes an existing thread and sets it as the current thread.

Parameters

threadId System.String
Thread id.
cancellationToken System.Threading.CancellationToken = null
Cancellation token.

Properties

public OpenAITransportKind TransportKind { get; } #

Gets the active transport kind.

public AppServerClient RawClient { get; } #

Gets the underlying app-server client when using app-server transport.

Events

public event EventHandler<String> DeltaReceived #

Raised when streaming deltas are received.

public event EventHandler<RpcCallStartedEventArgs> RpcCallStarted #

Raised when an RPC call starts.

public event EventHandler<RpcCallCompletedEventArgs> RpcCallCompleted #

Raised when an RPC call completes.

public event EventHandler<LoginEventArgs> LoginStarted #

Raised when a login flow starts.

public event EventHandler<LoginEventArgs> LoginCompleted #

Raised when a login flow completes.

public event EventHandler<String> ProtocolLineReceived #

Raised when a protocol line is received from the transport.

public event EventHandler<String> StandardErrorReceived #

Raised when the transport writes to standard error.