AxAIService Generated TypeScript API reference. typescript api api/reference build/apidocs/Interface.AxAIService.md interface AxAIService

AxAIService

Defined in: https://github.com/ax-llm/ax/blob/e690b4823b8309e258594064abe941d4cff6ef89/src/ax/ai/types.ts#L1291

Type Parameters

Type ParameterDefault type
TModelunknown
TEmbedModelunknown
TModelKeystring

Methods

chat()

TypeScript
chat(req: Readonly<AxChatRequest<TModel | TModelKey>>, options?: Readonly<AxAIServiceOptions>): Promise<
  | AxChatResponse
| ReadableStream<AxChatResponse>>;

Defined in: https://github.com/ax-llm/ax/blob/e690b4823b8309e258594064abe941d4cff6ef89/src/ax/ai/types.ts#L1327

Parameters

ParameterType
reqReadonly<AxChatRequest<TModel | TModelKey>>
options?Readonly<AxAIServiceOptions>

Returns

Promise< | AxChatResponse | ReadableStream<AxChatResponse>>


embed()

TypeScript
embed(req: Readonly<AxEmbedRequest<TEmbedModel | TModelKey>>, options?: Readonly<AxAIServiceOptions>): Promise<AxEmbedResponse>;

Defined in: https://github.com/ax-llm/ax/blob/e690b4823b8309e258594064abe941d4cff6ef89/src/ax/ai/types.ts#L1331

Parameters

ParameterType
reqReadonly<AxEmbedRequest<TEmbedModel | TModelKey>>
options?Readonly<AxAIServiceOptions>

Returns

Promise<AxEmbedResponse>


getEstimatedCost()

TypeScript
getEstimatedCost(modelUsage?: AxModelUsage): number;

Defined in: https://github.com/ax-llm/ax/blob/e690b4823b8309e258594064abe941d4cff6ef89/src/ax/ai/types.ts#L1344

Parameters

ParameterType
modelUsage?AxModelUsage

Returns

number


getFeatures()

TypeScript
getFeatures(model?: TModel): AxAIFeatures;

Defined in: https://github.com/ax-llm/ax/blob/e690b4823b8309e258594064abe941d4cff6ef89/src/ax/ai/types.ts#L1298

Parameters

ParameterType
model?TModel

Returns

AxAIFeatures


getId()

TypeScript
getId(): string;

Defined in: https://github.com/ax-llm/ax/blob/e690b4823b8309e258594064abe941d4cff6ef89/src/ax/ai/types.ts#L1296

Returns

string


getLastUsedChatModel()

TypeScript
getLastUsedChatModel(): undefined | TModel;

Defined in: https://github.com/ax-llm/ax/blob/e690b4823b8309e258594064abe941d4cff6ef89/src/ax/ai/types.ts#L1303

Returns

undefined | TModel


getLastUsedEmbedModel()

TypeScript
getLastUsedEmbedModel(): undefined | TEmbedModel;

Defined in: https://github.com/ax-llm/ax/blob/e690b4823b8309e258594064abe941d4cff6ef89/src/ax/ai/types.ts#L1304

Returns

undefined | TEmbedModel


getLastUsedModelConfig()

TypeScript
getLastUsedModelConfig(): undefined | AxModelConfig;

Defined in: https://github.com/ax-llm/ax/blob/e690b4823b8309e258594064abe941d4cff6ef89/src/ax/ai/types.ts#L1305

Returns

undefined | AxModelConfig


getLogger()

TypeScript
getLogger(): AxLoggerFunction;

Defined in: https://github.com/ax-llm/ax/blob/e690b4823b8309e258594064abe941d4cff6ef89/src/ax/ai/types.ts#L1301

Returns

AxLoggerFunction


getMetrics()

TypeScript
getMetrics(): AxAIServiceMetrics;

Defined in: https://github.com/ax-llm/ax/blob/e690b4823b8309e258594064abe941d4cff6ef89/src/ax/ai/types.ts#L1300

Returns

AxAIServiceMetrics


getModelList()

TypeScript
getModelList(): 
  | undefined
