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

AxChatRequest

type AxChatRequest<TModel> = object;

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

Type Parameters

Type ParameterDefault type
TModelstring

Properties

capabilities?

optional capabilities: object;

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

Provider capability preferences and requirements

fallbackBehavior?

optional fallbackBehavior: "error" | "degrade" | "skip";

How to handle unsupported content types

requiresAudio?

optional requiresAudio: boolean;

Whether the request requires audio support

requiresFiles?

optional requiresFiles: boolean;

Whether the request requires file support

requiresImages?

optional requiresImages: boolean;

Whether the request requires image support

requiresWebSearch?

optional requiresWebSearch: boolean;

Whether the request requires web search capabilities


chatPrompt

chatPrompt: (
  | {
  cache?: boolean;
  content: string;
  role: "system";
}
  | {
  content:   | string
     | (
     | {
     cache?: boolean;
     text: string;
     type: "text";
   }
     | {
     altText?: string;
     cache?: boolean;
     details?: ... | ... | ...;
     image: string;
     mimeType: string;
     optimize?: ... | ... | ...;
     type: "image";
   }
     | {
     cache?: boolean;
     data: string;
     duration?: number;
     format?: ... | ... | ...;
     transcription?: string;
     type: "audio";
   }
     | {
     cache?: boolean;
     data: string;
     extractedText?: string;
     filename: string;
     mimeType: string;
     type: "file";
   }
     | {
     cache?: boolean;
     cachedContent?: string;
     description?: string;
     title?: string;
     type: "url";
     url: string;
   })[];
  name?: string;
  role: "user";
}
  | {
  cache?: boolean;
  content?: string;
  functionCalls?: object[];
  name?: string;
  role: "assistant";
}
  | {
  cache?: boolean;
  functionId: string;
  isError?: boolean;
  result: string;
  role: "function";
})[];

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


functionCall?

optional functionCall: 
  | "none"
  | "auto"
  | "required"
  | {
  function: {
     name: string;
  };
  type: "function";
};

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


functions?

optional functions: Readonly<{
  description: string;
  name: string;
  parameters?: AxFunctionJSONSchema;
}>[];

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


model?

optional model: TModel;

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


modelConfig?

optional modelConfig: AxModelConfig;

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


processing?

optional processing: object;

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

Content processing preferences and hints

audioTranscription?

optional audioTranscription: boolean;

Whether to apply audio transcription

fileTextExtraction?

optional fileTextExtraction: boolean;

Whether to extract text from files

imageCompression?

optional imageCompression: boolean;

Whether to apply image compression

urlContentFetching?

optional urlContentFetching: boolean;

Whether to fetch content from URLs