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

AxAIService

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/ai/types.ts#L428

Type Parameters

Type ParameterDefault type
TModelunknown
TEmbedModelunknown
TModelKeystring

Methods

chat()

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

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/ai/types.ts#L444

Parameters

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

Returns

Promise< | AxChatResponse | ReadableStream<AxChatResponse>>


embed()

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

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/ai/types.ts#L448

Parameters

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

Returns

Promise<AxEmbedResponse>


getFeatures()

getFeatures(model?: TModel): AxAIFeatures;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/ai/types.ts#L435

Parameters

ParameterType
model?TModel

Returns

AxAIFeatures


getId()

getId(): string;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/ai/types.ts#L433

Returns

string


getLastUsedChatModel()

getLastUsedChatModel(): undefined | TModel;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/ai/types.ts#L440

Returns

undefined | TModel


getLastUsedEmbedModel()

getLastUsedEmbedModel(): undefined | TEmbedModel;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/ai/types.ts#L441

Returns

undefined | TEmbedModel


getLastUsedModelConfig()

getLastUsedModelConfig(): undefined | AxModelConfig;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/ai/types.ts#L442

Returns

undefined | AxModelConfig


getLogger()

getLogger(): AxLoggerFunction;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/ai/types.ts#L438

Returns

AxLoggerFunction


getMetrics()

getMetrics(): AxAIServiceMetrics;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/ai/types.ts#L437

Returns

AxAIServiceMetrics


getModelList()

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

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/ai/types.ts#L436

Returns

| undefined | AxAIModelList<TModelKey>


getName()

getName(): string;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/ai/types.ts#L434

Returns

string


getOptions()

getOptions(): Readonly<AxAIServiceOptions>;

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/ai/types.ts#L454

Returns

Readonly<AxAIServiceOptions>


setOptions()

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

Defined in: https://github.com/ax-llm/ax/blob/9a5a7060a48f9eef46efc680b0cdf6b42bff5df2/src/ax/ai/types.ts#L453

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void