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/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/ai/types.ts#L1333

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/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/ai/types.ts#L1369

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/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/ai/types.ts#L1373

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/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/ai/types.ts#L1386

Parameters

ParameterType
modelUsage?AxModelUsage

Returns

number


getFeatures()

TypeScript
getFeatures(model?: TModel): AxAIFeatures;

Defined in: https://github.com/ax-llm/ax/blob/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/ai/types.ts#L1340

Parameters

ParameterType
model?TModel

Returns

AxAIFeatures


getId()

TypeScript
getId(): string;

Defined in: https://github.com/ax-llm/ax/blob/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/ai/types.ts#L1338

Returns

string


getLastUsedChatModel()

TypeScript
getLastUsedChatModel(): TModel | undefined;

Defined in: https://github.com/ax-llm/ax/blob/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/ai/types.ts#L1345

Returns

TModel | undefined


getLastUsedEmbedModel()

TypeScript
getLastUsedEmbedModel(): TEmbedModel | undefined;

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

Returns

TEmbedModel | undefined


getLastUsedModelConfig()

TypeScript
getLastUsedModelConfig(): AxModelConfig | undefined;

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

Returns

AxModelConfig | undefined


getLogger()

TypeScript
getLogger(): AxLoggerFunction;

Defined in: https://github.com/ax-llm/ax/blob/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/ai/types.ts#L1343

Returns

AxLoggerFunction


getMetrics()

TypeScript
getMetrics(): AxAIServiceMetrics;

Defined in: https://github.com/ax-llm/ax/blob/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/ai/types.ts#L1342

Returns

AxAIServiceMetrics


getModelList()

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

Defined in: https://github.com/ax-llm/ax/blob/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/ai/types.ts#L1341

Returns

| AxAIModelList<TModelKey> | undefined


getName()

TypeScript
getName(): string;

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

Returns

string


getOptions()

TypeScript
getOptions(): Readonly<AxAIServiceOptions>;

Defined in: https://github.com/ax-llm/ax/blob/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/ai/types.ts#L1389

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/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/ai/types.ts#L1364

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/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/ai/types.ts#L1356

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/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/ai/types.ts#L1388

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/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/ai/types.ts#L1381

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/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/ai/types.ts#L1377

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/3d5aa8dac28a2637e4150f022dcd02e6fc3309f0/src/ax/ai/types.ts#L1350

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

Parameters

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

Returns

void

Docs