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/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/wrap.ts#L224

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/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/wrap.ts#L416

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/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/wrap.ts#L473

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/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/wrap.ts#L397

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/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/wrap.ts#L356

Parameters

ParameterType
model?string

Returns

AxAIFeatures

Implementation of

AxAIService.getFeatures


getId()

TypeScript
getId(): string;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/wrap.ts#L352

Returns

string

Implementation of

AxAIService.getId


getLastUsedChatModel()

TypeScript
getLastUsedChatModel(): any;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/wrap.ts#L377

Returns

any

Implementation of

AxAIService.getLastUsedChatModel


getLastUsedEmbedModel()

TypeScript
getLastUsedEmbedModel(): any;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/wrap.ts#L385

Returns

any

Implementation of

AxAIService.getLastUsedEmbedModel


getLastUsedModelConfig()

TypeScript
getLastUsedModelConfig(): AxModelConfig | undefined;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/wrap.ts#L389

Returns

AxModelConfig | undefined

Implementation of

AxAIService.getLastUsedModelConfig


getLogger()

TypeScript
getLogger(): AxLoggerFunction;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/wrap.ts#L503

Returns

AxLoggerFunction

Implementation of

AxAIService.getLogger


getMetrics()

TypeScript
getMetrics(): AxAIServiceMetrics;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/wrap.ts#L393

Returns

AxAIServiceMetrics

Implementation of

AxAIService.getMetrics


getModelList()

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

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/wrap.ts#L373

Returns

| AxAIModelList<TModelKey> | undefined

Implementation of

AxAIService.getModelList


getName()

TypeScript
getName(): string;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/wrap.ts#L348

Returns

string

Implementation of

AxAIService.getName


getOptions()

TypeScript
getOptions(): Readonly<AxAIServiceOptions>;

Defined in: https://github.com/ax-llm/ax/blob/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/wrap.ts#L499

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/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/wrap.ts#L437

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/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/wrap.ts#L494

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/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/wrap.ts#L487

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/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/wrap.ts#L480

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/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/wrap.ts#L405

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/f60ce12a5a7a0de6d7bf420400ca77934ea61504/src/ax/ai/wrap.ts#L236

Type Parameters

Type Parameter
T extends AxAIArgs<any>

Parameters

ParameterType
optionsT

Returns

AxAI<InferTModelKey<T>>

Docs