Documentation

Build LLM-powered agents
with production-ready TypeScript

DSPy for TypeScript. Working with LLMs is complex—they don't always do what you want. DSPy makes it easier to build amazing things with LLMs. Just define your inputs and outputs (signature) and an efficient prompt is auto-generated and used. Connect together various signatures to build complex systems and workflows using LLMs.

15+ LLM Providers
End-to-end Streaming
Auto Prompt Tuning

AxBaseAI

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/ai/base.ts#L265

Extended by

Type Parameters

Type Parameter
TModel
TEmbedModel
TChatRequest
TEmbedRequest
TChatResponse
TChatResponseDelta
TEmbedResponse
TModelKey

Implements

Constructors

Constructor

new AxBaseAI<TModel, TEmbedModel, TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse, TModelKey>(aiImpl: Readonly<AxAIServiceImpl<TModel, TEmbedModel, TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse>>, __namedParameters: Readonly<AxBaseAIArgs<TModel, TEmbedModel, TModelKey>>): AxBaseAI<TModel, TEmbedModel, TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse, TModelKey>;

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/ai/base.ts#L336

Parameters

ParameterType
aiImplReadonly<AxAIServiceImpl<TModel, TEmbedModel, TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse>>
__namedParametersReadonly<AxBaseAIArgs<TModel, TEmbedModel, TModelKey>>

Returns

AxBaseAI<TModel, TEmbedModel, TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse, TModelKey>

Accessors

debug

Get Signature

get debug(): boolean;

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/ai/base.ts#L410

Returns

boolean

Methods

chat()

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

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/ai/base.ts#L1123

Parameters

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

Returns

Promise< | AxChatResponse | ReadableStream<AxChatResponse>>

Implementation of

AxAIService.chat


embed()

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

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/ai/base.ts#L1668

Parameters

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

Returns

Promise<AxEmbedResponse>

Implementation of

AxAIService.embed


getFeatures()

getFeatures(model?: TModel): AxAIFeatures;

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/ai/base.ts#L495

Parameters

ParameterType
model?TModel

Returns

AxAIFeatures

Implementation of

AxAIService.getFeatures


getId()

getId(): string;

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/ai/base.ts#L398

Returns

string

Implementation of

AxAIService.getId


getLastUsedChatModel()

getLastUsedChatModel(): undefined | TModel;

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/ai/base.ts#L501

Returns

undefined | TModel

Implementation of

AxAIService.getLastUsedChatModel


getLastUsedEmbedModel()

getLastUsedEmbedModel(): undefined | TEmbedModel;

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/ai/base.ts#L505

Returns

undefined | TEmbedModel

Implementation of

AxAIService.getLastUsedEmbedModel


getLastUsedModelConfig()

getLastUsedModelConfig(): undefined | AxModelConfig;

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/ai/base.ts#L509

Returns

undefined | AxModelConfig

Implementation of

AxAIService.getLastUsedModelConfig


getLogger()

getLogger(): AxLoggerFunction;

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/ai/base.ts#L449

Returns

AxLoggerFunction

Implementation of

AxAIService.getLogger


getMetrics()

getMetrics(): AxAIServiceMetrics;

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/ai/base.ts#L1119

Returns

AxAIServiceMetrics

Implementation of

AxAIService.getMetrics


getModelList()

getModelList(): (
  | {
  description: string;
  embedModel?: undefined;
  key: TModelKey;
  model: string;
}
  | {
  description: string;
  embedModel: string;
  key: TModelKey;
  model?: undefined;
})[];

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/ai/base.ts#L464

Returns

( | { description: string; embedModel?: undefined; key: TModelKey; model: string; } | { description: string; embedModel: string; key: TModelKey; model?: undefined; })[]

Implementation of

AxAIService.getModelList


getName()

getName(): string;

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/ai/base.ts#L491

Returns

string

Implementation of

AxAIService.getName


getOptions()

getOptions(): Readonly<AxAIServiceOptions>;

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/ai/base.ts#L431

Returns

Readonly<AxAIServiceOptions>

Implementation of

AxAIService.getOptions


setAPIURL()

setAPIURL(apiURL: string): void;

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/ai/base.ts#L402

Parameters

ParameterType
apiURLstring

Returns

void


setHeaders()

setHeaders(headers: () => Promise<Record<string, string>>): void;

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/ai/base.ts#L406

Parameters

ParameterType
headers() => Promise<Record<string, string>>

Returns

void


setName()

setName(name: string): void;

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/ai/base.ts#L394

Parameters

ParameterType
namestring

Returns

void


setOptions()

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

Defined in: https://github.com/ax-llm/ax/blob/242cf18d21de9f9d58c7c82f53305f0605497473/src/ax/ai/base.ts#L414

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Implementation of

AxAIService.setOptions