AxAIMemory Generated TypeScript API reference. typescript api api/reference build/apidocs/Interface.AxAIMemory.md interface AxAIMemory

AxAIMemory

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/mem/types.ts#L22

Methods

addFunctionResults()

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

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/mem/types.ts#L35

Parameters

ParameterType
resultsreadonly AxFunctionResult[]
sessionId?string

Returns

void


addRequest()

TypeScript
addRequest(result: (
  | {
  cache?: boolean;
  content: string;
  role: "system";
}
  | {
  cache?: boolean;
  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;
     channels?: number;
     data: string;
     duration?: number;
     format?: AxAudioFormat;
     mimeType?: string;
     sampleRate?: number;
     transcription?: string;
     type: "audio";
   }
     | {
     cache?: boolean;
     data: string;
     extractedText?: string;
     filename?: string;
     mimeType: string;
     type: "file";
   }
     | {
     cache?: boolean;
     extractedText?: string;
     filename?: string;
     fileUri: string;
     mimeType: string;
     type: "file";
   }
     | {
     cache?: boolean;
     cachedContent?: string;
     description?: string;
     title?: string;
     type: "url";
     url: string;
   })[];
  name?: string;
  role: "user";
}
  | {
  audio?: {
     id: string;
     transcript?: string;
  };
  cache?: boolean;
  content?: string;
  functionCalls?: object[];
  name?: string;
  role: "assistant";
  thought?: string;
  thoughtBlocks?: AxThoughtBlockItem[];
}
  | {
  cache?: boolean;
  functionId: string;
  isError?: boolean;
  result: string;
  role: "function";
})[], sessionId?: string): void;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/mem/types.ts#L23

Parameters

ParameterType
result( | { cache?: boolean; content: string; role: "system"; } | { cache?: boolean; 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; channels?: number; data: string; duration?: number; format?: AxAudioFormat; mimeType?: string; sampleRate?: number; transcription?: string; type: "audio"; } | { cache?: boolean; data: string; extractedText?: string; filename?: string; mimeType: string; type: "file"; } | { cache?: boolean; extractedText?: string; filename?: string; fileUri: string; mimeType: string; type: "file"; } | { cache?: boolean; cachedContent?: string; description?: string; title?: string; type: "url"; url: string; })[]; name?: string; role: "user"; } | { audio?: { id: string; transcript?: string; }; cache?: boolean; content?: string; functionCalls?: object[]; name?: string; role: "assistant"; thought?: string; thoughtBlocks?: AxThoughtBlockItem[]; } | { cache?: boolean; functionId: string; isError?: boolean; result: string; role: "function"; })[]
sessionId?string

Returns

void


addResponse()

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

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

Parameters

ParameterType
resultsreadonly AxChatResponseResult[]
sessionId?string

Returns

void


addTag()

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

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/mem/types.ts#L45

Parameters

ParameterType
namestring
sessionId?string

Returns

void


getLast()

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

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/mem/types.ts#L43

Parameters

ParameterType
sessionId?string

Returns

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


history()

TypeScript
history(index: number, sessionId?: string): (
  | {
  cache?: boolean;
  content: string;
  role: "system";
}
  | {
  cache?: boolean;
  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;
     channels?: number;
     data: string;
     duration?: number;
     format?: AxAudioFormat;
     mimeType?: string;
     sampleRate?: number;
     transcription?: string;
     type: "audio";
   }
     | {
     cache?: boolean;
     data: string;
     extractedText?: string;
     filename?: string;
     mimeType: string;
     type: "file";
   }
     | {
     cache?: boolean;
     extractedText?: string;
     filename?: string;
     fileUri: string;
     mimeType: string;
     type: "file";
   }
     | {
     cache?: boolean;
     cachedContent?: string;
     description?: string;
     title?: string;
     type: "url";
     url: string;
   })[];
  name?: string;
  role: "user";
}
  | {
  audio?: {
     id: string;
     transcript?: string;
  };
  cache?: boolean;
  content?: string;
  functionCalls?: object[];
  name?: string;
  role: "assistant";
  thought?: string;
  thoughtBlocks?: AxThoughtBlockItem[];
}
  | {
  cache?: boolean;
  functionId: string;
  isError?: boolean;
  result: string;
  role: "function";
})[];

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

Parameters

ParameterType
indexnumber
sessionId?string

Returns


removeByTag()

TypeScript
removeByTag(name: string, sessionId?: string): AxMemoryData;

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/mem/types.ts#L47

Parameters

ParameterType
namestring
sessionId?string

Returns

AxMemoryData


reset()

TypeScript
reset(sessionId?: string): void;

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

Parameters

ParameterType
sessionId?string

Returns

void


rewindToTag()

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

Defined in: https://github.com/ax-llm/ax/blob/5b28f9093bb70863b59459bb6df5062d005bce41/src/ax/mem/types.ts#L46

Parameters

ParameterType
namestring
sessionId?string

Returns

AxMemoryData


updateResult()

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

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

Parameters

ParameterType
resultsReadonly<AxChatResponseResult> & object
sessionId?string

Returns

void

Docs