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

AxAIMemory

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

Methods

addFunctionResults()

addFunctionResults(results: readonly AxFunctionResult[], sessionId?: string): void;

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

Parameters

ParameterType
resultsreadonly AxFunctionResult[]
sessionId?string

Returns

void


addRequest()

addRequest(result: (
  | {
  cache?: boolean;
  content: string;
  role: "system";
}
  | {
  content:   | string
     | (
     | {
     cache?: boolean;
     text: string;
     type: "text";
   }
     | {
     altText?: string;
     cache?: boolean;
     details?: "high" | "low" | "auto";
     image: string;
     mimeType: string;
     optimize?: "auto" | "quality" | "size";
     type: "image";
   }
     | {
     cache?: boolean;
     data: string;
     duration?: number;
     format?: "wav" | "mp3" | "ogg";
     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";
})[], sessionId?: string): void;

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

Parameters

ParameterType
result( | { cache?: boolean; content: string; role: "system"; } | { content: | string | ( | { cache?: boolean; text: string; type: "text"; } | { altText?: string; cache?: boolean; details?: "high" | "low" | "auto"; image: string; mimeType: string; optimize?: "auto" | "quality" | "size"; type: "image"; } | { cache?: boolean; data: string; duration?: number; format?: "wav" | "mp3" | "ogg"; 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"; })[]
sessionId?string

Returns

void


addResponse()

addResponse(results: readonly AxChatResponseResult[], sessionId?: string): void;

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

Parameters

ParameterType
resultsreadonly AxChatResponseResult[]
sessionId?string

Returns

void


addTag()

addTag(name: string, sessionId?: string): void;

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

Parameters

ParameterType
namestring
sessionId?string

Returns

void


getLast()

getLast(sessionId?: string): 
  | undefined
  | {
  chat: object[];
  role: "function" | "system" | "user" | "assistant";
  tags?: string[];
  updatable?: boolean;
};

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

Parameters

ParameterType
sessionId?string

Returns

| undefined | { chat: object[]; role: "function" | "system" | "user" | "assistant"; tags?: string[]; updatable?: boolean; }


history()

history(index: number, sessionId?: string): (
  | {
  cache?: boolean;
  content: string;
  role: "system";
}
  | {
  content:   | string
     | (
     | {
     cache?: boolean;
     text: string;
     type: "text";
   }
     | {
     altText?: string;
     cache?: boolean;
     details?: "high" | "low" | "auto";
     image: string;
     mimeType: string;
     optimize?: "auto" | "quality" | "size";
     type: "image";
   }
     | {
     cache?: boolean;
     data: string;
     duration?: number;
     format?: "wav" | "mp3" | "ogg";
     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/mem/types.ts#L35

Parameters

ParameterType
indexnumber
sessionId?string

Returns

( | { cache?: boolean; content: string; role: "system"; } | { content: | string | ( | { cache?: boolean; text: string; type: "text"; } | { altText?: string; cache?: boolean; details?: "high" | "low" | "auto"; image: string; mimeType: string; optimize?: "auto" | "quality" | "size"; type: "image"; } | { cache?: boolean; data: string; duration?: number; format?: "wav" | "mp3" | "ogg"; 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"; })[]


reset()

reset(sessionId?: string): void;

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

Parameters

ParameterType
sessionId?string

Returns

void


rewindToTag()

rewindToTag(name: string, sessionId?: string): AxMemoryData;

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

Parameters

ParameterType
namestring
sessionId?string

Returns

AxMemoryData


updateResult()

updateResult(results: Readonly<AxChatResponseResult> & object, sessionId?: string): void;

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

Parameters

ParameterType
resultsReadonly<AxChatResponseResult> & object
sessionId?string

Returns

void