IntelligenceX

API Reference

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 requiredposition: 0
Prompt text.
model System.String = null optionalposition: 1
Optional model override.
cancellationToken System.Threading.CancellationToken = null optionalposition: 2
Cancellation token.

Returns

A task that resolves to TurnInfo.

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 required
Chat input.
options IntelligenceX.OpenAI.Chat.ChatOptions required
Chat options.
cancellationToken System.Threading.CancellationToken required
Cancellation token.

Returns

A task that resolves to TurnInfo.

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 requiredposition: 0
Prompt text.
imagePath System.String requiredposition: 1
Local image path.
options IntelligenceX.OpenAI.Chat.ChatOptions = null optionalposition: 2
Chat options.
cancellationToken System.Threading.CancellationToken = null optionalposition: 3
Cancellation token.

Returns

A task that resolves to TurnInfo.

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 requiredposition: 0
Prompt text.
imageUrl System.String requiredposition: 1
Image URL.
options IntelligenceX.OpenAI.Chat.ChatOptions = null optionalposition: 2
Chat options.
cancellationToken System.Threading.CancellationToken = null optionalposition: 3
Cancellation token.

Returns

A task that resolves to TurnInfo.

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 optionalposition: 0
Default model override.
workingDirectory System.String = null optionalposition: 1
Default working directory.
approvalPolicy System.String = null optionalposition: 2
Default approval policy.
sandboxPolicy IntelligenceX.OpenAI.AppServer.SandboxPolicy = null optionalposition: 3
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 requiredposition: 0
Workspace path.
allowNetwork System.Boolean = false optionalposition: 1
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 optionalposition: 0
Optional client options.
cancellationToken System.Threading.CancellationToken = null optionalposition: 1
Cancellation token.

Returns

A task that resolves to IntelligenceXClient.

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.

Returns

A value task that completes when the operation finishes.

public async Task EnsureChatGptLoginAsync(Boolean forceLogin = false, Action<String> onUrl = null, Func<String, Task<String>> onPrompt = null, Boolean useLocalListener = true, Nullable<TimeSpan> timeout = null, CancellationToken cancellationToken = null) #
Returns: Task

Ensures a valid ChatGPT login is available by using cached credentials when possible and falling back to the OAuth flow.

Parameters

forceLogin System.Boolean = false optionalposition: 0
When true, always runs the login flow even if cached credentials appear valid.
onUrl System.Action{System.String} = null optionalposition: 1
Callback for the login URL.
onPrompt System.Func{System.String,System.Threading.Tasks.Task{System.String}} = null optionalposition: 2
Callback for interactive prompts.
useLocalListener System.Boolean = true optionalposition: 3
Whether to use a local listener.
timeout System.Nullable{System.TimeSpan} = null optionalposition: 4
Optional timeout.
cancellationToken System.Threading.CancellationToken = null optionalposition: 5
Cancellation token.

Returns

A task that completes when the operation finishes.

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

Retrieves account information.

Parameters

cancellationToken System.Threading.CancellationToken = null optionalposition: 0
Cancellation token.

Returns

A task that resolves to AccountInfo.

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 optionalposition: 0
Optional method name to call.
timeout System.Nullable{System.TimeSpan} = null optionalposition: 1
Optional timeout.
cancellationToken System.Threading.CancellationToken = null optionalposition: 2
Cancellation token.

Returns

A task that resolves to HealthCheckResult.

public Task InitializeAsync(ClientInfo clientInfo, CancellationToken cancellationToken = null) #
Returns: Task

Initializes the transport with client metadata.

Parameters

clientInfo IntelligenceX.OpenAI.AppServer.ClientInfo requiredposition: 0
Client identity information.
cancellationToken System.Threading.CancellationToken = null optionalposition: 1
Cancellation token.

Returns

A task that completes when the operation finishes.

public Task<ModelListResult> ListModelsAsync(CancellationToken cancellationToken = null) #
Returns: Task<ModelListResult>

Lists available models.

Parameters

cancellationToken System.Threading.CancellationToken = null optionalposition: 0
Cancellation token.

Returns

A task that resolves to ModelListResult.

public Task LoginApiKeyAsync(String apiKey, CancellationToken cancellationToken = null) #
Returns: Task

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

Parameters

apiKey System.String requiredposition: 0
API key.
cancellationToken System.Threading.CancellationToken = null optionalposition: 1
Cancellation token.

Returns

A task that completes when the operation finishes.

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 optionalposition: 0
Callback for the login URL.
onPrompt System.Func{System.String,System.Threading.Tasks.Task{System.String}} = null optionalposition: 1
Callback for interactive prompts.
useLocalListener System.Boolean = true optionalposition: 2
Whether to use a local listener.
timeout System.Nullable{System.TimeSpan} = null optionalposition: 3
Optional timeout.
cancellationToken System.Threading.CancellationToken = null optionalposition: 4
Cancellation token.

Returns

A task that completes when the operation finishes.

LoginChatGptAsync 2 overloads
public Task<ChatGptLoginStart> LoginChatGptAsync(CancellationToken cancellationToken = null) #
Returns: Task<ChatGptLoginStart>

Starts a ChatGPT login flow.

Parameters

cancellationToken System.Threading.CancellationToken = null optionalposition: 0
Cancellation token.

Returns

A task that resolves to ChatGptLoginStart.

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} requiredposition: 0
Callback for the login URL.
onPrompt System.Func{System.String,System.Threading.Tasks.Task{System.String}} requiredposition: 1
Callback for interactive prompts.
useLocalListener System.Boolean = true optionalposition: 2
Whether to use a local listener.
timeout System.Nullable{System.TimeSpan} = null optionalposition: 3
Optional timeout.
cancellationToken System.Threading.CancellationToken = null optionalposition: 4
Cancellation token.

Returns

A task that resolves to ChatGptLoginStart.

public Task LogoutAsync(CancellationToken cancellationToken = null) #
Returns: Task

Logs out of the current session.

Parameters

cancellationToken System.Threading.CancellationToken = null optionalposition: 0
Cancellation token.

Returns

A task that completes when the operation finishes.

public AppServerClient RequireAppServer() #
Returns: AppServerClient

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

Returns

The resulting AppServerClient.

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 optionalposition: 0
Optional model override.
currentDirectory System.String = null optionalposition: 1
Optional working directory.
approvalPolicy System.String = null optionalposition: 2
Optional approval policy.
sandbox System.String = null optionalposition: 3
Optional sandbox policy name.
cancellationToken System.Threading.CancellationToken = null optionalposition: 4
Cancellation token.

Returns

A task that resolves to ThreadInfo.

public IDisposable SubscribeDelta(Action<String> onDelta) #
Returns: IDisposable

Subscribes to streaming text deltas.

Parameters

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

Returns

A subscription token that should be disposed to unsubscribe.

public async 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 requiredposition: 0
Thread id.
cancellationToken System.Threading.CancellationToken = null optionalposition: 1
Cancellation token.

Returns

A task that resolves to ThreadInfo.

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<IntelligenceXTurnCompletedEventArgs> TurnCompleted #

Raised when a chat turn completes, including optional usage metadata.

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.