| AxAIModelList<TModelKey>;

Defined in: https://github.com/ax-llm/ax/blob/e690b4823b8309e258594064abe941d4cff6ef89/src/ax/ai/types.ts#L1299

Returns

| undefined | AxAIModelList<TModelKey>


getName()

TypeScript
getName(): string;

Defined in: https://github.com/ax-llm/ax/blob/e690b4823b8309e258594064abe941d4cff6ef89/src/ax/ai/types.ts#L1297

Returns

string


getOptions()

TypeScript
getOptions(): Readonly<AxAIServiceOptions>;

Defined in: https://github.com/ax-llm/ax/blob/e690b4823b8309e258594064abe941d4cff6ef89/src/ax/ai/types.ts#L1347

Returns

Readonly<AxAIServiceOptions>


openChatSession()?

TypeScript
optional openChatSession(req: Readonly<AxChatRequest<TModel | TModelKey>>, options?: Readonly<AxAIServiceOptions>): Promise<AxChatSession>;

Defined in: https://github.com/ax-llm/ax/blob/e690b4823b8309e258594064abe941d4cff6ef89/src/ax/ai/types.ts#L1322

Parameters

ParameterType
reqReadonly<AxChatRequest<TModel | TModelKey>>
options?Readonly<AxAIServiceOptions>

Returns

Promise<AxChatSession>


resolveChatService()?

TypeScript
optional resolveChatService(req: Readonly<AxChatRequest<TModel | TModelKey>>, options?: Readonly<AxAIServiceOptions>): Promise<{
  model?: string;
  service: Readonly<AxAIService<unknown, unknown, any>>;
}>;

Defined in: https://github.com/ax-llm/ax/blob/e690b4823b8309e258594064abe941d4cff6ef89/src/ax/ai/types.ts#L1314

Resolve a provider before a controlled/tool run; the returned service is pinned.

Parameters

ParameterType
reqReadonly<AxChatRequest<TModel | TModelKey>>
options?Readonly<AxAIServiceOptions>

Returns

Promise<{ model?: string; service: Readonly<AxAIService<unknown, unknown, any>>; }>


setOptions()

TypeScript
setOptions(options: Readonly<AxAIServiceOptions>): void;

Defined in: https://github.com/ax-llm/ax/blob/e690b4823b8309e258594064abe941d4cff6ef89/src/ax/ai/types.ts#L1346

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void


speak()

TypeScript
speak(req: Readonly<AxSpeechRequest<TModel | TModelKey>>, options?: Readonly<AxAIServiceOptions>): Promise<AxChatAudioOutput>;

Defined in: https://github.com/ax-llm/ax/blob/e690b4823b8309e258594064abe941d4cff6ef89/src/ax/ai/types.ts#L1339

Parameters

ParameterType
reqReadonly<AxSpeechRequest<TModel | TModelKey>>
options?Readonly<AxAIServiceOptions>

Returns

Promise<AxChatAudioOutput>


transcribe()

TypeScript
transcribe(req: Readonly<AxTranscriptionRequest<TModel | TModelKey>>, options?: Readonly<AxAIServiceOptions>): Promise<AxTranscriptionResponse>;

Defined in: https://github.com/ax-llm/ax/blob/e690b4823b8309e258594064abe941d4cff6ef89/src/ax/ai/types.ts#L1335

Parameters

ParameterType
reqReadonly<AxTranscriptionRequest<TModel | TModelKey>>
options?Readonly<AxAIServiceOptions>

Returns

Promise<AxTranscriptionResponse>


validateChatRequest()?

TypeScript
optional validateChatRequest(req: Readonly<AxChatRequest<TModel | TModelKey>>, options?: Readonly<AxAIServiceOptions>): void;

Defined in: https://github.com/ax-llm/ax/blob/e690b4823b8309e258594064abe941d4cff6ef89/src/ax/ai/types.ts#L1308

Check request compatibility without network calls, credentials, or state changes.

Parameters

ParameterType
reqReadonly<AxChatRequest<TModel | TModelKey>>
options?Readonly<AxAIServiceOptions>

Returns

void

Docs