AxAI Generated TypeScript API reference. typescript api api/reference build/apidocs/Class.AxAI.md class AxAI

AxAI

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

Type Parameters

Type ParameterDefault type
TModelKeystring

Implements

Methods

chat()

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

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

Parameters

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

Returns

Promise< | AxChatResponse | ReadableStream<AxChatResponse>>

Implementation of

AxAIService.chat


embed()

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

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

Parameters

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

Returns

Promise<AxEmbedResponse>

Implementation of

AxAIService.embed


getEstimatedCost()

TypeScript
getEstimatedCost(modelUsage?: AxModelUsage): number;

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

Parameters

ParameterType
modelUsage?AxModelUsage

Returns

number

Implementation of

AxAIService.getEstimatedCost


getFeatures()

TypeScript
getFeatures(model?: string): AxAIFeatures;

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

Parameters

ParameterType
model?string

Returns

AxAIFeatures

Implementation of

AxAIService.getFeatures


getId()

TypeScript
getId(): string;

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

Returns

string

Implementation of

AxAIService.getId


getLastUsedChatModel()

TypeScript
getLastUsedChatModel(): any;

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

Returns

any

Implementation of

AxAIService.getLastUsedChatModel


getLastUsedEmbedModel()

TypeScript
getLastUsedEmbedModel(): any;

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

Returns

any

Implementation of

AxAIService.getLastUsedEmbedModel


getLastUsedModelConfig()

TypeScript
getLastUsedModelConfig(): AxModelConfig | undefined;

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

Returns

AxModelConfig | undefined

Implementation of

AxAIService.getLastUsedModelConfig


getLogger()

TypeScript
getLogger(): AxLoggerFunction;

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

Returns

AxLoggerFunction

Implementation of

AxAIService.getLogger


getMetrics()

TypeScript
getMetrics(): AxAIServiceMetrics;

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

Returns

AxAIServiceMetrics

Implementation of

AxAIService.getMetrics


getModelList()

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

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

Returns

| AxAIModelList<TModelKey> | undefined

Implementation of

AxAIService.getModelList


getName()

TypeScript
getName(): string;

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

Returns

string

Implementation of

AxAIService.getName


getOptions()

TypeScript
getOptions(): Readonly<AxAIServiceOptions>;

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

Returns

Readonly<AxAIServiceOptions>

Implementation of

AxAIService.getOptions


openChatSession()

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

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

Parameters

ParameterType
reqReadonly<AxChatRequest<TModelKey>>
optionsReadonly<AxAIServiceOptions>

Returns

Promise<AxChatSession>

Implementation of

AxAIService.openChatSession


setOptions()

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

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

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Implementation of

AxAIService.setOptions


speak()

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

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

Parameters

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

Returns

Promise<AxChatAudioOutput>

Implementation of

AxAIService.speak


transcribe()

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

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

Parameters

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

Returns

Promise<AxTranscriptionResponse>

Implementation of

AxAIService.transcribe


validateChatRequest()

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

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

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

Parameters

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

Returns

void

Implementation of

AxAIService.validateChatRequest


create()

TypeScript
static create<T>(options: T): AxAI<InferTModelKey<T>>;

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

Type Parameters

Type Parameter
T extends AxAIArgs<any>

Parameters

ParameterType
optionsT

Returns

AxAI<InferTModelKey<T>>

Docs