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

AxAIAnthropic

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/ai/anthropic/api.ts#L678

Extends

Type Parameters

Type ParameterDefault type
TModelKeystring

Constructors

Constructor

new AxAIAnthropic<TModelKey>(__namedParameters: Readonly<Omit<AxAIAnthropicArgs<TModelKey>, "name">>): AxAIAnthropic<TModelKey>;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/ai/anthropic/api.ts#L697

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAIAnthropicArgs<TModelKey>, "name">>

Returns

AxAIAnthropic<TModelKey>

Overrides

AxBaseAI.constructor

Methods

chat()

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

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/ai/base.ts#L870

Parameters

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

Returns

Promise< | AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxBaseAI.chat


embed()

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

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/ai/base.ts#L1380

Parameters

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

Returns

Promise<AxEmbedResponse>

Inherited from

AxBaseAI.embed


getFeatures()

getFeatures(model?: 
  | AxAIAnthropicModel
  | AxAIAnthropicVertexModel): AxAIFeatures;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/ai/base.ts#L345

Parameters

ParameterType
model?| AxAIAnthropicModel | AxAIAnthropicVertexModel

Returns

AxAIFeatures

Inherited from

AxBaseAI.getFeatures


getId()

getId(): string;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/ai/base.ts#L270

Returns

string

Inherited from

AxBaseAI.getId


getLastUsedChatModel()

getLastUsedChatModel(): 
  | undefined
  | AxAIAnthropicModel
  | AxAIAnthropicVertexModel;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/ai/base.ts#L351

Returns

| undefined | AxAIAnthropicModel | AxAIAnthropicVertexModel

Inherited from

AxBaseAI.getLastUsedChatModel


getLastUsedEmbedModel()

getLastUsedEmbedModel(): unknown;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/ai/base.ts#L355

Returns

unknown

Inherited from

AxBaseAI.getLastUsedEmbedModel


getLastUsedModelConfig()

getLastUsedModelConfig(): undefined | AxModelConfig;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/ai/base.ts#L359

Returns

undefined | AxModelConfig

Inherited from

AxBaseAI.getLastUsedModelConfig


getLogger()

getLogger(): AxLoggerFunction;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/ai/base.ts#L310

Returns

AxLoggerFunction

Inherited from

AxBaseAI.getLogger


getMetrics()

getMetrics(): AxAIServiceMetrics;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/ai/base.ts#L866

Returns

AxAIServiceMetrics

Inherited from

AxBaseAI.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/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/ai/base.ts#L314

Returns

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

Inherited from

AxBaseAI.getModelList


getName()

getName(): string;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/ai/base.ts#L341

Returns

string

Inherited from

AxBaseAI.getName


getOptions()

getOptions(): Readonly<AxAIServiceOptions>;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/ai/base.ts#L295

Returns

Readonly<AxAIServiceOptions>

Inherited from

AxBaseAI.getOptions


setAPIURL()

setAPIURL(apiURL: string): void;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/ai/base.ts#L274

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxBaseAI.setAPIURL


setHeaders()

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

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/ai/base.ts#L278

Parameters

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

Returns

void

Inherited from

AxBaseAI.setHeaders


setName()

setName(name: string): void;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/ai/base.ts#L266

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxBaseAI.setName


setOptions()

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

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/ai/base.ts#L282

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxBaseAI.setOptions


create()

static create<T>(options: T): T extends object ? AxAIAnthropic<ExtractModelKeys<M>> : AxAIAnthropic<string>;

Defined in: https://github.com/ax-llm/ax/blob/8dfd0ce02b8cb386fb2c93fa280a2ec0da2d6011/src/ax/ai/anthropic/api.ts#L689

Type Parameters

Type Parameter
T extends AxAIAnthropicArgs<any>

Parameters

ParameterType
optionsT

Returns

T extends object ? AxAIAnthropic<ExtractModelKeys<M>> : AxAIAnthropic<string>