AX AGENT FRAMEWORK
TYPESCRIPT-FIRST LLM INFRASTRUCTURE

Ax Framework

Build LLM-Powered Agents with TypeScript

> About Ax

The best framework to build LLM powered agents

Building intelligent agents is a breeze with the Ax framework, inspired by the power of “Agentic workflows” and the Stanford DSPy paper. It seamlessly integrates with multiple LLMs and VectorDBs to build RAG pipelines or collaborative agents that can solve complex problems. Plus, it offers advanced features like streaming validation, multi-modal DSPy, etc.

Large language models (LLMs) are becoming really powerful and have reached a point where they can work as the backend for your entire product. However, there’s still a lot of complexity to manage from using the correct prompts, models, streaming, function calls, error correction, and much more. We aim help manage this complexity via this easy-to-use library that can work with all state-of-the-art LLMs. Additionally, we are using the latest research to add new capabilities like DSPy to the library.

Install

With NPM

npm install @ax-llm/ax

With Yarn

yarn add @ax-llm/ax

Features

  • Support for various LLMs and Vector DBs
  • Prompts auto-generated from simple signatures
  • Build Agents that can call other agents
  • Convert docs of any format to text
  • RAG, smart chunking, embedding, querying
  • Works with Vercel AI SDK
  • Output validation while streaming
  • Multi-modal DSPy supported
  • Automatic prompt tuning using optimizers
  • OpenTelemetry tracing / observability
  • Production ready Typescript code
  • Lite weight, zero-dependencies

Quick Start

  1. Pick an AI to work with
// Pick a LLM
const ai = new AxOpenAI({ apiKey: process.env.OPENAI_APIKEY } as AxOpenAIArgs);
  1. Create a prompt signature based on your usecase
// Signature defines the inputs and outputs of your prompt program
const cot = new AxGen(ai, `question:string -> answer:string`, { mem });
  1. Execute this new prompt program
// Pass in the input fields defined in the above signature
const res = await cot.forward({ question: 'Are we in a simulation?' });
  1. Or if you just want to directly use the LLM
const res = await ai.chat([
  { role: "system", content: "Help the customer with his questions" }
  { role: "user", content: "I'm looking for a Macbook Pro M2 With 96GB RAM?" }
]);

Reach out

https://twitter.com/dosco

> What's a prompt signature?

Prompt signatures are how you define the inputs and outputs to a Ax Prompt.

shapes at 24-03-31 00 05 55

Efficient type-safe prompts are auto-generated from a simple signature. A prompt signature is made up of a "task description" inputField:type "field description" -> "outputField:type. The idea behind prompt signatures is based on work done in the “Demonstrate-Search-Predict” paper.

You can have multiple input and output fields, and each field can be of the types stringnumberbooleandate, datetime, class "class1, class2", JSON, or an array of any of these, e.g., string[]. When a type is not defined, it defaults to string. The underlying AI is encouraged to generate the correct JSON when the JSON type is used.

Output Field Types

TypeDescriptionUsageExample Output
stringA sequence of characters.fullName:string"example"
numberA numerical value.price:number42
booleanA true or false value.isEvent:booleantrue, false
dateA date value.startDate:date"2023-10-01"
datetimeA date and time value.createdAt:datetime"2023-10-01T12:00:00Z"
class "class1,class2"A classification of items.category:class["class1", "class2", "class3"]
string[]An array of strings.tags:string[]["example1", "example2"]
number[]An array of numbers.scores:number[][1, 2, 3]
boolean[]An array of boolean values.permissions:boolean[][true, false, true]
date[]An array of dates.holidayDates:date[]["2023-10-01", "2023-10-02"]
datetime[]An array of date and time values.logTimestamps:datetime[]["2023-10-01T12:00:00Z", "2023-10-02T12:00:00Z"]
class[] "class1,class2"Multiple classescategories:class[]["class1", "class2", "class3"]

> Supported LLMs

Using various LLMs

Ax supports all the top LLM providers and models, along with their advanced capabilities, such as function calling, multi-modal, streaming, and JSON.

Our defaults, including default models, are selected to ensure solid agent performance.

OpenAI

const ai = new AxAI({
  name: 'openai',
  apiKey: process.env.OPENAI_APIKEY as string
});
const ai = new AxAI({
 name: 'openai',
 apiKey: process.env.OPENAI_APIKEY as string
 config: {
    model: AxAIOpenAIModel.GPT4Turbo,
    embedModel: AxAIOpenAIEmbedModel.TextEmbedding3Small
    temperature: 0.1,
 }
});

Azure OpenAI

Azure requires you to set a resource name and a deployment name

https://learn.microsoft.com/en-us/azure/ai-services/openai/how-to/create-resource?pivots=web-portal

const ai = new AxAI({
  name: 'azure-openai',
  apiKey: process.env.AZURE_OPENAI_APIKEY as string,
  resourceName: 'test-resource',
  deploymentName: 'test-deployment'
});

Together

Together runs a diverse array of open-source models, each designed for a specific use case. This variety ensures that you can find the perfect model for your needs.

https://docs.together.ai/docs/inference-models

const ai = new AxAI({
  name: 'together',
  apiKey: process.env.TOGETHER_APIKEY as string,
  config: {
    model: 'Qwen/Qwen1.5-0.5B-Chat'
  }
});

Anthropic

const ai = new AxAI({
  name: 'anthropic',
  apiKey: process.env.ANTHROPIC_APIKEY as string
});

Groq

Groq uses specialized hardware to serve open-source models with the lowest latency. It supports a small number of good models.

const ai = new AxAI({
  name: 'groq',
  apiKey: process.env.GROQ_APIKEY as string
});

Google Gemini

An excellent model family with very long context lengths at the lowest price points. Gemini has built-in support for compute (code execution); their models can write and run code in the backend if needed.

const ai = new AxAI({
  name: 'google-gemini',
  apiKey: process.env.GOOGLE_GEMINI_APIKEY as string
  options: { codeExecution: true }
});

Cohere

const ai = new AxAI({
  name: 'cohere',
  apiKey: process.env.COHERE_APIKEY as string
});

Mistral

const ai = new AxAI({
  name: 'mistral',
  apiKey: process.env.MISTRAL_APIKEY as string
});

Deepseek

Deepseek is an LLM provider from China that has excellent models.

const ai = new AxAI({
  name: 'deepseek',
  apiKey: process.env.DEEPSEEK_APIKEY as string
});

Ollama

Ollama is an engine for running open-source models locally on your laptop. We default to nous-hermes21 for inference and all-minilm for embedding.

const ai = new AxAI({
  name: 'ollama',
  apiKey: process.env.DEEPSEEK_APIKEY as string,
  url: 'http://localhost:11434'
  config: { model: 'nous-hermes2', embedModel: 'all-minilm' }
});

Huggingface

const ai = new AxAI({
  name: 'huggingface',
  apiKey: process.env.HF_APIKEY as string
});

> Using Ax

A more detailed guide to using Ax

Pick an LLM

Ax is a zero-dependency framework. Every LLM API integration we build is solid, works well with Ax, and supports all required features, such as function calling, multi-modal, JSON, streaming, etc.

Currently we support "openai" | "azure-openai" | "together" | "anthropic" | "groq" | "google-gemini" | "cohere" | "huggingface" | "mistral" | "deepseek" | "ollama"

const ai = new AxAI({
  name: 'openai',
  apiKey: process.env.OPENAI_APIKEY as string
});

The LLMs are pre-configured with sensible defaults such as models and other conifgurations such as topK, temperature, etc

Prompting

Prompts are usually stressful and complex. You never know what the right prompt is, and blobs of text in your code are hard to deal with. We fix this by adopting the prompt signatures from the popular Stanford DSPy paper.

A prompt signature is a list of typed input and output fields along with a task description prefix. the following fields are supported 'string' | 'number' | 'boolean' | 'json' | 'image' | 'audio' add a [] to convert a field into an array field eg. string[], number[], etc. Additionally a ? marks the field as an optional field context?:string.

Summarize some text

textToSummarize -> shortSummary "summarize in 5 to 10 words"

Answer questions using a multi-modal prompt that takes a question and an image

"answer biology questions about animals"
question:string, animalImage:image -> answer:string

A prompt that ensures the response is a numeric list

"Rate the quality of each answer on a scale of 1 to 10 against the question"
question:string, answers:string[] -> rating:number[]

Putting it all together

Use the above AI and a prompt to build an LLM-powered program to summarize the text.

// example.ts
import { AxAI, AxChainOfThought } from '@ax-llm/ax';

const textToSummarize = `
The technological singularity—or simply the singularity[1]—is a hypothetical 
future point in time at which technological growth becomes uncontrollable 
and irreversible, resulting in unforeseeable changes to human 
civilization.[2][3] ...`;

const ai = new AxAI({
  name: 'openai',
  apiKey: process.env.OPENAI_APIKEY as string
});

const gen = new AxChainOfThought(`textToSummarize -> shortSummary "summarize in 5 to 10 words"`);
const res = await gen.forward(ai, { textToSummarize });

console.log(res);
tsx example.ts

{
    shortSummary: "The technological singularity refers to a
    hypothetical future scenario where technological..."
}

Build your first agent

Ax makes it really simple to build agents. An agent requires a name, description and signature. it can optionally use functions and other agents.

Example Stock Analyst Agent The Stock Analyst Agent is an advanced AI-powered tool that provides comprehensive stock analysis and financial insights. It combines multiple specialized sub-agents and functions to deliver in-depth evaluations of stocks, market trends, and related financial data.

This is only an example, but it highlights the power of agentic workflows, where you can build agents who work with agents to handle complex tasks.

const agent = new AxAgent({
  name: 'Stock Analyst',
  description:
    'An AI agent specialized in analyzing stocks, market trends, and providing financial insights.',
  signature: `
    stockSymbol:string, 
    analysisType:string "fundamental, technical or sentiment" -> analysisReport`,
  functions: [
    getStockData,
    calculateFinancialRatios,
    analyzeTechnicalIndicators,
    performSentimentAnalysis
  ],
  agents: [
    financialDataCollector,
    marketTrendAnalyzer,
    newsAnalyzer,
    sectorAnalyst,
    competitorAnalyzer,
    riskAssessor,
    valuationExpert,
    economicIndicatorAnalyzer,
    insiderTradingMonitor,
    esgAnalyst
  ]
});

Example of agents working with other agents

// ./src/examples/agent.ts

const researcher = new AxAgent({
  name: 'researcher',
  description: 'Researcher agent',
  signature: `physicsQuestion "physics questions" -> answer "reply in bullet points"`
});

const summarizer = new AxAgent({
  name: 'summarizer',
  description: 'Summarizer agent',
  signature: `text "text so summarize" -> shortSummary "summarize in 5 to 10 words"`
});

const agent = new AxAgent({
  name: 'agent',
  description: 'A an agent to research complex topics',
  signature: `question -> answer`,
  agents: [researcher, summarizer]
});

agent.forward({ questions: 'How many atoms are there in the universe' });

> RAG & Vector DBs

A guide on working with vector databases and Retrieval Augmented Generation (RAG) in ax.

Vector databases are critical to building LLM workflows. We have clean abstractions over popular vector databases and our own quick in-memory vector database.

ProviderTested
In Memory🟢 100%
Weaviate🟢 100%
Cloudflare🟡 50%
Pinecone🟡 50%
// Create embeddings from text using an LLM
const ret = await this.ai.embed({ texts: 'hello world' });

// Create an in memory vector db
const db = new axDB('memory');

// Insert into vector db
await this.db.upsert({
  id: 'abc',
  table: 'products',
  values: ret.embeddings[0]
});

// Query for similar entries using embeddings
const matches = await this.db.query({
  table: 'products',
  values: embeddings[0]
});

Alternatively you can use the AxDBManager which handles smart chunking, embedding and querying everything for you, it makes things almost too easy.

const manager = new AxDBManager({ ai, db });
await manager.insert(text);

const matches = await manager.query(
  'John von Neumann on human intelligence and singularity.'
);
console.log(matches);

RAG Documents

Using documents like PDF, DOCX, PPT, XLS, etc., with LLMs is a huge pain. We make it easy with Apache Tika, an open-source document processing engine.

Launch Apache Tika

docker run -p 9998:9998 apache/tika

Convert documents to text and embed them for retrieval using the AxDBManager, which also supports a reranker and query rewriter. Two default implementations, AxDefaultResultReranker and AxDefaultQueryRewriter, are available.

const tika = new AxApacheTika();
const text = await tika.convert('/path/to/document.pdf');

const manager = new AxDBManager({ ai, db });
await manager.insert(text);

const matches = await manager.query('Find some text');
console.log(matches);

> Multi-modal DSPy

Using multi-modal inputs like images and audio with DSPy pipelines and LLMs

When using models like GPT-4o and Gemini that support multi-modal prompts, we support using image fields, and this works with the whole DSP pipeline.

const image = fs
  .readFileSync('./src/examples/assets/kitten.jpeg')
  .toString('base64');

const gen = new AxChainOfThought(`question, animalImage:image -> answer`);

const res = await gen.forward(ai, {
  question: 'What family does this animal belong to?',
  animalImage: { mimeType: 'image/jpeg', data: image }
});

When using models like gpt-4o-audio-preview that support multi-modal prompts with audio support, we support using audio fields, and this works with the whole DSP pipeline.

const audio = fs
  .readFileSync('./src/examples/assets/comment.wav')
  .toString('base64');

const gen = new AxGen(`question, commentAudio:audio -> answer`);

const res = await gen.forward(ai, {
  question: 'What family does this animal belong to?',
  commentAudio: { format: 'wav', data: audio }
});

> Streaming Outputs

Learn how to use streaming outputs in ax, including streaming validation and assertions for the output fields and function execution.

We support parsing output fields and function execution while streaming. This allows for fail-fast and error correction without waiting for the whole output, saving tokens and costs and reducing latency. Assertions are a powerful way to ensure the output matches your requirements; they also work with streaming.

// setup the prompt program
const gen = new AxChainOfThought(
  ai,
  `startNumber:number -> next10Numbers:number[]`
);

// add a assertion to ensure that the number 5 is not in an output field
gen.addAssert(({ next10Numbers }: Readonly<{ next10Numbers: number[] }>) => {
  return next10Numbers ? !next10Numbers.includes(5) : undefined;
}, 'Numbers 5 is not allowed');

// run the program with streaming enabled
const res = await gen.forward({ startNumber: 1 }, { stream: true });

The above example allows you to validate entire output fields as they are streamed in. This validation works with streaming and when not streaming and is triggered when the whole field value is available. For true validation while streaming, check out the example below. This will massively improve performance and save tokens at scale in production.

// add a assertion to ensure all lines start with a number and a dot.
gen.addStreamingAssert(
  'answerInPoints',
  (value: string) => {
    const re = /^\d+\./;

    // split the value by lines, trim each line,
    // filter out empty lines and check if all lines match the regex
    return value
      .split('\n')
      .map((x) => x.trim())
      .filter((x) => x.length > 0)
      .every((x) => re.test(x));
  },
  'Lines must start with a number and a dot. Eg: 1. This is a line.'
);

// run the program with streaming enabled
const res = await gen.forward(
  {
    question: 'Provide a list of optimizations to speedup LLM inference.'
  },
  { stream: true, debug: true }
);

> Vercel AI SDK Integration

Learn how to integrate Ax with the Vercel AI SDK for building AI-powered applications using both the AI provider and Agent provider functionality.

npm i @ax-llm/ax-ai-sdk-provider

Then use it with the AI SDK, you can either use the AI provider or the Agent Provider

const ai = new AxAI({
    name: 'openai',
    apiKey: process.env['OPENAI_APIKEY'] ?? "",
});

// Create a model using the provider
const model = new AxAIProvider(ai);

export const foodAgent = new AxAgent({
  name: 'food-search',
  description:
    'Use this agent to find restaurants based on what the customer wants',
  signature,
  functions
})

// Get vercel ai sdk state
const aiState = getMutableAIState()

// Create an agent for a specific task
const foodAgent = new AxAgentProvider(ai, {
    agent: foodAgent,
    updateState: (state) => {
         aiState.done({ ...aiState.get(), state })
    },
    generate: async ({ restaurant, priceRange }) => {
        return (
            <BotCard>
                <h1>{restaurant as string} {priceRange as string}</h1>
            </BotCard>
        )
    }
})

// Use with streamUI a critical part of building chat UIs in the AI SDK
const result = await streamUI({
    model,
    initial: <SpinnerMessage />,
    messages: [
        // ...
    ],
    text: ({ content, done, delta }) => {
        // ...
    },
    tools: {
        // @ts-ignore
        'find-food': foodAgent,
    }
})

> DSPy Explained

Whats DSPy, why it matters and how to use it.

Demonstrate, search, predict, or DSPy is a now-famous Stanford paper focused on optimizing the prompting of LLMs. The basic idea is to provide examples instead of instructions.

Ax supports DSPy and allows you to set examples on each prompt. It also allows you to run an optimizer, which runs the prompt using inputs from a test set and validates the outputs against the same test set. In short, the optimizer helps you capture good examples across the entire tree of prompts your workflow is built with.

Pick a prompt strategy

There are various prompts available in Ax, pick one based on your needs.

  1. Generate - Generic prompt that all other prompts inherit from.
  2. ChainOfThough - Increasing performance by reasoning before providing the answer
  3. RAG - Uses a vector database to add context and improve performance and accuracy.
  4. Agent - For agentic workflows

Create a signature

A signature defines the task you want to do, the inputs you’ll provide, and the outputs you expect the LLM to generate.

const prompt = new AxGen(
`"Extract customer query details" customerMessage:string -> customerName, customerIssue, ,productName:string, troubleshootingAttempted?:string`)

The next optional but most important thing you can do to improve the performance of your prompts is to set examples. When we say “performance,” we mean the number of times the LLM does exactly what you expect correctly over the number of times it fails.

Examples are the best way to communicate to the LLM what you want it to do. The patterns you define in high-quality examples help the LLM much better than the instructions.

prompt.setExample([
    {
        customerMessage: "Hello, I'm Jane Smith. I'm having trouble with my UltraPhone X. The screen remains black even after restarting multiple times. I have tried charging it overnight and using a different charger.",
        customerName: "Jane Smith",
        productName: "UltraPhone X",
        troubleshootingAttempted: "Charging it overnight and using a different charger.",
    },
    {
        customerMessage: "Hi, my name is Michael Johnson. My EcoPrinter Pro isn't connecting to Wi-Fi. I've restarted the printer and my router, and also tried connecting via Ethernet cable.",
        customerName: "Michael Johnson",
        productName: "EcoPrinter Pro",
        troubleshootingAttempted: "Restarted the printer and router, and tried connecting via Ethernet cable.",
    },
    {
        customerMessage: "Greetings, I'm Sarah Lee. I'm experiencing issues with my SmartHome Hub. It keeps losing connection with my smart devices. I have reset the hub, checked my internet connection, and re-paired the devices.",
        customerName: "Sarah Lee",
        productName: "SmartHome Hub",
        troubleshootingAttempted: "Reset the hub, checked the internet connection, and re-paired the devices.",
    }
])

Use this prompt

You are now ready to use this prompt in your workflows.

# Setup the ai
const ai = new AxAI("openai", { apiKey: process.env.OPENAI_APIKEY })

# Execute the prompt
const { customerName, productName, troubleshootingAttempted } = prompt.forward(ai, { customerMessage })

Easy enough! this is all you need

DAP prompt tuning

What if I want more performance, or do I want to run this with a smaller model? I was told you can tune your prompts with DSPy. Yes, this is true. You can do this. In short, you can use a big LLM to generate better examples for every prompt you use in your entire flow of prompts.

// Use the HuggingFace data loader or create one for your own data
const hf = new AxHFDataLoader({
  dataset: 'yixuantt/MultiHopRAG',
  split: 'train',
  config: 'MultiHopRAG',
  options: { length: 5 }
});

await hf.loadData();
// Fetch some rows, map the data columns to your prompts inputs
const examples = await hf.getRows<{ question: string; answer: string }>({
  count: 20,
  fields: ['query', 'answer'],
  renameMap: { query: 'question', answer: 'answer' }
});
// Create your prompt
const prompt = new AxGen(`question -> answer`)
// Setup a Bootstrap Few Shot optimizer to tune the above prompt
const optimize = new AxBootstrapFewShot<
  { question: string },
  { answer: string }
>({
  prompt,
  examples
});
// Setup a evaluation metric em, f1 scores are a popular way measure retrieval performance.
const metricFn: AxMetricFn = ({ prediction, example }) => {
  return axEvalUtil.emScore(
    prediction.answer as string,
    example.answer as string
  );
};
// Run the optimizer
const result = await optimize.compile(metricFn);

// Save the results to use later
await fs.promises.writeFile('./qna-tune-demos.json', values);
// Use this tuning data in your workflow
const values = await fs.promises.readFile('./qna-tune-demos.json', 'utf8');
const demos = JSON.parse(values);

// Your done now, use this prompt
prompt.setDemos(demos);

> LLM Function Calling

How to create functions to use in Ax

In this guide, we’ll explain how to create functions, function classes, etc. that can be used in Ax. Creation focused functions with clear names and descriptions are critical to a solid workflow. Do not use too many functions on a prompt or make the function itself do too much. Focused functions are better. If you need to use several functions, then look into breaking down the task into multiple prompts or using agents.

Function definition simple

A function is an object with a name, and description along with a JSON schema of the function arguments and the function itself

// The function
const googleSearchAPI = async (query: string) => {
    const res = await axios.get("http://google.com/?q=" + query)
    return res.json()
}
// The function definition
const googleSearch AxFunction = {
    name: 'googleSearch',
    description: 'Use this function to search google for links related to the query',
    func: googleSearchAPI,
    parameters: {
        type: 'object',
         properties: {
             query: {
                description: `The query to search for`,
                type: 'string'
            },
        }
    }
}

Function definition as a class

Another way to define functions is as a class with a toFunction method.

class GoogleSearch {
    private apiKey: string;

    constructor(apiKey: string) {
        this.apiLey = apiKey;
    }


    async query(query: string) {
        const res = await axios.get("http://google.com/?q=" + query)
        return res.json()
    }

    async toFunction() {
        return {
            name: 'googleSearch',
            description: 'Use this function to search google for links related to the query',
            parameters: {
                type: 'object',
                properties: {
                    query: {
                        description: `The query to search for`,
                        type: 'string'
                    },
                }
            },
            func: (query: string) => this.query(query)
        }
    }
}

How to use these functions

Just set the function on the prompt

const prompt = new AxGen('inputs -> output', { functions: [ googleSearch ] })

Or in the case of function classes

const prompt = new AxGen('inputs -> output', { functions: [ new GoogleSearch(apiKey) ] })

Restaurant finding agent

Let’s create an agent to help find a restaurant based on the diner’s preferences. To do this, we’ll start by creating some dummy APIs specifically for this example. We’ll need a function to get the weather, and another one to look up places to eat at.

const choice = Math.round(Math.random());

const goodDay = {
  temperature: '27C',
  description: 'Clear Sky',
  wind_speed: 5.1,
  humidity: 56
};

const badDay = {
  temperature: '10C',
  description: 'Cloudy',
  wind_speed: 10.6,
  humidity: 70
};

// dummy weather lookup function
const weatherAPI = ({ location }: Readonly<{ location: string }>) => {
  const data = [
    {
      city: 'san francisco',
      weather: choice === 1 ? goodDay : badDay
    },
    {
      city: 'tokyo',
      weather: choice === 1 ? goodDay : badDay
    }
  ];

  return data
    .filter((v) => v.city === location.toLowerCase())
    .map((v) => v.weather);
};
// dummy opentable api
const opentableAPI = ({
  location
}: Readonly<{
  location: string;
  outdoor: string;
  cuisine: string;
  priceRange: string;
}>) => {
  const data = [
    {
      name: "Gordon Ramsay's",
      city: 'san francisco',
      cuisine: 'indian',
      rating: 4.8,
      price_range: '$$$$$$',
      outdoor_seating: true
    },
    {
      name: 'Sukiyabashi Jiro',
      city: 'san francisco',
      cuisine: 'sushi',
      rating: 4.7,
      price_range: '$$',
      outdoor_seating: true
    },
    {
      name: 'Oyster Bar',
      city: 'san francisco',
      cuisine: 'seafood',
      rating: 4.5,
      price_range: '$$',
      outdoor_seating: true
    },
    {
      name: 'Quay',
      city: 'tokyo',
      cuisine: 'sushi',
      rating: 4.6,
      price_range: '$$$$',
      outdoor_seating: true
    },
    {
      name: 'White Rabbit',
      city: 'tokyo',
      cuisine: 'indian',
      rating: 4.7,
      price_range: '$$$',
      outdoor_seating: true
    }
  ];

  return data
    .filter((v) => v.city === location?.toLowerCase())
    .sort((a, b) => {
      return a.price_range.length - b.price_range.length;
    });
};

The function parameters must be defined in JSON schema for the AI to read and understand.

// List of functions available to the AI
const functions: AxFunction[] = [
  {
    name: 'getCurrentWeather',
    description: 'get the current weather for a location',
    func: weatherAPI,
    parameters: {
      type: 'object',
      properties: {
        location: {
          description: 'location to get weather for',
          type: 'string'
        },
        units: {
          type: 'string',
          enum: ['imperial', 'metric'],
          description: 'units to use'
        }
      },
      required: ['location']
    }
  },
  {
    name: 'findRestaurants',
    description: 'find restaurants in a location',
    func: opentableAPI,
    parameters: {
      type: 'object',
      properties: {
        location: {
          description: 'location to find restaurants in',
          type: 'string'
        },
        outdoor: {
          type: 'boolean',
          description: 'outdoor seating'
        },
        cuisine: { type: 'string', description: 'cuisine type' },
        priceRange: {
          type: 'string',
          enum: ['$', '$$', '$$$', '$$$$'],
          description: 'price range'
        }
      },
      required: ['location', 'outdoor', 'cuisine', 'priceRange']
    }
  }
];

Let’s use this agent.

const customerQuery =
  "Give me an ideas for lunch today in San Francisco. I like sushi but I don't want to spend too much or other options are fine as well. Also if its a nice day I'd rather sit outside.";

const ai = new Ax({
  name: 'openai',
  apiKey: process.env.OPENAI_APIKEY as string
});

const agent = new AxAgent({
  name: 'Restaurant search agent'
  description:
    'Search for restaurants to dine at based on the weather and food preferences',
  signature:
    `customerQuery:string  -> restaurant:string, priceRange:string "use $ signs to indicate price range"`
    functions,
});

const res = await agent.forward(ai, { customerQuery });
console.log(res);
npm run tsx src/examples/food-search.ts

{
  restaurant: 'Sukiyabashi Jiro',
  priceRange: '$$'
}

> AxAI

Defined in: src/ax/ai/wrap.ts:80

Implements

Constructors

new AxAI()

new AxAI(options): AxAI

Defined in: src/ax/ai/wrap.ts:83

Parameters

ParameterType
optionsReadonly<AxAIArgs>

Returns

AxAI

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/wrap.ts:150

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Implementation of

AxAIService.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/wrap.ts:157

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Implementation of

AxAIService.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/wrap.ts:134

Returns

undefined | Readonly<AxModelInfoWithProvider>

Implementation of

AxAIService.getEmbedModelInfo


getFeatures()

getFeatures(model?): object

Defined in: src/ax/ai/wrap.ts:138

Parameters

ParameterType
model?string

Returns

object

functions

functions: boolean

streaming

streaming: boolean

Implementation of

AxAIService.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/wrap.ts:146

Returns

AxAIServiceMetrics

Implementation of

AxAIService.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/wrap.ts:130

Returns

Readonly<AxModelInfoWithProvider>

Implementation of

AxAIService.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/wrap.ts:142

Returns

undefined | AxAIModelMap

Implementation of

AxAIService.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/wrap.ts:126

Returns

string

Implementation of

AxAIService.getName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/wrap.ts:164

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Implementation of

AxAIService.setOptions

> AxAIAnthropic

Defined in: src/ax/ai/anthropic/api.ts:287

Extends

Constructors

new AxAIAnthropic()

new AxAIAnthropic(__namedParameters): AxAIAnthropic

Defined in: src/ax/ai/anthropic/api.ts:294

Parameters

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

Returns

AxAIAnthropic

Overrides

AxBaseAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxBaseAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxBaseAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxBaseAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxBaseAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxBaseAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxBaseAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxBaseAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxBaseAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxBaseAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxBaseAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxBaseAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxBaseAI.setOptions

> AxAIAzureOpenAI

Defined in: src/ax/ai/azure-openai/api.ts:34

Extends

Constructors

new AxAIAzureOpenAI()

new AxAIAzureOpenAI(__namedParameters): AxAIAzureOpenAI

Defined in: src/ax/ai/azure-openai/api.ts:35

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAIAzureOpenAIArgs, "name">>

Returns

AxAIAzureOpenAI

Overrides

AxAIOpenAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxAIOpenAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxAIOpenAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxAIOpenAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxAIOpenAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxAIOpenAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxAIOpenAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxAIOpenAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxAIOpenAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxAIOpenAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxAIOpenAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxAIOpenAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxAIOpenAI.setOptions

> AxAICohere

Defined in: src/ax/ai/cohere/api.ts:286

Extends

Constructors

new AxAICohere()

new AxAICohere(__namedParameters): AxAICohere

Defined in: src/ax/ai/cohere/api.ts:293

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAICohereArgs, "name">>

Returns

AxAICohere

Overrides

AxBaseAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxBaseAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxBaseAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxBaseAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxBaseAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxBaseAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxBaseAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxBaseAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxBaseAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxBaseAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxBaseAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxBaseAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxBaseAI.setOptions

> AxAIGoogleGemini

Defined in: src/ax/ai/google-gemini/api.ts:439

AxAIGoogleGemini: AI Service

Extends

Constructors

new AxAIGoogleGemini()

new AxAIGoogleGemini(__namedParameters): AxAIGoogleGemini

Defined in: src/ax/ai/google-gemini/api.ts:446

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAIGoogleGeminiArgs, "name">>

Returns

AxAIGoogleGemini

Overrides

AxBaseAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxBaseAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxBaseAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxBaseAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxBaseAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxBaseAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxBaseAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxBaseAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxBaseAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxBaseAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxBaseAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxBaseAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxBaseAI.setOptions

> AxAIDeepSeek

Defined in: src/ax/ai/deepseek/api.ts:34

Extends

Constructors

new AxAIDeepSeek()

new AxAIDeepSeek(__namedParameters): AxAIDeepSeek

Defined in: src/ax/ai/deepseek/api.ts:35

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAIDeepSeekArgs, "name">>

Returns

AxAIDeepSeek

Overrides

AxAIOpenAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxAIOpenAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxAIOpenAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxAIOpenAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxAIOpenAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxAIOpenAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxAIOpenAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxAIOpenAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxAIOpenAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxAIOpenAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxAIOpenAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxAIOpenAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxAIOpenAI.setOptions

> AxAIGroq

Defined in: src/ax/ai/groq/api.ts:26

Extends

Constructors

new AxAIGroq()

new AxAIGroq(__namedParameters): AxAIGroq

Defined in: src/ax/ai/groq/api.ts:27

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAIGroqArgs, "groq">>

Returns

AxAIGroq

Overrides

AxAIOpenAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxAIOpenAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxAIOpenAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxAIOpenAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxAIOpenAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxAIOpenAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxAIOpenAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxAIOpenAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxAIOpenAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxAIOpenAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxAIOpenAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxAIOpenAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/groq/api.ts:59

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Overrides

AxAIOpenAI.setOptions

> AxAIHuggingFace

Defined in: src/ax/ai/huggingface/api.ts:155

Extends

Constructors

new AxAIHuggingFace()

new AxAIHuggingFace(__namedParameters): AxAIHuggingFace

Defined in: src/ax/ai/huggingface/api.ts:162

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAIHuggingFaceArgs, "name">>

Returns

AxAIHuggingFace

Overrides

AxBaseAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxBaseAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxBaseAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxBaseAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxBaseAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxBaseAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxBaseAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxBaseAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxBaseAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxBaseAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxBaseAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxBaseAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxBaseAI.setOptions

> AxAIMistral

Defined in: src/ax/ai/mistral/api.ts:31

Extends

Constructors

new AxAIMistral()

new AxAIMistral(__namedParameters): AxAIMistral

Defined in: src/ax/ai/mistral/api.ts:32

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAIMistralArgs, "name">>

Returns

AxAIMistral

Overrides

AxAIOpenAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxAIOpenAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxAIOpenAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxAIOpenAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxAIOpenAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxAIOpenAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxAIOpenAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxAIOpenAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxAIOpenAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxAIOpenAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxAIOpenAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxAIOpenAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxAIOpenAI.setOptions

> AxAIOpenAI

Defined in: src/ax/ai/openai/api.ts:408

Extends

Extended by

Constructors

new AxAIOpenAI()

new AxAIOpenAI(__namedParameters): AxAIOpenAI

Defined in: src/ax/ai/openai/api.ts:415

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAIOpenAIArgs, "name">>

Returns

AxAIOpenAI

Overrides

AxBaseAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxBaseAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxBaseAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxBaseAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxBaseAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxBaseAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxBaseAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxBaseAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxBaseAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxBaseAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxBaseAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxBaseAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxBaseAI.setOptions

> AxAIOllama

Defined in: src/ax/ai/ollama/api.ts:39

OllamaAI: AI Service

Extends

Constructors

new AxAIOllama()

new AxAIOllama(__namedParameters): AxAIOllama

Defined in: src/ax/ai/ollama/api.ts:40

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAIOllamaArgs, "name">>

Returns

AxAIOllama

Overrides

AxAIOpenAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxAIOpenAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxAIOpenAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxAIOpenAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxAIOpenAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxAIOpenAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxAIOpenAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxAIOpenAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxAIOpenAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxAIOpenAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxAIOpenAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxAIOpenAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxAIOpenAI.setOptions

> AxAIReka

Defined in: src/ax/ai/reka/api.ts:263

Extends

Constructors

new AxAIReka()

new AxAIReka(__namedParameters): AxAIReka

Defined in: src/ax/ai/reka/api.ts:270

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAIRekaArgs, "name">>

Returns

AxAIReka

Overrides

AxBaseAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxBaseAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxBaseAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxBaseAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxBaseAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxBaseAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxBaseAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxBaseAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxBaseAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxBaseAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxBaseAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxBaseAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxBaseAI.setOptions

> AxAITogether

Defined in: src/ax/ai/together/api.ts:25

Extends

Constructors

new AxAITogether()

new AxAITogether(__namedParameters): AxAITogether

Defined in: src/ax/ai/together/api.ts:26

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAITogetherArgs, "name">>

Returns

AxAITogether

Overrides

AxAIOpenAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxAIOpenAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxAIOpenAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxAIOpenAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxAIOpenAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxAIOpenAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxAIOpenAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxAIOpenAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxAIOpenAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxAIOpenAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxAIOpenAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxAIOpenAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxAIOpenAI.setOptions

> AxAgent

Defined in: src/ax/prompts/agent.ts:23

Type Parameters

Type Parameter
IN extends AxGenIn
OUT extends AxGenOut

Implements

Constructors

new AxAgent()

new AxAgent<IN, OUT>(__namedParameters, options?): AxAgent<IN, OUT>

Defined in: src/ax/prompts/agent.ts:36

Parameters

ParameterType
__namedParametersReadonly<{ agents: AxAgentic[]; ai: Readonly<AxAIService>; description: string; functions: AxFunction[]; name: string; signature: string | AxSignature; }>
options?Readonly<AxAgentOptions>

Returns

AxAgent<IN, OUT>

Methods

forward()

forward(ai, values, options?): Promise<OUT>

Defined in: src/ax/prompts/agent.ts:145

Parameters

ParameterType
aiReadonly<AxAIService>
valuesIN
options?Readonly<AxProgramForwardOptions>

Returns

Promise<OUT>


getFunction()

getFunction(): AxFunction

Defined in: src/ax/prompts/agent.ts:124

Returns

AxFunction

Implementation of

AxAgentic.getFunction


getTraces()

getTraces(): AxProgramTrace[]

Defined in: src/ax/prompts/agent.ts:108

Returns

AxProgramTrace[]

Implementation of

AxAgentic.getTraces


getUsage()

getUsage(): AxTokenUsage & object[]

Defined in: src/ax/prompts/agent.ts:116

Returns

AxTokenUsage & object[]

Implementation of

AxAgentic.getUsage


resetUsage()

resetUsage(): void

Defined in: src/ax/prompts/agent.ts:120

Returns

void

Implementation of

AxAgentic.resetUsage


setDemos()

setDemos(demos): void

Defined in: src/ax/prompts/agent.ts:112

Parameters

ParameterType
demosreadonly AxProgramDemos[]

Returns

void

Implementation of

AxAgentic.setDemos


setExamples()

setExamples(examples): void

Defined in: src/ax/prompts/agent.ts:96

Parameters

ParameterType
examplesReadonly<AxProgramExamples>

Returns

void

Implementation of

AxAgentic.setExamples


setId()

setId(id): void

Defined in: src/ax/prompts/agent.ts:100

Parameters

ParameterType
idstring

Returns

void

Implementation of

AxAgentic.setId


setParentId()

setParentId(parentId): void

Defined in: src/ax/prompts/agent.ts:104

Parameters

ParameterType
parentIdstring

Returns

void

Implementation of

AxAgentic.setParentId

> AxApacheTika

Defined in: src/ax/docs/tika.ts:12

Constructors

new AxApacheTika()

new AxApacheTika(args?): AxApacheTika

Defined in: src/ax/docs/tika.ts:16

Parameters

ParameterType
args?Readonly<AxApacheTikaArgs>

Returns

AxApacheTika

Methods

convert()

convert(files, options?): Promise<string[]>

Defined in: src/ax/docs/tika.ts:54

Parameters

ParameterType
filesReadonly<string[] | Blob[]>
options?Readonly<{ batchSize: number; format: "text" | "html"; }>

Returns

Promise<string[]>

> AxAssertionError

Defined in: src/ax/dsp/asserts.ts:17

Extends

  • Error

Constructors

new AxAssertionError()

new AxAssertionError(__namedParameters): AxAssertionError

Defined in: src/ax/dsp/asserts.ts:21

Parameters

ParameterType
__namedParametersReadonly<{ message: string; optional: boolean; values: Record<string, unknown>; }>

Returns

AxAssertionError

Overrides

Error.constructor

Properties

cause?

optional cause: unknown

Defined in: node_modules/typescript/lib/lib.es2022.error.d.ts:26

Inherited from

Error.cause


message

message: string

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1077

Inherited from

Error.message


name

name: string

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1076

Inherited from

Error.name


stack?

optional stack: string

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1078

Inherited from

Error.stack


prepareStackTrace()?

static optional prepareStackTrace: (err, stackTraces) => any

Defined in: node_modules/@types/node/globals.d.ts:143

Optional override for formatting stack traces

Parameters

ParameterType
errError
stackTracesCallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

Error.prepareStackTrace


stackTraceLimit

static stackTraceLimit: number

Defined in: node_modules/@types/node/globals.d.ts:145

Inherited from

Error.stackTraceLimit

Methods

getFixingInstructions()

getFixingInstructions(_sig): object[]

Defined in: src/ax/dsp/asserts.ts:40

Parameters

ParameterType
_sigReadonly<AxSignature>

Returns

object[]


getOptional()

getOptional(): undefined | boolean

Defined in: src/ax/dsp/asserts.ts:37

Returns

undefined | boolean


getValue()

getValue(): Record<string, unknown>

Defined in: src/ax/dsp/asserts.ts:36

Returns

Record<string, unknown>


captureStackTrace()

static captureStackTrace(targetObject, constructorOpt?): void

Defined in: node_modules/@types/node/globals.d.ts:136

Create .stack property on a target object

Parameters

ParameterType
targetObjectobject
constructorOpt?Function

Returns

void

Inherited from

Error.captureStackTrace

> AxBalancer

Defined in: src/ax/ai/balance.ts:47

Balancer that rotates through services.

Implements

Constructors

new AxBalancer()

new AxBalancer(services, options?): AxBalancer

Defined in: src/ax/ai/balance.ts:52

Parameters

ParameterType
servicesreadonly AxAIService[]
options?AxBalancerOptions

Returns

AxBalancer

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/balance.ts:108

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Implementation of

AxAIService.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/balance.ts:125

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Implementation of

AxAIService.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/balance.ts:96

Returns

undefined | Readonly<AxModelInfoWithProvider>

Implementation of

AxAIService.getEmbedModelInfo


getFeatures()

getFeatures(model?): object

Defined in: src/ax/ai/balance.ts:100

Parameters

ParameterType
model?string

Returns

object

functions

functions: boolean

streaming

streaming: boolean

Implementation of

AxAIService.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/balance.ts:104

Returns

AxAIServiceMetrics

Implementation of

AxAIService.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/balance.ts:92

Returns

Readonly<AxModelInfoWithProvider>

Implementation of

AxAIService.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/balance.ts:66

Returns

undefined | AxAIModelMap

Implementation of

AxAIService.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/balance.ts:88

Returns

string

Implementation of

AxAIService.getName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/balance.ts:142

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Implementation of

AxAIService.setOptions

> AxBaseAI

Defined in: src/ax/ai/base.ts:64

Extended by

Type Parameters

Type Parameter
TChatRequest
TEmbedRequest
TChatResponse
TChatResponseDelta
TEmbedResponse

Implements

Constructors

new AxBaseAI()

new AxBaseAI<TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse>(aiImpl, __namedParameters): AxBaseAI<TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse>

Defined in: src/ax/ai/base.ts:119

Parameters

ParameterType
aiImplReadonly<AxAIServiceImpl<TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse>>
__namedParametersReadonly<AxBaseAIArgs>

Returns

AxBaseAI<TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse>

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Implementation of

AxAIService.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Implementation of

AxAIService.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Implementation of

AxAIService.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Implementation of

AxAIService.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Implementation of

AxAIService.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Implementation of

AxAIService.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Implementation of

AxAIService.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Implementation of

AxAIService.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Implementation of

AxAIService.setOptions

> AxBootstrapFewShot

Defined in: src/ax/dsp/optimize.ts:28

Type Parameters

Type ParameterDefault type
IN extends AxGenInAxGenIn
OUT extends AxGenOutAxGenOut

Constructors

new AxBootstrapFewShot()

new AxBootstrapFewShot<IN, OUT>(__namedParameters): AxBootstrapFewShot<IN, OUT>

Defined in: src/ax/dsp/optimize.ts:40

Parameters

ParameterType
__namedParametersReadonly<AxOptimizerArgs<IN, OUT>>

Returns

AxBootstrapFewShot<IN, OUT>

Methods

compile()

compile(metricFn, options?): Promise<AxProgramDemos[]>

Defined in: src/ax/dsp/optimize.ts:105

Parameters

ParameterType
metricFnAxMetricFn
options?Readonly<undefined | { maxDemos: number; maxExamples: number; maxRounds: number; }>

Returns

Promise<AxProgramDemos[]>

> AxChainOfThought

Defined in: src/ax/prompts/cot.ts:5

Extends

  • AxGen<IN, OUT & object>

Extended by

Type Parameters

Type ParameterDefault type
IN extends AxGenInAxGenIn
OUT extends AxGenOutAxGenOut

Constructors

new AxChainOfThought()

new AxChainOfThought<IN, OUT>(signature, options?): AxChainOfThought<IN, OUT>

Defined in: src/ax/prompts/cot.ts:9

Parameters

ParameterType
signatureReadonly<string | AxSignature>
options?Readonly<AxGenOptions>

Returns

AxChainOfThought<IN, OUT>

Overrides

AxGen.constructor

Methods

addAssert()

addAssert(fn, message?, optional?): void

Defined in: src/ax/dsp/generate.ts:115

Parameters

ParameterType
fn(values) => undefined | boolean
message?string
optional?boolean

Returns

void

Inherited from

AxGen.addAssert


addStreamingAssert()

addStreamingAssert(fieldName, fn, message?, optional?): void

Defined in: src/ax/dsp/generate.ts:123

Parameters

ParameterType
fieldNamestring
fn(content, done?) => undefined | boolean
message?string
optional?boolean

Returns

void

Inherited from

AxGen.addStreamingAssert


forward()

forward(ai, values, options?): Promise<OUT & object>

Defined in: src/ax/dsp/generate.ts:453

Parameters

ParameterType
aiReadonly<AxAIService>
valuesIN
options?Readonly<AxProgramForwardOptions>

Returns

Promise<OUT & object>

Inherited from

AxGen.forward


getSignature()

getSignature(): AxSignature

Defined in: src/ax/dsp/program.ts:117

Returns

AxSignature

Inherited from

AxGen.getSignature


getTraces()

getTraces(): AxProgramTrace[]

Defined in: src/ax/dsp/program.ts:193

Returns

AxProgramTrace[]

Inherited from

AxGen.getTraces


getUsage()

getUsage(): AxTokenUsage & object[]

Defined in: src/ax/dsp/program.ts:207

Returns

AxTokenUsage & object[]

Inherited from

AxGen.getUsage


register()

register(prog): void

Defined in: src/ax/dsp/program.ts:121

Parameters

ParameterType
progReadonly<AxTunable & AxUsable>

Returns

void

Inherited from

AxGen.register


resetUsage()

resetUsage(): void

Defined in: src/ax/dsp/program.ts:217

Returns

void

Inherited from

AxGen.resetUsage


setDemos()

setDemos(demos): void

Defined in: src/ax/dsp/program.ts:224

Parameters

ParameterType
demosreadonly AxProgramDemos[]

Returns

void

Inherited from

AxGen.setDemos


setExamples()

setExamples(examples): void

Defined in: src/ax/dsp/program.ts:152

Parameters

ParameterType
examplesReadonly<AxProgramExamples>

Returns

void

Inherited from

AxGen.setExamples


setId()

setId(id): void

Defined in: src/ax/dsp/program.ts:139

Parameters

ParameterType
idstring

Returns

void

Inherited from

AxGen.setId


setParentId()

setParentId(parentId): void

Defined in: src/ax/dsp/program.ts:146

Parameters

ParameterType
parentIdstring

Returns

void

Inherited from

AxGen.setParentId

> AxDB

Defined in: src/ax/db/wrap.ts:19

Implements

Constructors

new AxDB()

new AxDB(args): AxDB

Defined in: src/ax/db/wrap.ts:21

Parameters

ParameterType
argsReadonly<AxDBArgs>

Returns

AxDB

Methods

batchUpsert()

batchUpsert(batchReq, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/wrap.ts:46

Parameters

ParameterType
batchReqreadonly AxDBUpsertRequest[]
update?boolean

Returns

Promise<AxDBUpsertResponse>

Implementation of

AxDBService.batchUpsert


query()

query(req): Promise<AxDBQueryResponse>

Defined in: src/ax/db/wrap.ts:53

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>

Returns

Promise<AxDBQueryResponse>

Implementation of

AxDBService.query


upsert()

upsert(req, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/wrap.ts:39

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
update?boolean

Returns

Promise<AxDBUpsertResponse>

Implementation of

AxDBService.upsert

> AxDBBase

Defined in: src/ax/db/base.ts:22

Extended by

Implements

Constructors

new AxDBBase()

new AxDBBase(__namedParameters): AxDBBase

Defined in: src/ax/db/base.ts:44

Parameters

ParameterType
__namedParametersReadonly<AxDBBaseArgs & object>

Returns

AxDBBase

Properties

_batchUpsert()?

optional _batchUpsert: (batchReq, update?, options?) => Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:33

Parameters

ParameterType
batchReqreadonly AxDBUpsertRequest[]
update?boolean
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBUpsertResponse>


_query()?

optional _query: (req, options?) => Promise<AxDBQueryResponse>

Defined in: src/ax/db/base.ts:39

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBQueryResponse>


_upsert()?

optional _upsert: (req, update?, options?) => Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:27

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
update?boolean
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBUpsertResponse>

Methods

batchUpsert()

batchUpsert(req, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:86

Parameters

ParameterType
reqreadonly AxDBUpsertRequest[]
update?boolean

Returns

Promise<AxDBUpsertResponse>

Implementation of

AxDBService.batchUpsert


query()

query(req): Promise<AxDBQueryResponse>

Defined in: src/ax/db/base.ts:124

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>

Returns

Promise<AxDBQueryResponse>

Implementation of

AxDBService.query


upsert()

upsert(req, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:54

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
update?boolean

Returns

Promise<AxDBUpsertResponse>

Implementation of

AxDBService.upsert

> AxDBCloudflare

Defined in: src/ax/db/cloudflare.ts:44

Cloudflare: DB Service

Extends

Constructors

new AxDBCloudflare()

new AxDBCloudflare(__namedParameters): AxDBCloudflare

Defined in: src/ax/db/cloudflare.ts:48

Parameters

ParameterType
__namedParametersReadonly<Omit<AxDBCloudflareArgs, "name">>

Returns

AxDBCloudflare

Overrides

AxDBBase.constructor

Properties

_batchUpsert()?

optional _batchUpsert: (batchReq, update?, options?) => Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:33

Parameters

ParameterType
batchReqreadonly AxDBUpsertRequest[]
update?boolean
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBUpsertResponse>

Inherited from

AxDBBase._batchUpsert


_query()?

optional _query: (req, options?) => Promise<AxDBQueryResponse>

Defined in: src/ax/db/base.ts:39

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBQueryResponse>

Inherited from

AxDBBase._query

Methods

_upsert()

_upsert(req, _update?, options?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/cloudflare.ts:62

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
_update?boolean
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBUpsertResponse>

Overrides

AxDBBase._upsert


batchUpsert()

batchUpsert(batchReq, update?, options?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/cloudflare.ts:98

Parameters

ParameterType
batchReqreadonly AxDBUpsertRequest[]
update?boolean
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBUpsertResponse>

Overrides

AxDBBase.batchUpsert


query()

query(req, options?): Promise<AxDBQueryResponse>

Defined in: src/ax/db/cloudflare.ts:147

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBQueryResponse>

Overrides

AxDBBase.query


upsert()

upsert(req, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:54

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
update?boolean

Returns

Promise<AxDBUpsertResponse>

Inherited from

AxDBBase.upsert

> AxDBManager

Defined in: src/ax/docs/manager.ts:33

Constructors

new AxDBManager()

new AxDBManager(__namedParameters): AxDBManager

Defined in: src/ax/docs/manager.ts:40

Parameters

ParameterType
__namedParametersReadonly<AxDBManagerArgs>

Returns

AxDBManager

Methods

insert()

insert(text, options?): Promise<void>

Defined in: src/ax/docs/manager.ts:53

Parameters

ParameterType
textReadonly<string | string[]>
options?Readonly<{ batchSize: number; maxWordsPerChunk: number; minWordsPerChunk: number; }>

Returns

Promise<void>


query()

query(query, __namedParameters): Promise<AxDBMatch[][]>

Defined in: src/ax/docs/manager.ts:109

Parameters

ParameterType
queryReadonly<string | number | string[] | number[]>
__namedParametersundefined | Readonly<{ topPercent: number; }>

Returns

Promise<AxDBMatch[][]>

> AxDBMemory

Defined in: src/ax/db/memory.ts:20

MemoryDB: DB Service

Extends

Constructors

new AxDBMemory()

new AxDBMemory(__namedParameters): AxDBMemory

Defined in: src/ax/db/memory.ts:23

Parameters

ParameterType
__namedParametersReadonly<Omit<AxDBMemoryArgs, "name">>

Returns

AxDBMemory

Overrides

AxDBBase.constructor

Methods

_batchUpsert()

_batchUpsert(batchReq, update?, _options?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/memory.ts:50

Parameters

ParameterType
batchReqreadonly AxDBUpsertRequest[]
update?boolean
_options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBUpsertResponse>

Overrides

AxDBBase._batchUpsert


_query()

_query(req, _options?): Promise<AxDBQueryResponse>

Defined in: src/ax/db/memory.ts:65

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>
_options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBQueryResponse>

Overrides

AxDBBase._query


_upsert()

_upsert(req, _update?, _options?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/memory.ts:28

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
_update?boolean
_options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBUpsertResponse>

Overrides

AxDBBase._upsert


batchUpsert()

batchUpsert(req, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:86

Parameters

ParameterType
reqreadonly AxDBUpsertRequest[]
update?boolean

Returns

Promise<AxDBUpsertResponse>

Inherited from

AxDBBase.batchUpsert


clearDB()

clearDB(): void

Defined in: src/ax/db/memory.ts:100

Returns

void


getDB()

getDB(): AxDBState

Defined in: src/ax/db/memory.ts:92

Returns

AxDBState


query()

query(req): Promise<AxDBQueryResponse>

Defined in: src/ax/db/base.ts:124

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>

Returns

Promise<AxDBQueryResponse>

Inherited from

AxDBBase.query


setDB()

setDB(state): void

Defined in: src/ax/db/memory.ts:96

Parameters

ParameterType
stateAxDBState

Returns

void


upsert()

upsert(req, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:54

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
update?boolean

Returns

Promise<AxDBUpsertResponse>

Inherited from

AxDBBase.upsert

> AxDBWeaviate

Defined in: src/ax/db/weaviate.ts:39

Weaviate: DB Service

Extends

Constructors

new AxDBWeaviate()

new AxDBWeaviate(__namedParameters): AxDBWeaviate

Defined in: src/ax/db/weaviate.ts:43

Parameters

ParameterType
__namedParametersReadonly<Omit<AxDBWeaviateArgs, "name">>

Returns

AxDBWeaviate

Overrides

AxDBBase.constructor

Methods

_batchUpsert()

_batchUpsert(batchReq, update?, options?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/weaviate.ts:93

Parameters

ParameterType
batchReqreadonly AxDBUpsertRequest[]
update?boolean
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBUpsertResponse>

Overrides

AxDBBase._batchUpsert


_query()

_query(req, options?): Promise<AxDBQueryResponse>

Defined in: src/ax/db/weaviate.ts:138

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBQueryResponse>

Overrides

AxDBBase._query


_upsert()

_upsert(req, update?, options?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/weaviate.ts:57

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
update?boolean
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBUpsertResponse>

Overrides

AxDBBase._upsert


batchUpsert()

batchUpsert(req, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:86

Parameters

ParameterType
reqreadonly AxDBUpsertRequest[]
update?boolean

Returns

Promise<AxDBUpsertResponse>

Inherited from

AxDBBase.batchUpsert


query()

query(req): Promise<AxDBQueryResponse>

Defined in: src/ax/db/base.ts:124

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>

Returns

Promise<AxDBQueryResponse>

Inherited from

AxDBBase.query


upsert()

upsert(req, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:54

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
update?boolean

Returns

Promise<AxDBUpsertResponse>

Inherited from

AxDBBase.upsert

> AxDBPinecone

Defined in: src/ax/db/pinecone.ts:58

Pinecone: DB Service

Extends

Constructors

new AxDBPinecone()

new AxDBPinecone(__namedParameters): AxDBPinecone

Defined in: src/ax/db/pinecone.ts:62

Parameters

ParameterType
__namedParametersReadonly<Omit<AxDBPineconeArgs, "name">>

Returns

AxDBPinecone

Overrides

AxDBBase.constructor

Properties

_query()?

optional _query: (req, options?) => Promise<AxDBQueryResponse>

Defined in: src/ax/db/base.ts:39

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBQueryResponse>

Inherited from

AxDBBase._query

Methods

_batchUpsert()

_batchUpsert(batchReq, _update?, options?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/pinecone.ts:85

Parameters

ParameterType
batchReqreadonly AxDBUpsertRequest[]
_update?boolean
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBUpsertResponse>

Overrides

AxDBBase._batchUpsert


_upsert()

_upsert(req, update?, options?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/pinecone.ts:76

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
update?boolean
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBUpsertResponse>

Overrides

AxDBBase._upsert


batchUpsert()

batchUpsert(req, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:86

Parameters

ParameterType
reqreadonly AxDBUpsertRequest[]
update?boolean

Returns

Promise<AxDBUpsertResponse>

Inherited from

AxDBBase.batchUpsert


query()

query(req, options?): Promise<AxDBQueryResponse>

Defined in: src/ax/db/pinecone.ts:111

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBQueryResponse>

Overrides

AxDBBase.query


upsert()

upsert(req, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:54

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
update?boolean

Returns

Promise<AxDBUpsertResponse>

Inherited from

AxDBBase.upsert

> AxDefaultQueryRewriter

Defined in: src/ax/docs/rewriter.ts:8

Extends

Constructors

new AxDefaultQueryRewriter()

new AxDefaultQueryRewriter(options?): AxDefaultQueryRewriter

Defined in: src/ax/docs/rewriter.ts:9

Parameters

ParameterType
options?Readonly<AxGenOptions>

Returns

AxDefaultQueryRewriter

Overrides

AxGen.constructor

Methods

addAssert()

addAssert(fn, message?, optional?): void

Defined in: src/ax/dsp/generate.ts:115

Parameters

ParameterType
fn(values) => undefined | boolean
message?string
optional?boolean

Returns

void

Inherited from

AxGen.addAssert


addStreamingAssert()

addStreamingAssert(fieldName, fn, message?, optional?): void

Defined in: src/ax/dsp/generate.ts:123

Parameters

ParameterType
fieldNamestring
fn(content, done?) => undefined | boolean
message?string
optional?boolean

Returns

void

Inherited from

AxGen.addStreamingAssert


forward()

forward(ai, values, options?): Promise<AxRewriteOut>

Defined in: src/ax/dsp/generate.ts:453

Parameters

ParameterType
aiReadonly<AxAIService>
valuesAxRewriteIn
options?Readonly<AxProgramForwardOptions>

Returns

Promise<AxRewriteOut>

Inherited from

AxGen.forward


getSignature()

getSignature(): AxSignature

Defined in: src/ax/dsp/program.ts:117

Returns

AxSignature

Inherited from

AxGen.getSignature


getTraces()

getTraces(): AxProgramTrace[]

Defined in: src/ax/dsp/program.ts:193

Returns

AxProgramTrace[]

Inherited from

AxGen.getTraces


getUsage()

getUsage(): AxTokenUsage & object[]

Defined in: src/ax/dsp/program.ts:207

Returns

AxTokenUsage & object[]

Inherited from

AxGen.getUsage


register()

register(prog): void

Defined in: src/ax/dsp/program.ts:121

Parameters

ParameterType
progReadonly<AxTunable & AxUsable>

Returns

void

Inherited from

AxGen.register


resetUsage()

resetUsage(): void

Defined in: src/ax/dsp/program.ts:217

Returns

void

Inherited from

AxGen.resetUsage


setDemos()

setDemos(demos): void

Defined in: src/ax/dsp/program.ts:224

Parameters

ParameterType
demosreadonly AxProgramDemos[]

Returns

void

Inherited from

AxGen.setDemos


setExamples()

setExamples(examples): void

Defined in: src/ax/dsp/program.ts:152

Parameters

ParameterType
examplesReadonly<AxProgramExamples>

Returns

void

Inherited from

AxGen.setExamples


setId()

setId(id): void

Defined in: src/ax/dsp/program.ts:139

Parameters

ParameterType
idstring

Returns

void

Inherited from

AxGen.setId


setParentId()

setParentId(parentId): void

Defined in: src/ax/dsp/program.ts:146

Parameters

ParameterType
parentIdstring

Returns

void

Inherited from

AxGen.setParentId

> AxDefaultResultReranker

Defined in: src/ax/docs/reranker.ts:8

Extends

Constructors

new AxDefaultResultReranker()

new AxDefaultResultReranker(options?): AxDefaultResultReranker

Defined in: src/ax/docs/reranker.ts:12

Parameters

ParameterType
options?Readonly<AxGenOptions>

Returns

AxDefaultResultReranker

Overrides

AxGen.constructor

Methods

addAssert()

addAssert(fn, message?, optional?): void

Defined in: src/ax/dsp/generate.ts:115

Parameters

ParameterType
fn(values) => undefined | boolean
message?string
optional?boolean

Returns

void

Inherited from

AxGen.addAssert


addStreamingAssert()

addStreamingAssert(fieldName, fn, message?, optional?): void

Defined in: src/ax/dsp/generate.ts:123

Parameters

ParameterType
fieldNamestring
fn(content, done?) => undefined | boolean
message?string
optional?boolean

Returns

void

Inherited from

AxGen.addStreamingAssert


forward()

forward(ai, input, options?): Promise<AxRerankerOut>

Defined in: src/ax/docs/reranker.ts:19

Parameters

ParameterType
aiReadonly<AxAIService>
inputReadonly<AxRerankerIn>
options?Readonly<AxProgramForwardOptions>

Returns

Promise<AxRerankerOut>

Overrides

AxGen.forward


getSignature()

getSignature(): AxSignature

Defined in: src/ax/dsp/program.ts:117

Returns

AxSignature

Inherited from

AxGen.getSignature


getTraces()

getTraces(): AxProgramTrace[]

Defined in: src/ax/dsp/program.ts:193

Returns

AxProgramTrace[]

Inherited from

AxGen.getTraces


getUsage()

getUsage(): AxTokenUsage & object[]

Defined in: src/ax/dsp/program.ts:207

Returns

AxTokenUsage & object[]

Inherited from

AxGen.getUsage


register()

register(prog): void

Defined in: src/ax/dsp/program.ts:121

Parameters

ParameterType
progReadonly<AxTunable & AxUsable>

Returns

void

Inherited from

AxGen.register


resetUsage()

resetUsage(): void

Defined in: src/ax/dsp/program.ts:217

Returns

void

Inherited from

AxGen.resetUsage


setDemos()

setDemos(demos): void

Defined in: src/ax/dsp/program.ts:224

Parameters

ParameterType
demosreadonly AxProgramDemos[]

Returns

void

Inherited from

AxGen.setDemos


setExamples()

setExamples(examples): void

Defined in: src/ax/dsp/program.ts:152

Parameters

ParameterType
examplesReadonly<AxProgramExamples>

Returns

void

Inherited from

AxGen.setExamples


setId()

setId(id): void

Defined in: src/ax/dsp/program.ts:139

Parameters

ParameterType
idstring

Returns

void

Inherited from

AxGen.setId


setParentId()

setParentId(parentId): void

Defined in: src/ax/dsp/program.ts:146

Parameters

ParameterType
parentIdstring

Returns

void

Inherited from

AxGen.setParentId

> AxDockerSession

Defined in: src/ax/funcs/docker.ts:56

Constructors

new AxDockerSession()

new AxDockerSession(apiUrl): AxDockerSession

Defined in: src/ax/funcs/docker.ts:60

Parameters

ParameterTypeDefault value
apiUrlstring'http://localhost:2375'

Returns

AxDockerSession

Methods

connectToContainer()

connectToContainer(containerId): Promise<void>

Defined in: src/ax/funcs/docker.ts:186

Parameters

ParameterType
containerIdstring

Returns

Promise<void>


createContainer()

createContainer(__namedParameters): Promise<{ Id: string; }>

Defined in: src/ax/funcs/docker.ts:80

Parameters

ParameterType
__namedParametersReadonly<{ doNotPullImage: boolean; imageName: string; tag: string; volumes: object[]; }>

Returns

Promise<{ Id: string; }>


executeCommand()

executeCommand(command): Promise<string>

Defined in: src/ax/funcs/docker.ts:274

Parameters

ParameterType
commandstring

Returns

Promise<string>


findOrCreateContainer()

findOrCreateContainer(__namedParameters): Promise<{ Id: string; isNew: boolean; }>

Defined in: src/ax/funcs/docker.ts:128

Parameters

ParameterType
__namedParametersReadonly<{ doNotPullImage: boolean; imageName: string; tag: string; volumes: object[]; }>

Returns

Promise<{ Id: string; isNew: boolean; }>


getContainerLogs()

getContainerLogs(): Promise<string>

Defined in: src/ax/funcs/docker.ts:263

Returns

Promise<string>


listContainers()

listContainers(all): Promise<AxDockerContainer[]>

Defined in: src/ax/funcs/docker.ts:256

Parameters

ParameterTypeDefault value
allbooleanfalse

Returns

Promise<AxDockerContainer[]>


pullImage()

pullImage(imageName): Promise<void>

Defined in: src/ax/funcs/docker.ts:64

Parameters

ParameterType
imageNamestring

Returns

Promise<void>


startContainer()

startContainer(): Promise<void>

Defined in: src/ax/funcs/docker.ts:169

Returns

Promise<void>


stopContainers()

stopContainers(__namedParameters): Promise<object[]>

Defined in: src/ax/funcs/docker.ts:198

Parameters

ParameterType
__namedParametersReadonly<{ remove: boolean; tag: string; timeout: number; }>

Returns

Promise<object[]>


toFunction()

toFunction(): AxFunction

Defined in: src/ax/funcs/docker.ts:373

Returns

AxFunction

> AxEmbeddingAdapter

Defined in: src/ax/funcs/embed.ts:7

Constructors

new AxEmbeddingAdapter()

new AxEmbeddingAdapter(__namedParameters): AxEmbeddingAdapter

Defined in: src/ax/funcs/embed.ts:19

Parameters

ParameterType
__namedParametersReadonly<{ ai: AxAIService; func: (args, extra?) => Promise<unknown>; info: Readonly<{ argumentDescription: string; description: string; name: string; }>; }>

Returns

AxEmbeddingAdapter

Methods

toFunction()

toFunction(): AxFunction

Defined in: src/ax/funcs/embed.ts:57

Returns

AxFunction

> AxFunctionProcessor

Defined in: src/ax/dsp/functions.ts:24

Constructors

new AxFunctionProcessor()

new AxFunctionProcessor(funcList): AxFunctionProcessor

Defined in: src/ax/dsp/functions.ts:27

Parameters

ParameterType
funcListreadonly AxFunction[]

Returns

AxFunctionProcessor

Methods

execute()

execute(func, options?): Promise<AxFunctionExec>

Defined in: src/ax/dsp/functions.ts:73

Parameters

ParameterType
funcReadonly<AxChatResponseFunctionCall>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxFunctionExec>

> AxGen

Defined in: src/ax/dsp/generate.ts:84

Extends

Extended by

Type Parameters

Type ParameterDefault type
IN extends AxGenInAxGenIn
OUT extends AxGenerateResult<AxGenOut>AxGenerateResult<AxGenOut>

Constructors

new AxGen()

new AxGen<IN, OUT>(signature, options?): AxGen<IN, OUT>

Defined in: src/ax/dsp/generate.ts:95

Parameters

ParameterType
signatureReadonly<string | AxSignature>
options?Readonly<AxGenOptions>

Returns

AxGen<IN, OUT>

Overrides

AxProgramWithSignature.constructor

Methods

addAssert()

addAssert(fn, message?, optional?): void

Defined in: src/ax/dsp/generate.ts:115

Parameters

ParameterType
fn(values) => undefined | boolean
message?string
optional?boolean

Returns

void


addStreamingAssert()

addStreamingAssert(fieldName, fn, message?, optional?): void

Defined in: src/ax/dsp/generate.ts:123

Parameters

ParameterType
fieldNamestring
fn(content, done?) => undefined | boolean
message?string
optional?boolean

Returns

void


forward()

forward(ai, values, options?): Promise<OUT>

Defined in: src/ax/dsp/generate.ts:453

Parameters

ParameterType
aiReadonly<AxAIService>
valuesIN
options?Readonly<AxProgramForwardOptions>

Returns

Promise<OUT>

Overrides

AxProgramWithSignature.forward


getSignature()

getSignature(): AxSignature

Defined in: src/ax/dsp/program.ts:117

Returns

AxSignature

Inherited from

AxProgramWithSignature.getSignature


getTraces()

getTraces(): AxProgramTrace[]

Defined in: src/ax/dsp/program.ts:193

Returns

AxProgramTrace[]

Inherited from

AxProgramWithSignature.getTraces


getUsage()

getUsage(): AxTokenUsage & object[]

Defined in: src/ax/dsp/program.ts:207

Returns

AxTokenUsage & object[]

Inherited from

AxProgramWithSignature.getUsage


register()

register(prog): void

Defined in: src/ax/dsp/program.ts:121

Parameters

ParameterType
progReadonly<AxTunable & AxUsable>

Returns

void

Inherited from

AxProgramWithSignature.register


resetUsage()

resetUsage(): void

Defined in: src/ax/dsp/program.ts:217

Returns

void

Inherited from

AxProgramWithSignature.resetUsage


setDemos()

setDemos(demos): void

Defined in: src/ax/dsp/program.ts:224

Parameters

ParameterType
demosreadonly AxProgramDemos[]

Returns

void

Inherited from

AxProgramWithSignature.setDemos


setExamples()

setExamples(examples): void

Defined in: src/ax/dsp/program.ts:152

Parameters

ParameterType
examplesReadonly<AxProgramExamples>

Returns

void

Inherited from

AxProgramWithSignature.setExamples


setId()

setId(id): void

Defined in: src/ax/dsp/program.ts:139

Parameters

ParameterType
idstring

Returns

void

Inherited from

AxProgramWithSignature.setId


setParentId()

setParentId(parentId): void

Defined in: src/ax/dsp/program.ts:146

Parameters

ParameterType
parentIdstring

Returns

void

Inherited from

AxProgramWithSignature.setParentId

> AxHFDataLoader

Defined in: src/ax/dsp/loader.ts:5

Constructors

new AxHFDataLoader()

new AxHFDataLoader(__namedParameters): AxHFDataLoader

Defined in: src/ax/dsp/loader.ts:14

Parameters

ParameterType
__namedParametersReadonly<{ config: string; dataset: string; options: Readonly<{ length: number; offset: number; }>; split: string; }>

Returns

AxHFDataLoader

Methods

getData()

getData(): AxDataRow[]

Defined in: src/ax/dsp/loader.ts:67

Returns

AxDataRow[]


getRows()

getRows<T>(__namedParameters): Promise<T[]>

Defined in: src/ax/dsp/loader.ts:71

Type Parameters

Type Parameter
T

Parameters

ParameterType
__namedParametersReadonly<{ count: number; fields: readonly string[]; renameMap: Record<string, string>; }>

Returns

Promise<T[]>


loadData()

loadData(): Promise<AxDataRow[]>

Defined in: src/ax/dsp/loader.ts:51

Returns

Promise<AxDataRow[]>


setData()

setData(rows): void

Defined in: src/ax/dsp/loader.ts:63

Parameters

ParameterType
rowsAxDataRow[]

Returns

void

> AxInstanceRegistry

Defined in: src/ax/dsp/registry.ts:1

Type Parameters

Type Parameter
T

Constructors

new AxInstanceRegistry()

new AxInstanceRegistry<T>(): AxInstanceRegistry<T>

Defined in: src/ax/dsp/registry.ts:4

Returns

AxInstanceRegistry<T>

Methods

[iterator]()

[iterator](): Generator<T, void>

Defined in: src/ax/dsp/registry.ts:12

Returns

Generator<T, void>


register()

register(instance): void

Defined in: src/ax/dsp/registry.ts:8

Parameters

ParameterType
instanceT

Returns

void

> AxJSInterpreter

Defined in: src/ax/funcs/code.ts:29

Constructors

new AxJSInterpreter()

new AxJSInterpreter(__namedParameters): AxJSInterpreter

Defined in: src/ax/funcs/code.ts:32

Parameters

ParameterType
__namedParametersundefined | Readonly<{ permissions: readonly AxJSInterpreterPermission[]; }>

Returns

AxJSInterpreter

Methods

toFunction()

toFunction(): AxFunction

Defined in: src/ax/funcs/code.ts:67

Returns

AxFunction

> AxMemory

Defined in: src/ax/mem/memory.ts:8

Implements

Constructors

new AxMemory()

new AxMemory(limit): AxMemory

Defined in: src/ax/mem/memory.ts:13

Parameters

ParameterTypeDefault value
limitnumber50

Returns

AxMemory

Methods

add()

add(value, sessionId?): void

Defined in: src/ax/mem/memory.ts:20

Parameters

ParameterType
valueReadonly<Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }> | Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: … | … | …; text: string; type: "text"; } | { cache: … | … | …; details: … | … | … | …; image: string; mimeType: string; type: "image"; } | { cache: … | … | …; data: string; format: … | …; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>[]>
sessionId?string

Returns

void

Implementation of

AxAIMemory.add


addResult()

addResult(__namedParameters, sessionId?): void

Defined in: src/ax/mem/memory.ts:41

Parameters

ParameterType
__namedParametersReadonly<AxChatResponseResult>
sessionId?string

Returns

void

Implementation of

AxAIMemory.addResult


getLast()

getLast(sessionId?): undefined | Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>

Defined in: src/ax/mem/memory.ts:79

Parameters

ParameterType
sessionId?string

Returns

undefined | Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>

Implementation of

AxAIMemory.getLast


history()

history(sessionId?): Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>[]

Defined in: src/ax/mem/memory.ts:75

Parameters

ParameterType
sessionId?string

Returns

Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>[]

Implementation of

AxAIMemory.history


reset()

reset(sessionId?): void

Defined in: src/ax/mem/memory.ts:84

Parameters

ParameterType
sessionId?string

Returns

void

Implementation of

AxAIMemory.reset


updateResult()

updateResult(__namedParameters, sessionId?): void

Defined in: src/ax/mem/memory.ts:51

Parameters

ParameterType
__namedParametersReadonly<AxChatResponseResult>
sessionId?string

Returns

void

Implementation of

AxAIMemory.updateResult

> AxProgramWithSignature

Defined in: src/ax/dsp/program.ts:89

Extended by

Type Parameters

Type Parameter
IN extends AxGenIn
OUT extends AxGenOut

Implements

Constructors

new AxProgramWithSignature()

new AxProgramWithSignature<IN, OUT>(signature, options?): AxProgramWithSignature<IN, OUT>

Defined in: src/ax/dsp/program.ts:103

Parameters

ParameterType
signatureReadonly<string | AxSignature>
options?Readonly<AxProgramWithSignatureOptions>

Returns

AxProgramWithSignature<IN, OUT>

Methods

forward()

forward(_ai, _values, _options?): Promise<OUT>

Defined in: src/ax/dsp/program.ts:128

Parameters

ParameterType
_aiReadonly<AxAIService>
_valuesIN
_options?Readonly<AxProgramForwardOptions>

Returns

Promise<OUT>


getSignature()

getSignature(): AxSignature

Defined in: src/ax/dsp/program.ts:117

Returns

AxSignature


getTraces()

getTraces(): AxProgramTrace[]

Defined in: src/ax/dsp/program.ts:193

Returns

AxProgramTrace[]

Implementation of

AxTunable.getTraces


getUsage()

getUsage(): AxTokenUsage & object[]

Defined in: src/ax/dsp/program.ts:207

Returns

AxTokenUsage & object[]

Implementation of

AxUsable.getUsage


register()

register(prog): void

Defined in: src/ax/dsp/program.ts:121

Parameters

ParameterType
progReadonly<AxTunable & AxUsable>

Returns

void


resetUsage()

resetUsage(): void

Defined in: src/ax/dsp/program.ts:217

Returns

void

Implementation of

AxUsable.resetUsage


setDemos()

setDemos(demos): void

Defined in: src/ax/dsp/program.ts:224

Parameters

ParameterType
demosreadonly AxProgramDemos[]

Returns

void

Implementation of

AxTunable.setDemos


setExamples()

setExamples(examples): void

Defined in: src/ax/dsp/program.ts:152

Parameters

ParameterType
examplesReadonly<AxProgramExamples>

Returns

void

Implementation of

AxTunable.setExamples


setId()

setId(id): void

Defined in: src/ax/dsp/program.ts:139

Parameters

ParameterType
idstring

Returns

void

Implementation of

AxTunable.setId


setParentId()

setParentId(parentId): void

Defined in: src/ax/dsp/program.ts:146

Parameters

ParameterType
parentIdstring

Returns

void

Implementation of

AxTunable.setParentId

> AxProgram

Defined in: src/ax/dsp/program.ts:236

Type Parameters

Type Parameter
IN extends AxGenIn
OUT extends AxGenOut

Implements

Constructors

new AxProgram()

new AxProgram<IN, OUT>(): AxProgram<IN, OUT>

Defined in: src/ax/dsp/program.ts:245

Returns

AxProgram<IN, OUT>

Methods

forward()

forward(_ai, _values, _options?): Promise<OUT>

Defined in: src/ax/dsp/program.ts:257

Parameters

ParameterType
_aiReadonly<AxAIService>
_valuesIN
_options?Readonly<AxProgramForwardOptions>

Returns

Promise<OUT>


getTraces()

getTraces(): AxProgramTrace[]

Defined in: src/ax/dsp/program.ts:291

Returns

AxProgramTrace[]

Implementation of

AxTunable.getTraces


getUsage()

getUsage(): AxTokenUsage & object[]

Defined in: src/ax/dsp/program.ts:305

Returns

AxTokenUsage & object[]

Implementation of

AxUsable.getUsage


register()

register(prog): void

Defined in: src/ax/dsp/program.ts:250

Parameters

ParameterType
progReadonly<AxTunable & AxUsable>

Returns

void


resetUsage()

resetUsage(): void

Defined in: src/ax/dsp/program.ts:315

Returns

void

Implementation of

AxUsable.resetUsage


setDemos()

setDemos(demos): void

Defined in: src/ax/dsp/program.ts:322

Parameters

ParameterType
demosreadonly AxProgramDemos[]

Returns

void

Implementation of

AxTunable.setDemos


setExamples()

setExamples(examples): void

Defined in: src/ax/dsp/program.ts:281

Parameters

ParameterType
examplesReadonly<AxProgramExamples>

Returns

void

Implementation of

AxTunable.setExamples


setId()

setId(id): void

Defined in: src/ax/dsp/program.ts:268

Parameters

ParameterType
idstring

Returns

void

Implementation of

AxTunable.setId


setParentId()

setParentId(parentId): void

Defined in: src/ax/dsp/program.ts:275

Parameters

ParameterType
parentIdstring

Returns

void

Implementation of

AxTunable.setParentId

> AxPromptTemplate

Defined in: src/ax/dsp/prompt.ts:22

Constructors

new AxPromptTemplate()

new AxPromptTemplate(sig, functions?, fieldTemplates?): AxPromptTemplate

Defined in: src/ax/dsp/prompt.ts:27

Parameters

ParameterType
sigReadonly<AxSignature>
functions?Readonly<AxInputFunctionType>
fieldTemplates?Record<string, AxFieldTemplateFn>

Returns

AxPromptTemplate

Methods

render()

render<T>(values, __namedParameters): Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>[]

Defined in: src/ax/dsp/prompt.ts:81

Type Parameters

Type Parameter
T extends Record<string, AxFieldValue>

Parameters

ParameterType
valuesT
__namedParametersReadonly<{ demos: Record<string, AxFieldValue>[]; examples: Record<string, AxFieldValue>[]; skipSystemPrompt: boolean; }>

Returns

Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>[]


renderExtraFields()

renderExtraFields(extraFields): string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]

Defined in: src/ax/dsp/prompt.ts:146

Parameters

ParameterType
extraFieldsreadonly AxIField[]

Returns

string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]

> AxRAG

Defined in: src/ax/prompts/rag.ts:12

Extends

  • AxChainOfThought<{ context: string[]; question: string; }, { answer: string; }>

Constructors

new AxRAG()

new AxRAG(queryFn, options): AxRAG

Defined in: src/ax/prompts/rag.ts:23

Parameters

ParameterType
queryFn(query) => Promise<string>
optionsReadonly<AxGenOptions & object>

Returns

AxRAG

Overrides

AxChainOfThought.constructor

Methods

addAssert()

addAssert(fn, message?, optional?): void

Defined in: src/ax/dsp/generate.ts:115

Parameters

ParameterType
fn(values) => undefined | boolean
message?string
optional?boolean

Returns

void

Inherited from

AxChainOfThought.addAssert


addStreamingAssert()

addStreamingAssert(fieldName, fn, message?, optional?): void

Defined in: src/ax/dsp/generate.ts:123

Parameters

ParameterType
fieldNamestring
fn(content, done?) => undefined | boolean
message?string
optional?boolean

Returns

void

Inherited from

AxChainOfThought.addStreamingAssert


forward()

forward(ai, __namedParameters, options?): Promise<{ answer: string; reason: string; }>

Defined in: src/ax/prompts/rag.ts:44

Parameters

ParameterType
aiReadonly<AxAIService>
__namedParametersReadonly<{ question: string; }>
options?Readonly<AxProgramForwardOptions>

Returns

Promise<{ answer: string; reason: string; }>

Overrides

AxChainOfThought.forward


getSignature()

getSignature(): AxSignature

Defined in: src/ax/dsp/program.ts:117

Returns

AxSignature

Inherited from

AxChainOfThought.getSignature


getTraces()

getTraces(): AxProgramTrace[]

Defined in: src/ax/dsp/program.ts:193

Returns

AxProgramTrace[]

Inherited from

AxChainOfThought.getTraces


getUsage()

getUsage(): AxTokenUsage & object[]

Defined in: src/ax/dsp/program.ts:207

Returns

AxTokenUsage & object[]

Inherited from

AxChainOfThought.getUsage


register()

register(prog): void

Defined in: src/ax/dsp/program.ts:121

Parameters

ParameterType
progReadonly<AxTunable & AxUsable>

Returns

void

Inherited from

AxChainOfThought.register


resetUsage()

resetUsage(): void

Defined in: src/ax/dsp/program.ts:217

Returns

void

Inherited from

AxChainOfThought.resetUsage


setDemos()

setDemos(demos): void

Defined in: src/ax/dsp/program.ts:224

Parameters

ParameterType
demosreadonly AxProgramDemos[]

Returns

void

Inherited from

AxChainOfThought.setDemos


setExamples()

setExamples(examples): void

Defined in: src/ax/dsp/program.ts:152

Parameters

ParameterType
examplesReadonly<AxProgramExamples>

Returns

void

Inherited from

AxChainOfThought.setExamples


setId()

setId(id): void

Defined in: src/ax/dsp/program.ts:139

Parameters

ParameterType
idstring

Returns

void

Inherited from

AxChainOfThought.setId


setParentId()

setParentId(parentId): void

Defined in: src/ax/dsp/program.ts:146

Parameters

ParameterType
parentIdstring

Returns

void

Inherited from

AxChainOfThought.setParentId

> AxRateLimiterTokenUsage

Defined in: src/ax/util/rate-limit.ts:9

Constructors

new AxRateLimiterTokenUsage()

new AxRateLimiterTokenUsage(maxTokens, refillRate, options?): AxRateLimiterTokenUsage

Defined in: src/ax/util/rate-limit.ts:16

Parameters

ParameterType
maxTokensnumber
refillRatenumber
options?Readonly<AxRateLimiterTokenUsageOptions>

Returns

AxRateLimiterTokenUsage

Methods

acquire()

acquire(tokens): Promise<void>

Defined in: src/ax/util/rate-limit.ts:56

Parameters

ParameterType
tokensnumber

Returns

Promise<void>

> AxRoute

Defined in: src/ax/dsp/router.ts:11

Constructors

new AxRoute()

new AxRoute(name, context): AxRoute

Defined in: src/ax/dsp/router.ts:15

Parameters

ParameterType
namestring
contextreadonly string[]

Returns

AxRoute

Methods

getContext()

getContext(): readonly string[]

Defined in: src/ax/dsp/router.ts:24

Returns

readonly string[]


getName()

getName(): string

Defined in: src/ax/dsp/router.ts:20

Returns

string

> AxRouter

Defined in: src/ax/dsp/router.ts:29

Constructors

new AxRouter()

new AxRouter(ai): AxRouter

Defined in: src/ax/dsp/router.ts:35

Parameters

ParameterType
aiAxAIService

Returns

AxRouter

Methods

forward()

forward(text, options?): Promise<string>

Defined in: src/ax/dsp/router.ts:59

Parameters

ParameterType
textstring
options?Readonly<AxRouterForwardOptions>

Returns

Promise<string>


getState()

getState(): undefined | AxDBState

Defined in: src/ax/dsp/router.ts:40

Returns

undefined | AxDBState


setOptions()

setOptions(options): void

Defined in: src/ax/dsp/router.ts:94

Parameters

ParameterType
optionsReadonly<{ debug: boolean; }>

Returns

void


setRoutes()

setRoutes(routes): Promise<void>

Defined in: src/ax/dsp/router.ts:48

Parameters

ParameterType
routesreadonly AxRoute[]

Returns

Promise<void>


setState()

setState(state): void

Defined in: src/ax/dsp/router.ts:44

Parameters

ParameterType
stateAxDBState

Returns

void

> AxTestPrompt

Defined in: src/ax/dsp/evaluate.ts:13

Type Parameters

Type ParameterDefault type
IN extends AxGenInAxGenIn
OUT extends AxGenOutAxGenOut

Constructors

new AxTestPrompt()

new AxTestPrompt<IN, OUT>(__namedParameters): AxTestPrompt<IN, OUT>

Defined in: src/ax/dsp/evaluate.ts:21

Parameters

ParameterType
__namedParametersReadonly<AxEvaluateArgs<IN, OUT>>

Returns

AxTestPrompt<IN, OUT>

Methods

run()

run(metricFn): Promise<void>

Defined in: src/ax/dsp/evaluate.ts:34

Parameters

ParameterType
metricFnAxMetricFn

Returns

Promise<void>

> AxSignature

Defined in: src/ax/dsp/sig.ts:35

Constructors

new AxSignature()

new AxSignature(signature?): AxSignature

Defined in: src/ax/dsp/sig.ts:43

Parameters

ParameterType
signature?Readonly<string | AxSignature>

Returns

AxSignature

Methods

addInputField()

addInputField(field): void

Defined in: src/ax/dsp/sig.ts:115

Parameters

ParameterType
fieldReadonly<AxField>

Returns

void


addOutputField()

addOutputField(field): void

Defined in: src/ax/dsp/sig.ts:120

Parameters

ParameterType
fieldReadonly<AxField>

Returns

void


getDescription()

getDescription(): undefined | string

Defined in: src/ax/dsp/sig.ts:137

Returns

undefined | string


getInputFields()

getInputFields(): readonly AxIField[]

Defined in: src/ax/dsp/sig.ts:135

Returns

readonly AxIField[]


getOutputFields()

getOutputFields(): readonly AxIField[]

Defined in: src/ax/dsp/sig.ts:136

Returns

readonly AxIField[]


hash()

hash(): string

Defined in: src/ax/dsp/sig.ts:207

Returns

string


setDescription()

setDescription(desc): void

Defined in: src/ax/dsp/sig.ts:110

Parameters

ParameterType
descstring

Returns

void


setInputFields()

setInputFields(fields): void

Defined in: src/ax/dsp/sig.ts:125

Parameters

ParameterType
fieldsreadonly AxField[]

Returns

void


setOutputFields()

setOutputFields(fields): void

Defined in: src/ax/dsp/sig.ts:130

Parameters

ParameterType
fieldsreadonly AxField[]

Returns

void


toJSONSchema()

toJSONSchema(): AxFunctionJSONSchema

Defined in: src/ax/dsp/sig.ts:145

Returns

AxFunctionJSONSchema


toString()

toString(): string

Defined in: src/ax/dsp/sig.ts:209

Returns

string

> AxValidationError

Defined in: src/ax/dsp/validate.ts:4

Extends

  • Error

Constructors

new AxValidationError()

new AxValidationError(__namedParameters): AxValidationError

Defined in: src/ax/dsp/validate.ts:8

Parameters

ParameterType
__namedParametersReadonly<{ field: AxField; message: string; value: string; }>

Returns

AxValidationError

Overrides

Error.constructor

Properties

cause?

optional cause: unknown

Defined in: node_modules/typescript/lib/lib.es2022.error.d.ts:26

Inherited from

Error.cause


message

message: string

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1077

Inherited from

Error.message


name

name: string

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1076

Inherited from

Error.name


stack?

optional stack: string

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1078

Inherited from

Error.stack


prepareStackTrace()?

static optional prepareStackTrace: (err, stackTraces) => any

Defined in: node_modules/@types/node/globals.d.ts:143

Optional override for formatting stack traces

Parameters

ParameterType
errError
stackTracesCallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

Error.prepareStackTrace


stackTraceLimit

static stackTraceLimit: number

Defined in: node_modules/@types/node/globals.d.ts:145

Inherited from

Error.stackTraceLimit

Methods

getField()

getField(): AxField

Defined in: src/ax/dsp/validate.ts:24

Returns

AxField


getFixingInstructions()

getFixingInstructions(): object[]

Defined in: src/ax/dsp/validate.ts:27

Returns

object[]


getValue()

getValue(): string

Defined in: src/ax/dsp/validate.ts:25

Returns

string


captureStackTrace()

static captureStackTrace(targetObject, constructorOpt?): void

Defined in: node_modules/@types/node/globals.d.ts:136

Create .stack property on a target object

Parameters

ParameterType
targetObjectobject
constructorOpt?Function

Returns

void

Inherited from

Error.captureStackTrace

> AxAIAnthropicModel

Defined in: src/ax/ai/anthropic/types.ts:3

Enumeration Members

Claude21

Claude21: "claude-2.1"

Defined in: src/ax/ai/anthropic/types.ts:11


Claude35Haiku

Claude35Haiku: "claude-3-5-haiku-latest"

Defined in: src/ax/ai/anthropic/types.ts:5


Claude35Sonnet

Claude35Sonnet: "claude-3-5-sonnet-latest"

Defined in: src/ax/ai/anthropic/types.ts:4


Claude3Haiku

Claude3Haiku: "claude-3-haiku-20240307"

Defined in: src/ax/ai/anthropic/types.ts:9


Claude3Opus

Claude3Opus: "claude-3-opus-latest"

Defined in: src/ax/ai/anthropic/types.ts:7


Claude3Sonnet

Claude3Sonnet: "claude-3-sonnet-20240229"

Defined in: src/ax/ai/anthropic/types.ts:8


ClaudeInstant12

ClaudeInstant12: "claude-instant-1.2"

Defined in: src/ax/ai/anthropic/types.ts:12

> AxAICohereEmbedModel

Defined in: src/ax/ai/cohere/types.ts:16

Cohere: Models for use in embeddings

Enumeration Members

EmbedEnglishLightV30

EmbedEnglishLightV30: "embed-english-light-v3.0"

Defined in: src/ax/ai/cohere/types.ts:18


EmbedEnglishV30

EmbedEnglishV30: "embed-english-v3.0"

Defined in: src/ax/ai/cohere/types.ts:17


EmbedMultiLingualLightV30

EmbedMultiLingualLightV30: "embed-multilingual-light-v3.0"

Defined in: src/ax/ai/cohere/types.ts:20


EmbedMultiLingualV30

EmbedMultiLingualV30: "embed-multilingual-v3.0"

Defined in: src/ax/ai/cohere/types.ts:19

> AxAICohereModel

Defined in: src/ax/ai/cohere/types.ts:6

Cohere: Models for text generation

Enumeration Members

Command

Command: "command"

Defined in: src/ax/ai/cohere/types.ts:9


CommandLight

CommandLight: "command-light"

Defined in: src/ax/ai/cohere/types.ts:10


CommandR

CommandR: "command-r"

Defined in: src/ax/ai/cohere/types.ts:8


CommandRPlus

CommandRPlus: "command-r-plus"

Defined in: src/ax/ai/cohere/types.ts:7

> AxAIDeepSeekModel

Defined in: src/ax/ai/deepseek/types.ts:4

DeepSeek: Models for text generation

Enumeration Members

DeepSeekChat

DeepSeekChat: "deepseek-chat"

Defined in: src/ax/ai/deepseek/types.ts:5


DeepSeekCoder

DeepSeekCoder: "deepseek-coder"

Defined in: src/ax/ai/deepseek/types.ts:6

> AxAIGoogleGeminiEmbedModel

Defined in: src/ax/ai/google-gemini/types.ts:12

Enumeration Members

TextEmbedding004

TextEmbedding004: "text-embedding-004"

Defined in: src/ax/ai/google-gemini/types.ts:13

> AxAIGoogleGeminiModel

Defined in: src/ax/ai/google-gemini/types.ts:3

Enumeration Members

AQA

AQA: "aqa"

Defined in: src/ax/ai/google-gemini/types.ts:9


Gemini15Flash

Gemini15Flash: "gemini-1.5-flash"

Defined in: src/ax/ai/google-gemini/types.ts:5


Gemini15Flash8B

Gemini15Flash8B: "gemini-1.5-flash-8b"

Defined in: src/ax/ai/google-gemini/types.ts:6


Gemini15Pro

Gemini15Pro: "gemini-1.5-pro"

Defined in: src/ax/ai/google-gemini/types.ts:7


Gemini1Pro

Gemini1Pro: "gemini-1.0-pro"

Defined in: src/ax/ai/google-gemini/types.ts:4


Gemma2

Gemma2: "gemma-2-27b-it"

Defined in: src/ax/ai/google-gemini/types.ts:8

> AxAIGoogleGeminiSafetyCategory

Defined in: src/ax/ai/google-gemini/types.ts:16

Enumeration Members

HarmCategoryDangerousContent

HarmCategoryDangerousContent: "HARM_CATEGORY_DANGEROUS_CONTENT"

Defined in: src/ax/ai/google-gemini/types.ts:20


HarmCategoryHarassment

HarmCategoryHarassment: "HARM_CATEGORY_HARASSMENT"

Defined in: src/ax/ai/google-gemini/types.ts:17


HarmCategoryHateSpeech

HarmCategoryHateSpeech: "HARM_CATEGORY_HATE_SPEECH"

Defined in: src/ax/ai/google-gemini/types.ts:18


HarmCategorySexuallyExplicit

HarmCategorySexuallyExplicit: "HARM_CATEGORY_SEXUALLY_EXPLICIT"

Defined in: src/ax/ai/google-gemini/types.ts:19

> AxAIGroqModel

Defined in: src/ax/ai/groq/types.ts:1

Enumeration Members

Gemma_7B

Gemma_7B: "gemma-7b-it"

Defined in: src/ax/ai/groq/types.ts:5


Llama3_70B

Llama3_70B: "llama3-70b-8192"

Defined in: src/ax/ai/groq/types.ts:3


Llama3_8B

Llama3_8B: "llama3-8b-8192"

Defined in: src/ax/ai/groq/types.ts:2


Mixtral_8x7B

Mixtral_8x7B: "mixtral-8x7b-32768"

Defined in: src/ax/ai/groq/types.ts:4

> AxAIGoogleGeminiSafetyThreshold

Defined in: src/ax/ai/google-gemini/types.ts:23

Enumeration Members

BlockDefault

BlockDefault: "HARM_BLOCK_THRESHOLD_UNSPECIFIED"

Defined in: src/ax/ai/google-gemini/types.ts:28


BlockLowAndAbove

BlockLowAndAbove: "BLOCK_LOW_AND_ABOVE"

Defined in: src/ax/ai/google-gemini/types.ts:27


BlockMediumAndAbove

BlockMediumAndAbove: "BLOCK_MEDIUM_AND_ABOVE"

Defined in: src/ax/ai/google-gemini/types.ts:26


BlockNone

BlockNone: "BLOCK_NONE"

Defined in: src/ax/ai/google-gemini/types.ts:24


BlockOnlyHigh

BlockOnlyHigh: "BLOCK_ONLY_HIGH"

Defined in: src/ax/ai/google-gemini/types.ts:25

> AxAIHuggingFaceModel

Defined in: src/ax/ai/huggingface/types.ts:3

Enumeration Members

MetaLlama270BChatHF

MetaLlama270BChatHF: "meta-llama/Llama-2-70b-chat-hf"

Defined in: src/ax/ai/huggingface/types.ts:4

> AxAIMistralEmbedModels

Defined in: src/ax/ai/mistral/types.ts:14

Enumeration Members

MistralEmbed

MistralEmbed: "mistral-embed"

Defined in: src/ax/ai/mistral/types.ts:15

> AxAIMistralModel

Defined in: src/ax/ai/mistral/types.ts:3

Enumeration Members

Codestral

Codestral: "codestral-latest"

Defined in: src/ax/ai/mistral/types.ts:9


Mistral7B

Mistral7B: "open-mistral-7b"

Defined in: src/ax/ai/mistral/types.ts:4


Mistral8x7B

Mistral8x7B: "open-mixtral-8x7b"

Defined in: src/ax/ai/mistral/types.ts:5


MistralLarge

MistralLarge: "mistral-large-latest"

Defined in: src/ax/ai/mistral/types.ts:8


MistralNemo

MistralNemo: "mistral-nemo-latest"

Defined in: src/ax/ai/mistral/types.ts:7


MistralSmall

MistralSmall: "mistral-small-latest"

Defined in: src/ax/ai/mistral/types.ts:6


OpenCodestralMamba

OpenCodestralMamba: "open-codestral-mamba"

Defined in: src/ax/ai/mistral/types.ts:10


OpenMistralNemo

OpenMistralNemo: "open-mistral-nemo-latest"

Defined in: src/ax/ai/mistral/types.ts:11

> AxAIOpenAIEmbedModel

Defined in: src/ax/ai/openai/types.ts:18

Enumeration Members

TextEmbedding3Large

TextEmbedding3Large: "text-embedding-3-large"

Defined in: src/ax/ai/openai/types.ts:21


TextEmbedding3Small

TextEmbedding3Small: "text-embedding-3-small"

Defined in: src/ax/ai/openai/types.ts:20


TextEmbeddingAda002

TextEmbeddingAda002: "text-embedding-ada-002"

Defined in: src/ax/ai/openai/types.ts:19

> AxAIOpenAIModel

Defined in: src/ax/ai/openai/types.ts:3

Enumeration Members

GPT35TextDavinci002

GPT35TextDavinci002: "text-davinci-002"

Defined in: src/ax/ai/openai/types.ts:13


GPT35Turbo

GPT35Turbo: "gpt-3.5-turbo"

Defined in: src/ax/ai/openai/types.ts:11


GPT35TurboInstruct

GPT35TurboInstruct: "gpt-3.5-turbo-instruct"

Defined in: src/ax/ai/openai/types.ts:12


GPT3TextAda001

GPT3TextAda001: "text-ada-001"

Defined in: src/ax/ai/openai/types.ts:15


GPT3TextBabbage002

GPT3TextBabbage002: "text-babbage-002"

Defined in: src/ax/ai/openai/types.ts:14


GPT4

GPT4: "gpt-4"

Defined in: src/ax/ai/openai/types.ts:6


GPT4ChatGPT4O

GPT4ChatGPT4O: "chatgpt-4o-latest"

Defined in: src/ax/ai/openai/types.ts:9


GPT4O

GPT4O: "gpt-4o"

Defined in: src/ax/ai/openai/types.ts:7


GPT4OMini

GPT4OMini: "gpt-4o-mini"

Defined in: src/ax/ai/openai/types.ts:8


GPT4Turbo

GPT4Turbo: "gpt-4-turbo"

Defined in: src/ax/ai/openai/types.ts:10


O1Mini

O1Mini: "o1-mini"

Defined in: src/ax/ai/openai/types.ts:5


O1Preview

O1Preview: "o1-preview"

Defined in: src/ax/ai/openai/types.ts:4

> AxAIRekaModel

Defined in: src/ax/ai/reka/types.ts:3

Enumeration Members

RekaCore

RekaCore: "reka-core"

Defined in: src/ax/ai/reka/types.ts:4


RekaEdge

RekaEdge: "reka-edge"

Defined in: src/ax/ai/reka/types.ts:6


RekaFlash

RekaFlash: "reka-flash"

Defined in: src/ax/ai/reka/types.ts:5

> AxJSInterpreterPermission

Defined in: src/ax/funcs/code.ts:11

Enumeration Members

CRYPTO

CRYPTO: "crypto"

Defined in: src/ax/funcs/code.ts:15


FS

FS: "node:fs"

Defined in: src/ax/funcs/code.ts:12


NET

NET: "net"

Defined in: src/ax/funcs/code.ts:13


OS

OS: "os"

Defined in: src/ax/funcs/code.ts:14


PROCESS

PROCESS: "process"

Defined in: src/ax/funcs/code.ts:16

> AxLLMRequestTypeValues

Defined in: src/ax/trace/trace.ts:46

Enumeration Members

CHAT

CHAT: "chat"

Defined in: src/ax/trace/trace.ts:48


COMPLETION

COMPLETION: "completion"

Defined in: src/ax/trace/trace.ts:47


RERANK

RERANK: "rerank"

Defined in: src/ax/trace/trace.ts:49


UNKNOWN

UNKNOWN: "unknown"

Defined in: src/ax/trace/trace.ts:50

> AxSpanKindValues

Defined in: src/ax/trace/trace.ts:53

Enumeration Members

AGENT

AGENT: "agent"

Defined in: src/ax/trace/trace.ts:56


TASK

TASK: "task"

Defined in: src/ax/trace/trace.ts:55


TOOL

TOOL: "tool"

Defined in: src/ax/trace/trace.ts:57


UNKNOWN

UNKNOWN: "unknown"

Defined in: src/ax/trace/trace.ts:58


WORKFLOW

WORKFLOW: "workflow"

Defined in: src/ax/trace/trace.ts:54

> AxAIAnthropicArgs

Defined in: src/ax/ai/anthropic/api.ts:34

Properties

apiKey

apiKey: string

Defined in: src/ax/ai/anthropic/api.ts:36


config?

optional config: Readonly<Partial<AxAIAnthropicConfig>>

Defined in: src/ax/ai/anthropic/api.ts:37


modelMap?

optional modelMap: Record<string, string>

Defined in: src/ax/ai/anthropic/api.ts:39


name

name: "anthropic"

Defined in: src/ax/ai/anthropic/api.ts:35


options?

optional options: Readonly<AxAIServiceOptions>

Defined in: src/ax/ai/anthropic/api.ts:38

> AxAIAnthropicContentBlockDeltaEvent

Defined in: src/ax/ai/anthropic/types.ts:166

Properties

delta

delta: { text: string; type: "text_delta"; } | { partial_json: string; type: "input_json_delta"; }

Defined in: src/ax/ai/anthropic/types.ts:169


index

index: number

Defined in: src/ax/ai/anthropic/types.ts:167


type

type: "content_block_delta"

Defined in: src/ax/ai/anthropic/types.ts:168

> AxAIAnthropicContentBlockStartEvent

Defined in: src/ax/ai/anthropic/types.ts:149

Properties

content_block

content_block: { text: string; type: "text"; } | { id: string; input: object; name: string; type: "tool_use"; }

Defined in: src/ax/ai/anthropic/types.ts:152


index

index: number

Defined in: src/ax/ai/anthropic/types.ts:150


type

type: "content_block_start"

Defined in: src/ax/ai/anthropic/types.ts:151

> AxAIAnthropicContentBlockStopEvent

Defined in: src/ax/ai/anthropic/types.ts:181

Properties

index

index: number

Defined in: src/ax/ai/anthropic/types.ts:183


type

type: "content_block_stop"

Defined in: src/ax/ai/anthropic/types.ts:182

> AxAIAnthropicErrorEvent

Defined in: src/ax/ai/anthropic/types.ts:209

Properties

error

error: object

Defined in: src/ax/ai/anthropic/types.ts:211

message

message: string

type

type: "overloaded_error"


type

type: "error"

Defined in: src/ax/ai/anthropic/types.ts:210

> AxAIAnthropicMessageDeltaEvent

Defined in: src/ax/ai/anthropic/types.ts:187

Properties

delta

delta: object

Defined in: src/ax/ai/anthropic/types.ts:189

stop_reason

stop_reason: null | "end_turn" | "max_tokens" | "stop_sequence"

stop_sequence

stop_sequence: null | string


type

type: "message_delta"

Defined in: src/ax/ai/anthropic/types.ts:188


usage

usage: object

Defined in: src/ax/ai/anthropic/types.ts:193

output_tokens

output_tokens: number

> AxAIAnthropicMessageStartEvent

Defined in: src/ax/ai/anthropic/types.ts:131

Properties

message

message: object

Defined in: src/ax/ai/anthropic/types.ts:133

content

content: []

id

id: string

model

model: string

role

role: "assistant"

stop_reason

stop_reason: null | string

stop_sequence

stop_sequence: null | string

type

type: "message"

usage

{ input_tokens: number; output_tokens: number; }


type

type: "message_start"

Defined in: src/ax/ai/anthropic/types.ts:132

> AxAIAnthropicMessageStopEvent

Defined in: src/ax/ai/anthropic/types.ts:199

Properties

type

type: "message_stop"

Defined in: src/ax/ai/anthropic/types.ts:200

> AxAIAnthropicPingEvent

Defined in: src/ax/ai/anthropic/types.ts:204

Properties

type

type: "ping"

Defined in: src/ax/ai/anthropic/types.ts:205

> AxAIAzureOpenAIArgs

Defined in: src/ax/ai/azure-openai/api.ts:23

Properties

apiKey

apiKey: string

Defined in: src/ax/ai/azure-openai/api.ts:25


config?

optional config: Readonly<Partial<AxAIOpenAIConfig>>

Defined in: src/ax/ai/azure-openai/api.ts:29


deploymentName

deploymentName: string

Defined in: src/ax/ai/azure-openai/api.ts:27


modelMap?

optional modelMap: Record<string, AxAIOpenAIModel | AxAIOpenAIEmbedModel>

Defined in: src/ax/ai/azure-openai/api.ts:31


name

name: "azure-openai"

Defined in: src/ax/ai/azure-openai/api.ts:24


options?

optional options: Readonly<AxAIServiceOptions>

Defined in: src/ax/ai/azure-openai/api.ts:30


resourceName

resourceName: string

Defined in: src/ax/ai/azure-openai/api.ts:26


version?

optional version: string

Defined in: src/ax/ai/azure-openai/api.ts:28

> AxAICohereArgs

Defined in: src/ax/ai/cohere/api.ts:45

Properties

apiKey

apiKey: string

Defined in: src/ax/ai/cohere/api.ts:47


config?

optional config: Readonly<Partial<AxAICohereConfig>>

Defined in: src/ax/ai/cohere/api.ts:48


modelMap?

optional modelMap: Record<string, string>

Defined in: src/ax/ai/cohere/api.ts:50


name

name: "cohere"

Defined in: src/ax/ai/cohere/api.ts:46


options?

optional options: Readonly<AxAIServiceOptions>

Defined in: src/ax/ai/cohere/api.ts:49

> AxAIDeepSeekArgs

Defined in: src/ax/ai/deepseek/api.ts:26

Properties

apiKey

apiKey: string

Defined in: src/ax/ai/deepseek/api.ts:28


config?

optional config: Readonly<Partial<AxAIOpenAIConfig>>

Defined in: src/ax/ai/deepseek/api.ts:29


modelMap?

optional modelMap: Record<string, string>

Defined in: src/ax/ai/deepseek/api.ts:31


name

name: "deepseek"

Defined in: src/ax/ai/deepseek/api.ts:27


options?

optional options: Readonly<AxAIServiceOptions>

Defined in: src/ax/ai/deepseek/api.ts:30

> AxAIGoogleGeminiArgs

Defined in: src/ax/ai/google-gemini/api.ts:81

Properties

apiKey

apiKey: string

Defined in: src/ax/ai/google-gemini/api.ts:83


config?

optional config: Readonly<Partial<AxAIGoogleGeminiConfig>>

Defined in: src/ax/ai/google-gemini/api.ts:86


modelMap?

optional modelMap: Record<string, string>

Defined in: src/ax/ai/google-gemini/api.ts:88


name

name: "google-gemini"

Defined in: src/ax/ai/google-gemini/api.ts:82


options?

optional options: Readonly<AxAIServiceOptions & AxAIGoogleGeminiOptionsTools>

Defined in: src/ax/ai/google-gemini/api.ts:87


projectId?

optional projectId: string

Defined in: src/ax/ai/google-gemini/api.ts:84


region?

optional region: string

Defined in: src/ax/ai/google-gemini/api.ts:85

> AxAIGoogleGeminiOptionsTools

Defined in: src/ax/ai/google-gemini/api.ts:73

Properties

codeExecution?

optional codeExecution: boolean

Defined in: src/ax/ai/google-gemini/api.ts:74


googleSearchRetrieval?

optional googleSearchRetrieval: object

Defined in: src/ax/ai/google-gemini/api.ts:75

dynamicThreshold?

optional dynamicThreshold: number

mode?

optional mode: "MODE_DYNAMIC"

> AxAIGroqArgs

Defined in: src/ax/ai/groq/api.ts:18

Properties

apiKey

apiKey: string

Defined in: src/ax/ai/groq/api.ts:20


config?

optional config: Readonly<Partial<AxAIOpenAIConfig>>

Defined in: src/ax/ai/groq/api.ts:21


modelMap?

optional modelMap: Record<string, AxAIGroqModel>

Defined in: src/ax/ai/groq/api.ts:23


name

name: "groq"

Defined in: src/ax/ai/groq/api.ts:19


options?

optional options: Readonly<AxAIServiceOptions> & object

Defined in: src/ax/ai/groq/api.ts:22

Type declaration

tokensPerMinute?

optional tokensPerMinute: number

> AxAIHuggingFaceArgs

Defined in: src/ax/ai/huggingface/api.ts:36

Properties

apiKey

apiKey: string

Defined in: src/ax/ai/huggingface/api.ts:38


config?

optional config: Readonly<Partial<AxAIHuggingFaceConfig>>

Defined in: src/ax/ai/huggingface/api.ts:39


modelMap?

optional modelMap: Record<string, MetaLlama270BChatHF>

Defined in: src/ax/ai/huggingface/api.ts:41


name

name: "huggingface"

Defined in: src/ax/ai/huggingface/api.ts:37


options?

optional options: Readonly<AxAIServiceOptions>

Defined in: src/ax/ai/huggingface/api.ts:40

> AxAIMemory

Defined in: src/ax/mem/types.ts:3

Methods

add()

add(result, sessionId?): void

Defined in: src/ax/mem/types.ts:4

Parameters

ParameterType
resultReadonly<Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }> | Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: … | … | …; text: string; type: "text"; } | { cache: … | … | …; details: … | … | … | …; image: string; mimeType: string; type: "image"; } | { cache: … | … | …; data: string; format: … | …; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>[]>
sessionId?string

Returns

void


addResult()

addResult(result, sessionId?): void

Defined in: src/ax/mem/types.ts:10

Parameters

ParameterType
resultReadonly<AxChatResponseResult>
sessionId?string

Returns

void


getLast()

getLast(sessionId?): undefined | Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>

Defined in: src/ax/mem/types.ts:16

Parameters

ParameterType
sessionId?string

Returns

undefined | Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>


history()

history(sessionId?): Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>[]

Defined in: src/ax/mem/types.ts:13

Parameters

ParameterType
sessionId?string

Returns

Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>[]


reset()

reset(sessionId?): void

Defined in: src/ax/mem/types.ts:14

Parameters

ParameterType
sessionId?string

Returns

void


updateResult()

updateResult(result, sessionId?): void

Defined in: src/ax/mem/types.ts:11

Parameters

ParameterType
resultReadonly<AxChatResponseResult>
sessionId?string

Returns

void

> AxAIMistralArgs

Defined in: src/ax/ai/mistral/api.ts:23

Properties

apiKey

apiKey: string

Defined in: src/ax/ai/mistral/api.ts:25


config?

optional config: Readonly<Partial<AxAIOpenAIConfig>>

Defined in: src/ax/ai/mistral/api.ts:26


modelMap?

optional modelMap: Record<string, string>

Defined in: src/ax/ai/mistral/api.ts:28


name

name: "mistral"

Defined in: src/ax/ai/mistral/api.ts:24


options?

optional options: Readonly<AxAIServiceOptions>

Defined in: src/ax/ai/mistral/api.ts:27

> AxAIOpenAIArgs

Defined in: src/ax/ai/openai/api.ts:57

Properties

apiKey

apiKey: string

Defined in: src/ax/ai/openai/api.ts:59


apiURL?

optional apiURL: string

Defined in: src/ax/ai/openai/api.ts:60


config?

optional config: Readonly<Partial<AxAIOpenAIConfig>>

Defined in: src/ax/ai/openai/api.ts:61


modelInfo?

optional modelInfo: readonly AxModelInfo[]

Defined in: src/ax/ai/openai/api.ts:63


modelMap?

optional modelMap: Record<string, string>

Defined in: src/ax/ai/openai/api.ts:64


name

name: "openai"

Defined in: src/ax/ai/openai/api.ts:58


options?

optional options: Readonly<AxAIServiceOptions & object>

Defined in: src/ax/ai/openai/api.ts:62

> AxAIOpenAIResponseDelta

Defined in: src/ax/ai/openai/types.ts:51

Type Parameters

Type Parameter
T

Properties

choices

choices: object[]

Defined in: src/ax/ai/openai/types.ts:56

delta

delta: T

finish_reason

finish_reason: "stop" | "length" | "content_filter" | "tool_calls"

index

index: number


created

created: number

Defined in: src/ax/ai/openai/types.ts:54


id

id: string

Defined in: src/ax/ai/openai/types.ts:52


model

model: string

Defined in: src/ax/ai/openai/types.ts:55


object

object: string

Defined in: src/ax/ai/openai/types.ts:53


system_fingerprint

system_fingerprint: string

Defined in: src/ax/ai/openai/types.ts:62


usage?

optional usage: AxAIOpenAIUsage

Defined in: src/ax/ai/openai/types.ts:61

> AxAIRekaArgs

Defined in: src/ax/ai/reka/api.ts:51

Properties

apiKey

apiKey: string

Defined in: src/ax/ai/reka/api.ts:53


apiURL?

optional apiURL: string

Defined in: src/ax/ai/reka/api.ts:54


config?

optional config: Readonly<Partial<AxAIRekaConfig>>

Defined in: src/ax/ai/reka/api.ts:55


modelInfo?

optional modelInfo: readonly AxModelInfo[]

Defined in: src/ax/ai/reka/api.ts:57


modelMap?

optional modelMap: Record<string, string>

Defined in: src/ax/ai/reka/api.ts:58


name

name: "reka"

Defined in: src/ax/ai/reka/api.ts:52


options?

optional options: Readonly<AxAIServiceOptions & object>

Defined in: src/ax/ai/reka/api.ts:56

> AxAIService

Defined in: src/ax/ai/types.ts:224

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/types.ts:232

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/types.ts:236

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>


getEmbedModelInfo()

getEmbedModelInfo(): undefined | Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/types.ts:227

Returns

undefined | Readonly<AxModelInfoWithProvider>


getFeatures()

getFeatures(model?): object

Defined in: src/ax/ai/types.ts:228

Parameters

ParameterType
model?string

Returns

object

functions

functions: boolean

streaming

streaming: boolean


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/types.ts:230

Returns

AxAIServiceMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/types.ts:226

Returns

Readonly<AxModelInfoWithProvider>


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/types.ts:229

Returns

undefined | AxAIModelMap


getName()

getName(): string

Defined in: src/ax/ai/types.ts:225

Returns

string


setOptions()

setOptions(options): void

Defined in: src/ax/ai/types.ts:241

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

> AxAIServiceImpl

Defined in: src/ax/ai/types.ts:244

Type Parameters

Type Parameter
TChatRequest
TEmbedRequest
TChatResponse
TChatResponseDelta
TEmbedResponse

Methods

createChatReq()

createChatReq(req, config): [AxAPI, TChatRequest]

Defined in: src/ax/ai/types.ts:251

Parameters

ParameterType
reqReadonly<AxInternalChatRequest>
configReadonly<AxAIPromptConfig>

Returns

[AxAPI, TChatRequest]


createChatResp()

createChatResp(resp): AxChatResponse

Defined in: src/ax/ai/types.ts:256

Parameters

ParameterType
respReadonly<TChatResponse>

Returns

AxChatResponse


createChatStreamResp()?

optional createChatStreamResp(resp, state): AxChatResponse

Defined in: src/ax/ai/types.ts:258

Parameters

ParameterType
respReadonly<TChatResponseDelta>
stateobject

Returns

AxChatResponse


createEmbedReq()?

optional createEmbedReq(req): [AxAPI, TEmbedRequest]

Defined in: src/ax/ai/types.ts:263

Parameters

ParameterType
reqReadonly<AxInternalEmbedRequest>

Returns

[AxAPI, TEmbedRequest]


createEmbedResp()?

optional createEmbedResp(resp): AxEmbedResponse

Defined in: src/ax/ai/types.ts:265

Parameters

ParameterType
respReadonly<TEmbedResponse>

Returns

AxEmbedResponse


getModelConfig()

getModelConfig(): AxModelConfig

Defined in: src/ax/ai/types.ts:267

Returns

AxModelConfig

> AxAITogetherArgs

Defined in: src/ax/ai/together/api.ts:17

Properties

apiKey

apiKey: string

Defined in: src/ax/ai/together/api.ts:19


config?

optional config: Readonly<Partial<AxAIOpenAIConfig>>

Defined in: src/ax/ai/together/api.ts:20


modelMap?

optional modelMap: Record<string, string>

Defined in: src/ax/ai/together/api.ts:22


name

name: "together"

Defined in: src/ax/ai/together/api.ts:18


options?

optional options: Readonly<AxAIServiceOptions>

Defined in: src/ax/ai/together/api.ts:21

> AxAIServiceMetrics

Defined in: src/ax/ai/types.ts:161

Properties

errors

errors: object

Defined in: src/ax/ai/types.ts:176

chat

{ count: number; rate: number; total: number; }

embed

{ count: number; rate: number; total: number; }


latency

latency: object

Defined in: src/ax/ai/types.ts:162

chat

{ mean: number; p95: number; p99: number; samples: number[]; }

embed

{ mean: number; p95: number; p99: number; samples: number[]; }

> AxAgentic

Defined in: src/ax/prompts/agent.ts:17

Extends

Properties

getTraces()

getTraces: () => AxProgramTrace[]

Defined in: src/ax/dsp/program.ts:71

Returns

AxProgramTrace[]

Inherited from

AxTunable.getTraces


getUsage()

getUsage: () => AxTokenUsage & object[]

Defined in: src/ax/dsp/program.ts:76

Returns

AxTokenUsage & object[]

Inherited from

AxUsable.getUsage


resetUsage()

resetUsage: () => void

Defined in: src/ax/dsp/program.ts:77

Returns

void

Inherited from

AxUsable.resetUsage


setDemos()

setDemos: (demos) => void

Defined in: src/ax/dsp/program.ts:72

Parameters

ParameterType
demosreadonly AxProgramDemos[]

Returns

void

Inherited from

AxTunable.setDemos


setExamples()

setExamples: (examples) => void

Defined in: src/ax/dsp/program.ts:68

Parameters

ParameterType
examplesReadonly<AxProgramExamples>

Returns

void

Inherited from

AxTunable.setExamples


setId()

setId: (id) => void

Defined in: src/ax/dsp/program.ts:69

Parameters

ParameterType
idstring

Returns

void

Inherited from

AxTunable.setId


setParentId()

setParentId: (parentId) => void

Defined in: src/ax/dsp/program.ts:70

Parameters

ParameterType
parentIdstring

Returns

void

Inherited from

AxTunable.setParentId

Methods

getFunction()

getFunction(): AxFunction

Defined in: src/ax/prompts/agent.ts:18

Returns

AxFunction

> AxApacheTikaArgs

Defined in: src/ax/docs/tika.ts:3

Properties

fetch()?

optional fetch: (input, init?) => Promise<Response>

Defined in: src/ax/docs/tika.ts:5

Parameters

ParameterType
inputstring | URL | Request
init?RequestInit

Returns

Promise<Response>


url?

optional url: string | URL

Defined in: src/ax/docs/tika.ts:4

> AxApacheTikaConvertOptions

Defined in: src/ax/docs/tika.ts:8

Properties

format?

optional format: "text" | "html"

Defined in: src/ax/docs/tika.ts:9

> AxAssertion

Defined in: src/ax/dsp/asserts.ts:4

Properties

message?

optional message: string

Defined in: src/ax/dsp/asserts.ts:6


optional?

optional optional: boolean

Defined in: src/ax/dsp/asserts.ts:7

Methods

fn()

fn(values): undefined | boolean

Defined in: src/ax/dsp/asserts.ts:5

Parameters

ParameterType
valuesRecord<string, unknown>

Returns

undefined | boolean

> AxBaseAIArgs

Defined in: src/ax/ai/base.ts:36

Properties

apiURL

apiURL: string

Defined in: src/ax/ai/base.ts:38


headers

headers: Record<string, string>

Defined in: src/ax/ai/base.ts:39


modelInfo

modelInfo: readonly AxModelInfo[]

Defined in: src/ax/ai/base.ts:40


modelMap?

optional modelMap: AxAIModelMap

Defined in: src/ax/ai/base.ts:44


models

models: Readonly<{ embedModel: string; model: string; }>

Defined in: src/ax/ai/base.ts:41


name

name: string

Defined in: src/ax/ai/base.ts:37


options?

optional options: Readonly<AxAIServiceOptions>

Defined in: src/ax/ai/base.ts:42


supportFor

supportFor: AxBaseAIFeatures | (model) => AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:43

> AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:31

Properties

functions

functions: boolean

Defined in: src/ax/ai/base.ts:32


streaming

streaming: boolean

Defined in: src/ax/ai/base.ts:33

> AxDBBaseArgs

Defined in: src/ax/db/base.ts:13

Extended by

Properties

fetch()?

optional fetch: (input, init?) => Promise<Response>

Defined in: src/ax/db/base.ts:14

Parameters

ParameterType
inputstring | URL | Request
init?RequestInit

Returns

Promise<Response>


tracer?

optional tracer: Tracer

Defined in: src/ax/db/base.ts:15

> AxDBBaseOpOptions

Defined in: src/ax/db/base.ts:18

Properties

span?

optional span: Span

Defined in: src/ax/db/base.ts:19

> AxDBLoaderOptions

Defined in: src/ax/docs/manager.ts:14

Properties

chunker()?

optional chunker: (text) => string[]

Defined in: src/ax/docs/manager.ts:15

Parameters

ParameterType
textstring

Returns

string[]


reranker?

optional reranker: AxProgram<AxRerankerIn, AxRerankerOut>

Defined in: src/ax/docs/manager.ts:17


rewriter?

optional rewriter: AxProgram<AxRewriteIn, AxRewriteOut>

Defined in: src/ax/docs/manager.ts:16

> AxDBManagerArgs

Defined in: src/ax/docs/manager.ts:20

Properties

ai

ai: AxAIService

Defined in: src/ax/docs/manager.ts:21


config?

optional config: AxDBLoaderOptions

Defined in: src/ax/docs/manager.ts:23


db

db: AxDBService

Defined in: src/ax/docs/manager.ts:22

> AxDBCloudflareArgs

Defined in: src/ax/db/cloudflare.ts:34

Extends

Properties

accountId

accountId: string

Defined in: src/ax/db/cloudflare.ts:37


apiKey

apiKey: string

Defined in: src/ax/db/cloudflare.ts:36


fetch()?

optional fetch: (input, init?) => Promise<Response>

Defined in: src/ax/db/cloudflare.ts:38

Parameters

ParameterType
inputstring | URL | Request
init?RequestInit

Returns

Promise<Response>

Overrides

AxDBBaseArgs.fetch


name

name: "cloudflare"

Defined in: src/ax/db/cloudflare.ts:35


tracer?

optional tracer: Tracer

Defined in: src/ax/db/base.ts:15

Inherited from

AxDBBaseArgs.tracer

> AxDBMatch

Defined in: src/ax/docs/manager.ts:26

Properties

score

score: number

Defined in: src/ax/docs/manager.ts:27


text

text: string

Defined in: src/ax/docs/manager.ts:28

> AxDBMemoryArgs

Defined in: src/ax/db/memory.ts:11

Extends

Properties

fetch()?

optional fetch: (input, init?) => Promise<Response>

Defined in: src/ax/db/base.ts:14

Parameters

ParameterType
inputstring | URL | Request
init?RequestInit

Returns

Promise<Response>

Inherited from

AxDBBaseArgs.fetch


name

name: "memory"

Defined in: src/ax/db/memory.ts:12


tracer?

optional tracer: Tracer

Defined in: src/ax/db/base.ts:15

Inherited from

AxDBBaseArgs.tracer

> AxDBPineconeArgs

Defined in: src/ax/db/pinecone.ts:48

Extends

Properties

apiKey

apiKey: string

Defined in: src/ax/db/pinecone.ts:50


fetch()?

optional fetch: (input, init?) => Promise<Response>

Defined in: src/ax/db/pinecone.ts:52

Parameters

ParameterType
inputstring | URL | Request
init?RequestInit

Returns

Promise<Response>

Overrides

AxDBBaseArgs.fetch


host

host: string

Defined in: src/ax/db/pinecone.ts:51


name

name: "pinecone"

Defined in: src/ax/db/pinecone.ts:49


tracer?

optional tracer: Tracer

Defined in: src/ax/db/base.ts:15

Inherited from

AxDBBaseArgs.tracer

> AxDBQueryService

Defined in: src/ax/db/types.ts:48

Extended by

Methods

query()

query(req): Promise<AxDBQueryResponse>

Defined in: src/ax/db/types.ts:49

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>

Returns

Promise<AxDBQueryResponse>

> AxDBService

Defined in: src/ax/db/types.ts:36

Extends

Methods

batchUpsert()

batchUpsert(batchReq, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/types.ts:42

Parameters

ParameterType
batchReqreadonly AxDBUpsertRequest[]
update?boolean

Returns

Promise<AxDBUpsertResponse>


query()

query(req): Promise<AxDBQueryResponse>

Defined in: src/ax/db/types.ts:49

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>

Returns

Promise<AxDBQueryResponse>

Inherited from

AxDBQueryService.query


upsert()

upsert(req, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/types.ts:37

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
update?boolean

Returns

Promise<AxDBUpsertResponse>

> AxDBWeaviateArgs

Defined in: src/ax/db/weaviate.ts:29

Extends

Properties

apiKey

apiKey: string

Defined in: src/ax/db/weaviate.ts:31


fetch()?

optional fetch: (input, init?) => Promise<Response>

Defined in: src/ax/db/weaviate.ts:33

Parameters

ParameterType
inputstring | URL | Request
init?RequestInit

Returns

Promise<Response>

Overrides

AxDBBaseArgs.fetch


host

host: string

Defined in: src/ax/db/weaviate.ts:32


name

name: "weaviate"

Defined in: src/ax/db/weaviate.ts:30


tracer?

optional tracer: Tracer

Defined in: src/ax/db/base.ts:15

Inherited from

AxDBBaseArgs.tracer

> AxDockerContainer

Defined in: src/ax/funcs/docker.ts:3

Properties

Command

Command: string

Defined in: src/ax/funcs/docker.ts:8


Created

Created: number

Defined in: src/ax/funcs/docker.ts:9


HostConfig

HostConfig: object

Defined in: src/ax/funcs/docker.ts:33

NetworkMode

NetworkMode: string


Id

Id: string

Defined in: src/ax/funcs/docker.ts:4


Image

Image: string

Defined in: src/ax/funcs/docker.ts:6


ImageID

ImageID: string

Defined in: src/ax/funcs/docker.ts:7


Labels

Labels: object

Defined in: src/ax/funcs/docker.ts:30

Index Signature

[key: string]: string


Mounts

Mounts: object[]

Defined in: src/ax/funcs/docker.ts:46

Destination

Destination: string

Mode

Mode: string

Propagation

Propagation: string

RW

RW: boolean

Source

Source: string

Type

Type: string


Names

Names: string[]

Defined in: src/ax/funcs/docker.ts:5


NetworkSettings

NetworkSettings: object

Defined in: src/ax/funcs/docker.ts:36

Networks

{}


Ports

Ports: object[]

Defined in: src/ax/funcs/docker.ts:24

IP

IP: string

PrivatePort

PrivatePort: number

PublicPort

PublicPort: number

Type

Type: string


SizeRootFs

SizeRootFs: number

Defined in: src/ax/funcs/docker.ts:32


SizeRw

SizeRw: number

Defined in: src/ax/funcs/docker.ts:31


State

State: object

Defined in: src/ax/funcs/docker.ts:10

Dead

Dead: boolean

Error

Error: string

ExitCode

ExitCode: number

FinishedAt

FinishedAt: Date

OOMKilled

OOMKilled: boolean

Paused

Paused: boolean

Pid

Pid: number

Restarting

Restarting: boolean

Running

Running: boolean

StartedAt

StartedAt: Date

Status

Status: string


Status

Status: string

Defined in: src/ax/funcs/docker.ts:23

> AxField

Defined in: src/ax/dsp/sig.ts:12

Properties

description?

optional description: string

Defined in: src/ax/dsp/sig.ts:15


isOptional?

optional isOptional: boolean

Defined in: src/ax/dsp/sig.ts:30


name

name: string

Defined in: src/ax/dsp/sig.ts:13


title?

optional title: string

Defined in: src/ax/dsp/sig.ts:14


type?

optional type: object

Defined in: src/ax/dsp/sig.ts:16

classes?

optional classes: string[]

isArray

isArray: boolean

name

name: "string" | "number" | "boolean" | "image" | "audio" | "json" | "datetime" | "date" | "class"

> AxGenOptions

Defined in: src/ax/dsp/generate.ts:48

Properties

asserts?

optional asserts: AxAssertion[]

Defined in: src/ax/dsp/generate.ts:63


debug?

optional debug: boolean

Defined in: src/ax/dsp/generate.ts:56


description?

optional description: string

Defined in: src/ax/dsp/generate.ts:57


functionCall?

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

Defined in: src/ax/dsp/generate.ts:60


functions?

optional functions: AxInputFunctionType

Defined in: src/ax/dsp/generate.ts:59


maxCompletions?

optional maxCompletions: number

Defined in: src/ax/dsp/generate.ts:49


maxRetries?

optional maxRetries: number

Defined in: src/ax/dsp/generate.ts:50


maxSteps?

optional maxSteps: number

Defined in: src/ax/dsp/generate.ts:51


mem?

optional mem: AxAIMemory

Defined in: src/ax/dsp/generate.ts:52


promptTemplate?

optional promptTemplate: typeof AxPromptTemplate

Defined in: src/ax/dsp/generate.ts:62


rateLimiter?

optional rateLimiter: AxRateLimiterFunction

Defined in: src/ax/dsp/generate.ts:54


stopFunction?

optional stopFunction: string

Defined in: src/ax/dsp/generate.ts:61


stream?

optional stream: boolean

Defined in: src/ax/dsp/generate.ts:55


streamingAsserts?

optional streamingAsserts: AxStreamingAssertion[]

Defined in: src/ax/dsp/generate.ts:64


tracer?

optional tracer: Tracer

Defined in: src/ax/dsp/generate.ts:53

> AxProgramWithSignatureOptions

Defined in: src/ax/dsp/program.ts:85

Properties

description?

optional description: string

Defined in: src/ax/dsp/program.ts:86

> AxResponseHandlerArgs

Defined in: src/ax/dsp/generate.ts:71

Type Parameters

Type Parameter
T

Properties

ai

ai: Readonly<AxAIService>

Defined in: src/ax/dsp/generate.ts:72


functions?

optional functions: readonly AxFunction[]

Defined in: src/ax/dsp/generate.ts:79


mem

mem: AxAIMemory

Defined in: src/ax/dsp/generate.ts:76


model?

optional model: string

Defined in: src/ax/dsp/generate.ts:73


res

res: T

Defined in: src/ax/dsp/generate.ts:74


sessionId?

optional sessionId: string

Defined in: src/ax/dsp/generate.ts:77


traceId?

optional traceId: string

Defined in: src/ax/dsp/generate.ts:78


usageInfo

usageInfo: object

Defined in: src/ax/dsp/generate.ts:75

ai

ai: string

model

model: string

> AxRateLimiterTokenUsageOptions

Defined in: src/ax/util/rate-limit.ts:5

Properties

debug?

optional debug: boolean

Defined in: src/ax/util/rate-limit.ts:6

> AxStreamingAssertion

Defined in: src/ax/dsp/asserts.ts:10

Properties

fieldName

fieldName: string

Defined in: src/ax/dsp/asserts.ts:11


message?

optional message: string

Defined in: src/ax/dsp/asserts.ts:13


optional?

optional optional: boolean

Defined in: src/ax/dsp/asserts.ts:14

Methods

fn()

fn(content, done?): undefined | boolean

Defined in: src/ax/dsp/asserts.ts:12

Parameters

ParameterType
contentstring
done?boolean

Returns

undefined | boolean

> AxRouterForwardOptions

Defined in: src/ax/dsp/router.ts:7

Properties

cutoff?

optional cutoff: number

Defined in: src/ax/dsp/router.ts:8

> AxTunable

Defined in: src/ax/dsp/program.ts:67

Extended by

Properties

getTraces()

getTraces: () => AxProgramTrace[]

Defined in: src/ax/dsp/program.ts:71

Returns

AxProgramTrace[]


setDemos()

setDemos: (demos) => void

Defined in: src/ax/dsp/program.ts:72

Parameters

ParameterType
demosreadonly AxProgramDemos[]

Returns

void


setExamples()

setExamples: (examples) => void

Defined in: src/ax/dsp/program.ts:68

Parameters

ParameterType
examplesReadonly<AxProgramExamples>

Returns

void


setId()

setId: (id) => void

Defined in: src/ax/dsp/program.ts:69

Parameters

ParameterType
idstring

Returns

void


setParentId()

setParentId: (parentId) => void

Defined in: src/ax/dsp/program.ts:70

Parameters

ParameterType
parentIdstring

Returns

void

> AxUsable

Defined in: src/ax/dsp/program.ts:75

Extended by

Properties

getUsage()

getUsage: () => AxTokenUsage & object[]

Defined in: src/ax/dsp/program.ts:76

Returns

AxTokenUsage & object[]


resetUsage()

resetUsage: () => void

Defined in: src/ax/dsp/program.ts:77

Returns

void

> @ax-llm/ax

Enumerations

Classes

Interfaces

Type Aliases

> AxAIAnthropicChatError

AxAIAnthropicChatError: object

Defined in: src/ax/ai/anthropic/types.ts:122

Type declaration

error

{ message: string; type: "authentication_error"; }

type

type: "error"

> AxAIAnthropicChatRequest

AxAIAnthropicChatRequest: object

Defined in: src/ax/ai/anthropic/types.ts:24

Type declaration

max_tokens?

optional max_tokens: number

messages

messages: ({ content: string | (… & … | … & … | { content: … | …; is_error: boolean; tool_use_id: string; type: "tool_result"; })[]; role: "user"; } | { content: string | ({ text: string; type: "text"; } | { id: string; input: object; name: string; type: "tool_use"; })[]; role: "assistant"; })[]

metadata?

{ user_id: string; }

model

model: string

stop_sequences?

optional stop_sequences: string[]

stream?

optional stream: boolean

system?

optional system: string | object & AxAIAnthropicChatRequestCacheParam[]

temperature?

optional temperature: number

tool_choice?

optional tool_choice: { type: "auto" | "any"; } | { name: string; type: "tool"; }

tools?

optional tools: object & AxAIAnthropicChatRequestCacheParam[]

top_k?

optional top_k: number

top_p?

optional top_p: number

> AxAIAnthropicChatRequestCacheParam

AxAIAnthropicChatRequestCacheParam: object

Defined in: src/ax/ai/anthropic/types.ts:19

Type declaration

cache_control?

{ type: "ephemeral"; }

> AxAIAnthropicChatResponse

AxAIAnthropicChatResponse: object

Defined in: src/ax/ai/anthropic/types.ts:97

Type declaration

content

content: ({ text: string; type: "text"; } | { id: string; input: string; name: string; type: "tool_use"; })[]

id

id: string

model

model: string

role

role: "assistant"

stop_reason

stop_reason: "end_turn" | "max_tokens" | "stop_sequence" | "tool_use"

stop_sequence?

optional stop_sequence: string

type

type: "message"

usage

{ input_tokens: number; output_tokens: number; }

> AxAIAnthropicChatResponseDelta

> AxAIAnthropicConfig

AxAIAnthropicConfig: AxModelConfig & object

Defined in: src/ax/ai/anthropic/types.ts:15

Type declaration

model

model: AxAIAnthropicModel

> AxAIArgs

> AxAICohereChatRequest

AxAICohereChatRequest: object

Defined in: src/ax/ai/cohere/types.ts:41

Type declaration

chat_history

chat_history: ({ message: string; role: "CHATBOT"; tool_calls: AxAICohereChatResponseToolCalls; } | { message: string; role: "SYSTEM"; } | { message: string; role: "USER"; } | { message: string; role: "TOOL"; tool_results: AxAICohereChatRequestToolResults; })[]

end_sequences?

optional end_sequences: readonly string[]

frequency_penalty?

optional frequency_penalty: number

k?

optional k: number

max_tokens?

optional max_tokens: number

message?

optional message: string

model

model: AxAICohereModel | string

p?

optional p: number

preamble?

optional preamble: string

presence_penalty?

optional presence_penalty: number

stop_sequences?

optional stop_sequences: string[]

temperature?

optional temperature: number

tool_results?

optional tool_results: AxAICohereChatRequestToolResults

tools?

optional tools: object[]

> AxAICohereChatRequestToolResults

AxAICohereChatRequestToolResults: object[]

Defined in: src/ax/ai/cohere/types.ts:36

Type declaration

call

call: AxAICohereChatResponseToolCalls[0]

outputs

outputs: object[]

> AxAICohereChatResponse

AxAICohereChatResponse: object

Defined in: src/ax/ai/cohere/types.ts:89

Type declaration

finish_reason

finish_reason: "COMPLETE" | "ERROR" | "ERROR_TOXIC" | "ERROR_LIMIT" | "USER_CANCEL" | "MAX_TOKENS"

generation_id

generation_id: string

meta

{ billed_units: { input_tokens: number; output_tokens: number; }; }

response_id

response_id: string

text

text: string

tool_calls

tool_calls: AxAICohereChatResponseToolCalls

> AxAICohereChatResponseDelta

AxAICohereChatResponseDelta: AxAICohereChatResponse & object

Defined in: src/ax/ai/cohere/types.ts:109

Type declaration

event_type

event_type: "stream-start" | "text-generation" | "tool-calls-generation" | "stream-end"

> AxAICohereChatResponseToolCalls

AxAICohereChatResponseToolCalls: object[]

Defined in: src/ax/ai/cohere/types.ts:31

Type declaration

name

name: string

parameters?

optional parameters: object

> AxAICohereConfig

AxAICohereConfig: AxModelConfig & object

Defined in: src/ax/ai/cohere/types.ts:26

Cohere: Model options for text generation

Type declaration

embedModel?

optional embedModel: AxAICohereEmbedModel

model

model: AxAICohereModel

> AxAICohereEmbedRequest

AxAICohereEmbedRequest: object

Defined in: src/ax/ai/cohere/types.ts:117

Type declaration

model

model: AxAICohereModel | string

texts

texts: readonly string[]

truncate

truncate: string

> AxAIEmbedModels

> AxAIGoogleGeminiBatchEmbedRequest

AxAIGoogleGeminiBatchEmbedRequest: object

Defined in: src/ax/ai/google-gemini/types.ts:171

AxAIGoogleGeminiEmbedRequest: Structure for making an embedding request to the Google Gemini API.

Type declaration

requests

requests: object[]

> AxAICohereEmbedResponse

AxAICohereEmbedResponse: object

Defined in: src/ax/ai/cohere/types.ts:123

Type declaration

embeddings

embeddings: number[][]

id

id: string

model

model: string

texts

texts: string[]

> AxAIGoogleGeminiBatchEmbedResponse

AxAIGoogleGeminiBatchEmbedResponse: object

Defined in: src/ax/ai/google-gemini/types.ts:183

AxAIGoogleGeminiEmbedResponse: Structure for handling responses from the Google Gemini API embedding requests.

Type declaration

embeddings

embeddings: object[]

> AxAIGoogleGeminiChatRequest

AxAIGoogleGeminiChatRequest: object

Defined in: src/ax/ai/google-gemini/types.ts:115

Type declaration

contents

contents: AxAIGoogleGeminiContent[]

generationConfig

generationConfig: AxAIGoogleGeminiGenerationConfig

safetySettings?

optional safetySettings: AxAIGoogleGeminiSafetySettings

systemInstruction?

optional systemInstruction: AxAIGoogleGeminiContent

toolConfig?

optional toolConfig: AxAIGoogleGeminiToolConfig

tools?

optional tools: AxAIGoogleGeminiTool[]

> AxAIGoogleGeminiChatResponse

AxAIGoogleGeminiChatResponse: object

Defined in: src/ax/ai/google-gemini/types.ts:124

Type declaration

candidates

candidates: object[]

usageMetadata

{ candidatesTokenCount: number; promptTokenCount: number; totalTokenCount: number; }

> AxAIGoogleGeminiChatResponseDelta

AxAIGoogleGeminiChatResponseDelta: AxAIGoogleGeminiChatResponse

Defined in: src/ax/ai/google-gemini/types.ts:157

> AxAIGoogleGeminiConfig

AxAIGoogleGeminiConfig: AxModelConfig & object

Defined in: src/ax/ai/google-gemini/types.ts:162

AxAIGoogleGeminiConfig: Configuration options for Google Gemini API

Type declaration

embedModel?

optional embedModel: AxAIGoogleGeminiEmbedModel

model

model: AxAIGoogleGeminiModel | string

safetySettings?

optional safetySettings: AxAIGoogleGeminiSafetySettings

> AxAIGoogleGeminiContent

AxAIGoogleGeminiContent: { parts: ({ text: string; } | { inlineData: { data: string; mimeType: string; }; } | { fileData: { fileUri: string; mimeType: string; }; })[]; role: "user"; } | { parts: object[] | object[]; role: "model"; } | { parts: object[]; role: "function"; }

Defined in: src/ax/ai/google-gemini/types.ts:31

> AxAIGoogleGeminiGenerationConfig

AxAIGoogleGeminiGenerationConfig: object

Defined in: src/ax/ai/google-gemini/types.ts:101

Type declaration

candidateCount?

optional candidateCount: number

maxOutputTokens?

optional maxOutputTokens: number

stopSequences?

optional stopSequences: readonly string[]

temperature?

optional temperature: number

topK?

optional topK: number

topP?

optional topP: number

> AxAIGoogleGeminiTool

AxAIGoogleGeminiTool: object

Defined in: src/ax/ai/google-gemini/types.ts:88

Type declaration

code_execution?

optional code_execution: object

function_declarations?

optional function_declarations: AxAIGoogleGeminiToolFunctionDeclaration[]

google_search_retrieval?

optional google_search_retrieval: AxAIGoogleGeminiToolGoogleSearchRetrieval

> AxAIGoogleGeminiSafetySettings

AxAIGoogleGeminiSafetySettings: object[]

Defined in: src/ax/ai/google-gemini/types.ts:110

Type declaration

category

category: AxAIGoogleGeminiSafetyCategory

threshold

threshold: AxAIGoogleGeminiSafetyThreshold

> AxAIGoogleGeminiToolFunctionDeclaration

AxAIGoogleGeminiToolFunctionDeclaration: object

Defined in: src/ax/ai/google-gemini/types.ts:75

Type declaration

description?

optional description: string

name

name: string

parameters?

optional parameters: object

> AxAIGoogleGeminiToolConfig

AxAIGoogleGeminiToolConfig: object

Defined in: src/ax/ai/google-gemini/types.ts:94

Type declaration

function_calling_config

{ allowed_function_names: string[]; mode: "ANY" | "NONE" | "AUTO"; }

> AxAIGoogleGeminiToolGoogleSearchRetrieval

AxAIGoogleGeminiToolGoogleSearchRetrieval: object

Defined in: src/ax/ai/google-gemini/types.ts:81

Type declaration

dynamic_retrieval_config

{ dynamic_threshold: number; mode: "MODE_DYNAMIC"; }

> AxAIHuggingFaceConfig

AxAIHuggingFaceConfig: AxModelConfig & object

Defined in: src/ax/ai/huggingface/types.ts:7

Type declaration

doSample?

optional doSample: boolean

maxTime?

optional maxTime: number

model

model: AxAIHuggingFaceModel

returnFullText?

optional returnFullText: boolean

useCache?

optional useCache: boolean

waitForModel?

optional waitForModel: boolean

> AxAIHuggingFaceRequest

AxAIHuggingFaceRequest: object

Defined in: src/ax/ai/huggingface/types.ts:16

Type declaration

inputs

inputs: string

model

model: AxAIHuggingFaceModel | string

options?

{ use_cache: boolean; wait_for_model: boolean; }

parameters

{ do_sample: boolean; max_new_tokens: number; max_time: number; num_return_sequences: number; repetition_penalty: number; return_full_text: boolean; temperature: number; top_k: number; top_p: number; }

> AxAIHuggingFaceResponse

AxAIHuggingFaceResponse: object

Defined in: src/ax/ai/huggingface/types.ts:36

Type declaration

generated_text

generated_text: string

> AxAIModelMap

AxAIModelMap: Record<string, string>

Defined in: src/ax/ai/types.ts:7

> AxAIModels

> AxAIOllamaAIConfig

AxAIOllamaAIConfig: AxAIOpenAIConfig

Defined in: src/ax/ai/ollama/api.ts:9

> AxAIOllamaArgs

AxAIOllamaArgs: object

Defined in: src/ax/ai/ollama/api.ts:25

Type declaration

apiKey?

optional apiKey: string

config?

optional config: Readonly<Partial<AxAIOllamaAIConfig>>

embedModel?

optional embedModel: string

model?

optional model: string

modelMap?

optional modelMap: Record<string, string>

name

name: "ollama"

options?

optional options: Readonly<AxAIServiceOptions>

url?

optional url: string

> AxAIOpenAIChatRequest

AxAIOpenAIChatRequest: object

Defined in: src/ax/ai/openai/types.ts:65

Type declaration

frequency_penalty?

optional frequency_penalty: number

logit_bias?

optional logit_bias: Map<string, number>

max_tokens

max_tokens: number

messages

messages: ({ content: string; role: "system"; } | { content: string | ({ text: string; type: "text"; } | { image_url: { details: …; url: …; }; type: "image_url"; } | { input_audio: { data: …; format: …; }; type: "input_audio"; })[]; name: string; role: "user"; } | { content: string; name: string; role: "assistant"; tool_calls: object[]; } | { content: string; role: "tool"; tool_call_id: string; })[]

model

model: string

n?

optional n: number

organization?

optional organization: string

presence_penalty?

optional presence_penalty: number

response_format?

{ type: string; }

stop?

optional stop: readonly string[]

stream?

optional stream: boolean

temperature?

optional temperature: number

tool_choice?

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

tools?

optional tools: object[]

top_p?

optional top_p: number

user?

optional user: string

> AxAIOpenAIChatResponseDelta

AxAIOpenAIChatResponseDelta: AxAIOpenAIResponseDelta<{ content: string; role: string; tool_calls: NonNullable<…[…][0]["message"]["tool_calls"]>[0] & object[]; }>

Defined in: src/ax/ai/openai/types.ts:160

> AxAIOpenAIChatResponse

AxAIOpenAIChatResponse: object

Defined in: src/ax/ai/openai/types.ts:131

Type declaration

choices

choices: object[]

created

created: number

error?

{ code: number; message: string; param: string; type: string; }

id

id: string

model

model: string

object

object: "chat.completion"

system_fingerprint

system_fingerprint: string

usage?

optional usage: AxAIOpenAIUsage

> AxAIOpenAIConfig

AxAIOpenAIConfig: Omit<AxModelConfig, "topK"> & object

Defined in: src/ax/ai/openai/types.ts:24

Type declaration

bestOf?

optional bestOf: number

dimensions?

optional dimensions: number

echo?

optional echo: boolean

embedModel?

optional embedModel: AxAIOpenAIEmbedModel | string

logitBias?

optional logitBias: Map<string, number>

logprobs?

optional logprobs: number

model

model: AxAIOpenAIModel | string

responseFormat?

optional responseFormat: "json_object"

stop?

optional stop: string[]

suffix?

optional suffix: string | null

user?

optional user: string

> AxAIOpenAIEmbedRequest

AxAIOpenAIEmbedRequest: object

Defined in: src/ax/ai/openai/types.ts:170

Type declaration

dimensions?

optional dimensions: number

input

input: readonly string[]

model

model: string

user?

optional user: string

> AxAIOpenAIEmbedResponse

AxAIOpenAIEmbedResponse: object

Defined in: src/ax/ai/openai/types.ts:177

Type declaration

data

data: object[]

model

model: string

usage

usage: AxAIOpenAIUsage

> AxAIOpenAILogprob

AxAIOpenAILogprob: object

Defined in: src/ax/ai/openai/types.ts:38

Type declaration

text_offset

text_offset: number[]

token_logprobs

token_logprobs: number[]

tokens

tokens: string[]

top_logprobs

top_logprobs: Map<string, number>

> AxAIOpenAIUsage

AxAIOpenAIUsage: object

Defined in: src/ax/ai/openai/types.ts:45

Type declaration

completion_tokens

completion_tokens: number

prompt_tokens

prompt_tokens: number

total_tokens

total_tokens: number

> AxAIPromptConfig

AxAIPromptConfig: object

Defined in: src/ax/ai/types.ts:206

Type declaration

stream?

optional stream: boolean

> AxAIRekaChatRequest

AxAIRekaChatRequest: object

Defined in: src/ax/ai/reka/types.ts:20

Type declaration

frequency_penalty?

optional frequency_penalty: number

max_tokens

max_tokens: number

messages

messages: ({ content: string | object[]; role: "user"; } | { content: string | object[]; role: "assistant"; })[]

model

model: string

presence_penalty?

optional presence_penalty: number

response_format?

{ type: string; }

stop?

optional stop: readonly string[]

stream?

optional stream: boolean

temperature?

optional temperature: number

top_k?

optional top_k: number

top_p?

optional top_p: number

usage?

optional usage: AxAIRekaUsage

use_search_engine?

optional use_search_engine: boolean

> AxAIRekaChatResponse

AxAIRekaChatResponse: object

Defined in: src/ax/ai/reka/types.ts:55

Type declaration

id

id: string

model

model: string

responses

responses: object[]

usage?

optional usage: AxAIRekaUsage

> AxAIRekaChatResponseDelta

AxAIRekaChatResponseDelta: object

Defined in: src/ax/ai/reka/types.ts:72

Type declaration

id

id: string

model

model: string

responses

responses: object[]

usage?

optional usage: AxAIRekaUsage

> AxAIRekaConfig

AxAIRekaConfig: Omit<AxModelConfig, "topK"> & object

Defined in: src/ax/ai/reka/types.ts:9

Type declaration

model

model: AxAIRekaModel | string

stop?

optional stop: readonly string[]

useSearchEngine?

optional useSearchEngine: boolean

> AxAIRekaUsage

AxAIRekaUsage: object

Defined in: src/ax/ai/reka/types.ts:15

Type declaration

input_tokens

input_tokens: number

output_tokens

output_tokens: number

> AxAIServiceActionOptions

AxAIServiceActionOptions: object

Defined in: src/ax/ai/types.ts:217

Type declaration

ai?

optional ai: Readonly<AxAIService>

rateLimiter?

optional rateLimiter: AxRateLimiterFunction

sessionId?

optional sessionId: string

traceId?

optional traceId: string

> AxAPI

AxAPI: object

Defined in: src/ax/util/apicall.ts:15

Util: API details

Type declaration

headers?

optional headers: Record<string, string>

name?

optional name: string

put?

optional put: boolean

> AxAIServiceOptions

AxAIServiceOptions: object

Defined in: src/ax/ai/types.ts:210

Type declaration

debug?

optional debug: boolean

fetch?

optional fetch: typeof __type

rateLimiter?

optional rateLimiter: AxRateLimiterFunction

tracer?

optional tracer: Tracer

> AxAgentOptions

AxAgentOptions: Omit<AxGenOptions, "functions">

Defined in: src/ax/prompts/agent.ts:21

> AxBalancerOptions

AxBalancerOptions: object

Defined in: src/ax/ai/balance.ts:40

Options for the balancer.

Type declaration

comparator()?

(a, b) => number

> AxChatRequest

AxChatRequest: object

Defined in: src/ax/ai/types.ts:100

Type declaration

chatPrompt

chatPrompt: Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: … | … | …; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>[]

functionCall?

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

functions?

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

model?

optional model: string

modelConfig?

optional modelConfig: Readonly<AxModelConfig>

> AxChatResponse

AxChatResponse: object

Defined in: src/ax/ai/types.ts:83

Type declaration

embedModelUsage?

optional embedModelUsage: AxTokenUsage

modelUsage?

optional modelUsage: AxTokenUsage

remoteId?

optional remoteId: string

results

results: readonly AxChatResponseResult[]

sessionId?

optional sessionId: string

> AxChatResponseFunctionCall

AxChatResponseFunctionCall: object

Defined in: src/ax/dsp/functions.ts:13

Type declaration

args

args: string

id?

optional id: string

name

name: string

> AxChatResponseResult

AxChatResponseResult: object

Defined in: src/ax/ai/types.ts:66

Type declaration

content?

optional content: string

finishReason?

optional finishReason: "stop" | "length" | "function_call" | "content_filter" | "error"

functionCalls?

optional functionCalls: object[]

id?

optional id: string

name?

optional name: string

> AxDBArgs

> AxDBCloudflareOpOptions

AxDBCloudflareOpOptions: AxDBBaseOpOptions

Defined in: src/ax/db/cloudflare.ts:13

> AxDBMemoryOpOptions

AxDBMemoryOpOptions: AxDBBaseOpOptions

Defined in: src/ax/db/memory.ts:9

> AxDBPineconeOpOptions

AxDBPineconeOpOptions: AxDBBaseOpOptions

Defined in: src/ax/db/pinecone.ts:11

> AxDBQueryRequest

AxDBQueryRequest: object

Defined in: src/ax/db/types.ts:17

Type declaration

columns?

optional columns: string[]

id?

optional id: string

limit?

optional limit: number

namespace?

optional namespace: string

table

table: string

text?

optional text: string

values?

optional values: readonly number[]

> AxDBQueryResponse

AxDBQueryResponse: object

Defined in: src/ax/db/types.ts:27

Type declaration

matches

matches: object[]

> AxDBState

AxDBState: Record<string, Record<string, AxDBUpsertRequest>>

Defined in: src/ax/db/memory.ts:15

> AxDBUpsertRequest

AxDBUpsertRequest: object

Defined in: src/ax/db/types.ts:3

Type declaration

id

id: string

metadata?

optional metadata: Record<string, string>

namespace?

optional namespace: string

table

table: string

text?

optional text: string

values?

optional values: readonly number[]

> AxDBUpsertResponse

AxDBUpsertResponse: object

Defined in: src/ax/db/types.ts:12

Type declaration

ids

ids: string[]

> AxDBWeaviateOpOptions

AxDBWeaviateOpOptions: AxDBBaseOpOptions

Defined in: src/ax/db/weaviate.ts:11

> AxDataRow

AxDataRow: object

Defined in: src/ax/dsp/loader.ts:3

Type declaration

row

row: Record<string, AxFieldValue>

> AxEmbedRequest

AxEmbedRequest: object

Defined in: src/ax/ai/types.ts:193

Type declaration

embedModel?

optional embedModel: string

texts?

optional texts: readonly string[]

> AxEmbedResponse

AxEmbedResponse: object

Defined in: src/ax/ai/types.ts:91

Type declaration

embeddings

embeddings: readonly readonly number[][]

modelUsage?

optional modelUsage: AxTokenUsage

remoteId?

optional remoteId: string

sessionId?

optional sessionId: string

> AxEvaluateArgs

AxEvaluateArgs<IN, OUT>: object

Defined in: src/ax/dsp/evaluate.ts:7

Type Parameters

Type Parameter
IN extends AxGenIn
OUT extends AxGenOut

Type declaration

ai

ai: AxAIService

examples

examples: Readonly<AxExample[]>

program

program: Readonly<AxProgram<IN, OUT>>

> AxExample

AxExample: Record<string, AxFieldValue>

Defined in: src/ax/dsp/optimize.ts:13

> AxFieldTemplateFn

AxFieldTemplateFn: (field, value) => any[]

Defined in: src/ax/dsp/prompt.ts:17

Parameters

ParameterType
fieldReadonly<AxField>
valueReadonly<AxFieldValue>

Returns

any[]

> AxFieldValue

AxFieldValue: string | string[] | number | boolean | object | null | undefined | { data: string; mimeType: string; } | object[] | { data: string; format: "wav"; } | object[]

Defined in: src/ax/dsp/program.ts:17

> AxFunction

AxFunction: object

Defined in: src/ax/ai/types.ts:59

Type declaration

description

description: string

func

func: AxFunctionHandler

name

name: string

parameters?

optional parameters: AxFunctionJSONSchema

> AxFunctionExec

AxFunctionExec: object

Defined in: src/ax/dsp/functions.ts:19

Type declaration

id?

optional id: string

result?

optional result: string

> AxFunctionHandler

AxFunctionHandler: (args?, extra?) => unknown

Defined in: src/ax/ai/types.ts:37

Parameters

ParameterType
args?any
extra?Readonly<{ sessionId: string; traceId: string; }>

Returns

unknown

> AxFunctionJSONSchema

AxFunctionJSONSchema: object

Defined in: src/ax/ai/types.ts:46

Type declaration

items?

optional items: AxFunctionJSONSchema

properties?

optional properties: Record<string, AxFunctionJSONSchema & object>

required?

optional required: string[]

type

type: string

> AxGenIn

AxGenIn: object

Defined in: src/ax/dsp/program.ts:30

Index Signature

[key: symbol]: AxFieldValue

> AxGenOut

AxGenOut: Record<string, AxFieldValue>

Defined in: src/ax/dsp/program.ts:32

> AxGenerateResult

AxGenerateResult<OUT>: OUT & object

Defined in: src/ax/dsp/generate.ts:67

Type declaration

functions?

optional functions: AxChatResponseFunctionCall[]

Type Parameters

Type Parameter
OUT extends AxGenOut

> AxIField

AxIField: Omit<AxField, "title"> & object

Defined in: src/ax/dsp/sig.ts:33

Type declaration

title

title: string

> AxInputFunctionType

AxInputFunctionType: AxFunction[] | object[]

Defined in: src/ax/dsp/functions.ts:92

> AxInternalChatRequest

AxInternalChatRequest: Omit<AxChatRequest, "model"> & Required<Pick<AxChatRequest, "model">>

Defined in: src/ax/ai/types.ts:190

> AxInternalEmbedRequest

AxInternalEmbedRequest: Omit<AxEmbedRequest, "embedModel"> & Required<Pick<AxEmbedRequest, "embedModel">>

Defined in: src/ax/ai/types.ts:198

> AxMetricFn

AxMetricFn: <T>(arg0) => boolean

Defined in: src/ax/dsp/optimize.ts:15

Type Parameters

Type ParameterDefault type
T extends AxGenOutAxGenOut

Parameters

ParameterType
arg0Readonly<{ example: AxExample; prediction: T; }>

Returns

boolean

> AxMetricFnArgs

AxMetricFnArgs: Parameters<AxMetricFn>[0]

Defined in: src/ax/dsp/optimize.ts:19

> AxModelConfig

AxModelConfig: object

Defined in: src/ax/ai/types.ts:24

Type declaration

endSequences?

optional endSequences: string[]

frequencyPenalty?

optional frequencyPenalty: number

maxTokens?

optional maxTokens: number

n?

optional n: number

presencePenalty?

optional presencePenalty: number

stopSequences?

optional stopSequences: string[]

stream?

optional stream: boolean

temperature?

optional temperature: number

topK?

optional topK: number

topP?

optional topP: number

> AxModelInfo

AxModelInfo: object

Defined in: src/ax/ai/types.ts:9

Type declaration

aliases?

optional aliases: string[]

characterIsToken?

optional characterIsToken: boolean

completionTokenCostPer1M?

optional completionTokenCostPer1M: number

currency?

optional currency: string

name

name: string

promptTokenCostPer1M?

optional promptTokenCostPer1M: number

> AxModelInfoWithProvider

AxModelInfoWithProvider: AxModelInfo & object

Defined in: src/ax/ai/types.ts:98

Type declaration

provider

provider: string

> AxOptimizerArgs

AxOptimizerArgs<IN, OUT>: object

Defined in: src/ax/dsp/optimize.ts:21

Type Parameters

Type Parameter
IN extends AxGenIn
OUT extends AxGenOut

Type declaration

ai

ai: AxAIService

examples

examples: Readonly<AxExample[]>

options?

{ maxDemos: number; maxExamples: number; maxRounds: number; }

program

program: Readonly<AxProgram<IN, OUT>>

> AxProgramDemos

AxProgramDemos: object

Defined in: src/ax/dsp/program.ts:40

Type declaration

programId

programId: string

traces

traces: Record<string, AxFieldValue>[]

> AxProgramExamples

AxProgramExamples: AxProgramDemos | AxProgramDemos["traces"]

Defined in: src/ax/dsp/program.ts:46

> AxProgramForwardOptions

AxProgramForwardOptions: object

Defined in: src/ax/dsp/program.ts:48

Type declaration

ai?

optional ai: AxAIService

debug?

optional debug: boolean

functionCall?

optional functionCall: AxChatRequest["functionCall"]

functions?

optional functions: AxFunction[]

maxCompletions?

optional maxCompletions: number

maxRetries?

optional maxRetries: number

maxSteps?

optional maxSteps: number

mem?

optional mem: AxAIMemory

model?

optional model: string

modelConfig?

optional modelConfig: AxModelConfig

rateLimiter?

optional rateLimiter: AxRateLimiterFunction

sessionId?

optional sessionId: string

stopFunction?

optional stopFunction: string

stream?

optional stream: boolean

traceId?

optional traceId: string

tracer?

optional tracer: Tracer

> AxProgramTrace

AxProgramTrace: object

Defined in: src/ax/dsp/program.ts:34

Type declaration

programId

programId: string

trace

trace: Record<string, AxFieldValue>

> AxProgramUsage

AxProgramUsage: AxChatResponse["modelUsage"] & object

Defined in: src/ax/dsp/program.ts:80

Type declaration

ai

ai: string

model

model: string

> AxRateLimiterFunction

AxRateLimiterFunction: <T>(reqFunc, info) => Promise<T | ReadableStream<T>>

Defined in: src/ax/ai/types.ts:201

Type Parameters

Type ParameterDefault type
Tunknown

Parameters

ParameterType
reqFunc() => Promise<T | ReadableStream<T>>
infoReadonly<{ embedModelUsage: AxTokenUsage; modelUsage: AxTokenUsage; }>

Returns

Promise<T | ReadableStream<T>>

> AxRerankerIn

AxRerankerIn: object

Defined in: src/ax/docs/manager.ts:11

Type declaration

items

items: string[]

query

query: string

> AxRerankerOut

AxRerankerOut: object

Defined in: src/ax/docs/manager.ts:12

Type declaration

rankedItems

rankedItems: string[]

> AxRewriteIn

AxRewriteIn: object

Defined in: src/ax/docs/manager.ts:8

Type declaration

query

query: string

> AxRewriteOut

AxRewriteOut: object

Defined in: src/ax/docs/manager.ts:9

Type declaration

rewrittenQuery

rewrittenQuery: string

> AxTokenUsage

AxTokenUsage: object

Defined in: src/ax/ai/types.ts:18

Type declaration

completionTokens

completionTokens: number

promptTokens

promptTokens: number

totalTokens

totalTokens: number

> AxAI

Defined in: src/ax/ai/wrap.ts:80

Implements

Constructors

new AxAI()

new AxAI(options): AxAI

Defined in: src/ax/ai/wrap.ts:83

Parameters

ParameterType
optionsReadonly<AxAIArgs>

Returns

AxAI

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/wrap.ts:150

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Implementation of

AxAIService.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/wrap.ts:157

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Implementation of

AxAIService.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/wrap.ts:134

Returns

undefined | Readonly<AxModelInfoWithProvider>

Implementation of

AxAIService.getEmbedModelInfo


getFeatures()

getFeatures(model?): object

Defined in: src/ax/ai/wrap.ts:138

Parameters

ParameterType
model?string

Returns

object

functions

functions: boolean

streaming

streaming: boolean

Implementation of

AxAIService.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/wrap.ts:146

Returns

AxAIServiceMetrics

Implementation of

AxAIService.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/wrap.ts:130

Returns

Readonly<AxModelInfoWithProvider>

Implementation of

AxAIService.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/wrap.ts:142

Returns

undefined | AxAIModelMap

Implementation of

AxAIService.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/wrap.ts:126

Returns

string

Implementation of

AxAIService.getName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/wrap.ts:164

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Implementation of

AxAIService.setOptions

> AxAIAnthropic

Defined in: src/ax/ai/anthropic/api.ts:287

Extends

Constructors

new AxAIAnthropic()

new AxAIAnthropic(__namedParameters): AxAIAnthropic

Defined in: src/ax/ai/anthropic/api.ts:294

Parameters

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

Returns

AxAIAnthropic

Overrides

AxBaseAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxBaseAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxBaseAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxBaseAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxBaseAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxBaseAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxBaseAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxBaseAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxBaseAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxBaseAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxBaseAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxBaseAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxBaseAI.setOptions

> AxAIAzureOpenAI

Defined in: src/ax/ai/azure-openai/api.ts:34

Extends

Constructors

new AxAIAzureOpenAI()

new AxAIAzureOpenAI(__namedParameters): AxAIAzureOpenAI

Defined in: src/ax/ai/azure-openai/api.ts:35

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAIAzureOpenAIArgs, "name">>

Returns

AxAIAzureOpenAI

Overrides

AxAIOpenAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxAIOpenAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxAIOpenAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxAIOpenAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxAIOpenAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxAIOpenAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxAIOpenAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxAIOpenAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxAIOpenAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxAIOpenAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxAIOpenAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxAIOpenAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxAIOpenAI.setOptions

> AxAICohere

Defined in: src/ax/ai/cohere/api.ts:286

Extends

Constructors

new AxAICohere()

new AxAICohere(__namedParameters): AxAICohere

Defined in: src/ax/ai/cohere/api.ts:293

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAICohereArgs, "name">>

Returns

AxAICohere

Overrides

AxBaseAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxBaseAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxBaseAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxBaseAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxBaseAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxBaseAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxBaseAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxBaseAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxBaseAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxBaseAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxBaseAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxBaseAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxBaseAI.setOptions

> AxAIDeepSeek

Defined in: src/ax/ai/deepseek/api.ts:34

Extends

Constructors

new AxAIDeepSeek()

new AxAIDeepSeek(__namedParameters): AxAIDeepSeek

Defined in: src/ax/ai/deepseek/api.ts:35

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAIDeepSeekArgs, "name">>

Returns

AxAIDeepSeek

Overrides

AxAIOpenAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxAIOpenAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxAIOpenAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxAIOpenAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxAIOpenAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxAIOpenAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxAIOpenAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxAIOpenAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxAIOpenAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxAIOpenAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxAIOpenAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxAIOpenAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxAIOpenAI.setOptions

> AxAIGoogleGemini

Defined in: src/ax/ai/google-gemini/api.ts:439

AxAIGoogleGemini: AI Service

Extends

Constructors

new AxAIGoogleGemini()

new AxAIGoogleGemini(__namedParameters): AxAIGoogleGemini

Defined in: src/ax/ai/google-gemini/api.ts:446

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAIGoogleGeminiArgs, "name">>

Returns

AxAIGoogleGemini

Overrides

AxBaseAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxBaseAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxBaseAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxBaseAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxBaseAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxBaseAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxBaseAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxBaseAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxBaseAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxBaseAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxBaseAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxBaseAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxBaseAI.setOptions

> AxAIGroq

Defined in: src/ax/ai/groq/api.ts:26

Extends

Constructors

new AxAIGroq()

new AxAIGroq(__namedParameters): AxAIGroq

Defined in: src/ax/ai/groq/api.ts:27

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAIGroqArgs, "groq">>

Returns

AxAIGroq

Overrides

AxAIOpenAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxAIOpenAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxAIOpenAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxAIOpenAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxAIOpenAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxAIOpenAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxAIOpenAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxAIOpenAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxAIOpenAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxAIOpenAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxAIOpenAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxAIOpenAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/groq/api.ts:59

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Overrides

AxAIOpenAI.setOptions

> AxAIHuggingFace

Defined in: src/ax/ai/huggingface/api.ts:155

Extends

Constructors

new AxAIHuggingFace()

new AxAIHuggingFace(__namedParameters): AxAIHuggingFace

Defined in: src/ax/ai/huggingface/api.ts:162

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAIHuggingFaceArgs, "name">>

Returns

AxAIHuggingFace

Overrides

AxBaseAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxBaseAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxBaseAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxBaseAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxBaseAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxBaseAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxBaseAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxBaseAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxBaseAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxBaseAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxBaseAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxBaseAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxBaseAI.setOptions

> AxAIMistral

Defined in: src/ax/ai/mistral/api.ts:31

Extends

Constructors

new AxAIMistral()

new AxAIMistral(__namedParameters): AxAIMistral

Defined in: src/ax/ai/mistral/api.ts:32

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAIMistralArgs, "name">>

Returns

AxAIMistral

Overrides

AxAIOpenAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxAIOpenAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxAIOpenAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxAIOpenAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxAIOpenAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxAIOpenAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxAIOpenAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxAIOpenAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxAIOpenAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxAIOpenAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxAIOpenAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxAIOpenAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxAIOpenAI.setOptions

> AxAIOpenAI

Defined in: src/ax/ai/openai/api.ts:408

Extends

Extended by

Constructors

new AxAIOpenAI()

new AxAIOpenAI(__namedParameters): AxAIOpenAI

Defined in: src/ax/ai/openai/api.ts:415

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAIOpenAIArgs, "name">>

Returns

AxAIOpenAI

Overrides

AxBaseAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxBaseAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxBaseAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxBaseAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxBaseAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxBaseAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxBaseAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxBaseAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxBaseAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxBaseAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxBaseAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxBaseAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxBaseAI.setOptions

> AxAIReka

Defined in: src/ax/ai/reka/api.ts:263

Extends

Constructors

new AxAIReka()

new AxAIReka(__namedParameters): AxAIReka

Defined in: src/ax/ai/reka/api.ts:270

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAIRekaArgs, "name">>

Returns

AxAIReka

Overrides

AxBaseAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxBaseAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxBaseAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxBaseAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxBaseAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxBaseAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxBaseAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxBaseAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxBaseAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxBaseAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxBaseAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxBaseAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxBaseAI.setOptions

> AxAIOllama

Defined in: src/ax/ai/ollama/api.ts:39

OllamaAI: AI Service

Extends

Constructors

new AxAIOllama()

new AxAIOllama(__namedParameters): AxAIOllama

Defined in: src/ax/ai/ollama/api.ts:40

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAIOllamaArgs, "name">>

Returns

AxAIOllama

Overrides

AxAIOpenAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxAIOpenAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxAIOpenAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxAIOpenAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxAIOpenAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxAIOpenAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxAIOpenAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxAIOpenAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxAIOpenAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxAIOpenAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxAIOpenAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxAIOpenAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxAIOpenAI.setOptions

> AxAgent

Defined in: src/ax/prompts/agent.ts:23

Type Parameters

Type Parameter
IN extends AxGenIn
OUT extends AxGenOut

Implements

Constructors

new AxAgent()

new AxAgent<IN, OUT>(__namedParameters, options?): AxAgent<IN, OUT>

Defined in: src/ax/prompts/agent.ts:36

Parameters

ParameterType
__namedParametersReadonly<{ agents: AxAgentic[]; ai: Readonly<AxAIService>; description: string; functions: AxFunction[]; name: string; signature: string | AxSignature; }>
options?Readonly<AxAgentOptions>

Returns

AxAgent<IN, OUT>

Methods

forward()

forward(ai, values, options?): Promise<OUT>

Defined in: src/ax/prompts/agent.ts:145

Parameters

ParameterType
aiReadonly<AxAIService>
valuesIN
options?Readonly<AxProgramForwardOptions>

Returns

Promise<OUT>


getFunction()

getFunction(): AxFunction

Defined in: src/ax/prompts/agent.ts:124

Returns

AxFunction

Implementation of

AxAgentic.getFunction


getTraces()

getTraces(): AxProgramTrace[]

Defined in: src/ax/prompts/agent.ts:108

Returns

AxProgramTrace[]

Implementation of

AxAgentic.getTraces


getUsage()

getUsage(): AxTokenUsage & object[]

Defined in: src/ax/prompts/agent.ts:116

Returns

AxTokenUsage & object[]

Implementation of

AxAgentic.getUsage


resetUsage()

resetUsage(): void

Defined in: src/ax/prompts/agent.ts:120

Returns

void

Implementation of

AxAgentic.resetUsage


setDemos()

setDemos(demos): void

Defined in: src/ax/prompts/agent.ts:112

Parameters

ParameterType
demosreadonly AxProgramDemos[]

Returns

void

Implementation of

AxAgentic.setDemos


setExamples()

setExamples(examples): void

Defined in: src/ax/prompts/agent.ts:96

Parameters

ParameterType
examplesReadonly<AxProgramExamples>

Returns

void

Implementation of

AxAgentic.setExamples


setId()

setId(id): void

Defined in: src/ax/prompts/agent.ts:100

Parameters

ParameterType
idstring

Returns

void

Implementation of

AxAgentic.setId


setParentId()

setParentId(parentId): void

Defined in: src/ax/prompts/agent.ts:104

Parameters

ParameterType
parentIdstring

Returns

void

Implementation of

AxAgentic.setParentId

> AxAITogether

Defined in: src/ax/ai/together/api.ts:25

Extends

Constructors

new AxAITogether()

new AxAITogether(__namedParameters): AxAITogether

Defined in: src/ax/ai/together/api.ts:26

Parameters

ParameterType
__namedParametersReadonly<Omit<AxAITogetherArgs, "name">>

Returns

AxAITogether

Overrides

AxAIOpenAI.constructor

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Inherited from

AxAIOpenAI.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Inherited from

AxAIOpenAI.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Inherited from

AxAIOpenAI.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Inherited from

AxAIOpenAI.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Inherited from

AxAIOpenAI.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Inherited from

AxAIOpenAI.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Inherited from

AxAIOpenAI.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Inherited from

AxAIOpenAI.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void

Inherited from

AxAIOpenAI.setAPIURL


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void

Inherited from

AxAIOpenAI.setHeaders


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void

Inherited from

AxAIOpenAI.setName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Inherited from

AxAIOpenAI.setOptions

> AxApacheTika

Defined in: src/ax/docs/tika.ts:12

Constructors

new AxApacheTika()

new AxApacheTika(args?): AxApacheTika

Defined in: src/ax/docs/tika.ts:16

Parameters

ParameterType
args?Readonly<AxApacheTikaArgs>

Returns

AxApacheTika

Methods

convert()

convert(files, options?): Promise<string[]>

Defined in: src/ax/docs/tika.ts:54

Parameters

ParameterType
filesReadonly<string[] | Blob[]>
options?Readonly<{ batchSize: number; format: "text" | "html"; }>

Returns

Promise<string[]>

> AxAssertionError

Defined in: src/ax/dsp/asserts.ts:17

Extends

  • Error

Constructors

new AxAssertionError()

new AxAssertionError(__namedParameters): AxAssertionError

Defined in: src/ax/dsp/asserts.ts:21

Parameters

ParameterType
__namedParametersReadonly<{ message: string; optional: boolean; values: Record<string, unknown>; }>

Returns

AxAssertionError

Overrides

Error.constructor

Properties

cause?

optional cause: unknown

Defined in: node_modules/typescript/lib/lib.es2022.error.d.ts:26

Inherited from

Error.cause


message

message: string

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1077

Inherited from

Error.message


name

name: string

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1076

Inherited from

Error.name


stack?

optional stack: string

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1078

Inherited from

Error.stack


prepareStackTrace()?

static optional prepareStackTrace: (err, stackTraces) => any

Defined in: node_modules/@types/node/globals.d.ts:143

Optional override for formatting stack traces

Parameters

ParameterType
errError
stackTracesCallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

Error.prepareStackTrace


stackTraceLimit

static stackTraceLimit: number

Defined in: node_modules/@types/node/globals.d.ts:145

Inherited from

Error.stackTraceLimit

Methods

getFixingInstructions()

getFixingInstructions(_sig): object[]

Defined in: src/ax/dsp/asserts.ts:40

Parameters

ParameterType
_sigReadonly<AxSignature>

Returns

object[]


getOptional()

getOptional(): undefined | boolean

Defined in: src/ax/dsp/asserts.ts:37

Returns

undefined | boolean


getValue()

getValue(): Record<string, unknown>

Defined in: src/ax/dsp/asserts.ts:36

Returns

Record<string, unknown>


captureStackTrace()

static captureStackTrace(targetObject, constructorOpt?): void

Defined in: node_modules/@types/node/globals.d.ts:136

Create .stack property on a target object

Parameters

ParameterType
targetObjectobject
constructorOpt?Function

Returns

void

Inherited from

Error.captureStackTrace

> AxBalancer

Defined in: src/ax/ai/balance.ts:47

Balancer that rotates through services.

Implements

Constructors

new AxBalancer()

new AxBalancer(services, options?): AxBalancer

Defined in: src/ax/ai/balance.ts:52

Parameters

ParameterType
servicesreadonly AxAIService[]
options?AxBalancerOptions

Returns

AxBalancer

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/balance.ts:108

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Implementation of

AxAIService.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/balance.ts:125

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Implementation of

AxAIService.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/balance.ts:96

Returns

undefined | Readonly<AxModelInfoWithProvider>

Implementation of

AxAIService.getEmbedModelInfo


getFeatures()

getFeatures(model?): object

Defined in: src/ax/ai/balance.ts:100

Parameters

ParameterType
model?string

Returns

object

functions

functions: boolean

streaming

streaming: boolean

Implementation of

AxAIService.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/balance.ts:104

Returns

AxAIServiceMetrics

Implementation of

AxAIService.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/balance.ts:92

Returns

Readonly<AxModelInfoWithProvider>

Implementation of

AxAIService.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/balance.ts:66

Returns

undefined | AxAIModelMap

Implementation of

AxAIService.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/balance.ts:88

Returns

string

Implementation of

AxAIService.getName


setOptions()

setOptions(options): void

Defined in: src/ax/ai/balance.ts:142

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Implementation of

AxAIService.setOptions

> AxBaseAI

Defined in: src/ax/ai/base.ts:64

Extended by

Type Parameters

Type Parameter
TChatRequest
TEmbedRequest
TChatResponse
TChatResponseDelta
TEmbedResponse

Implements

Constructors

new AxBaseAI()

new AxBaseAI<TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse>(aiImpl, __namedParameters): AxBaseAI<TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse>

Defined in: src/ax/ai/base.ts:119

Parameters

ParameterType
aiImplReadonly<AxAIServiceImpl<TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse>>
__namedParametersReadonly<AxBaseAIArgs>

Returns

AxBaseAI<TChatRequest, TEmbedRequest, TChatResponse, TChatResponseDelta, TEmbedResponse>

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/base.ts:278

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Implementation of

AxAIService.chat


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/base.ts:468

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>

Implementation of

AxAIService.embed


getEmbedModelInfo()

getEmbedModelInfo(): undefined | AxModelInfoWithProvider

Defined in: src/ax/ai/base.ts:205

Returns

undefined | AxModelInfoWithProvider

Implementation of

AxAIService.getEmbedModelInfo


getFeatures()

getFeatures(model?): AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:229

Parameters

ParameterType
model?string

Returns

AxBaseAIFeatures

Implementation of

AxAIService.getFeatures


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/base.ts:274

Returns

AxAIServiceMetrics

Implementation of

AxAIService.getMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/base.ts:193

Returns

Readonly<AxModelInfoWithProvider>

Implementation of

AxAIService.getModelInfo


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/base.ts:221

Returns

undefined | AxAIModelMap

Implementation of

AxAIService.getModelMap


getName()

getName(): string

Defined in: src/ax/ai/base.ts:225

Returns

string

Implementation of

AxAIService.getName


setAPIURL()

setAPIURL(apiURL): void

Defined in: src/ax/ai/base.ts:167

Parameters

ParameterType
apiURLstring

Returns

void


setHeaders()

setHeaders(headers): void

Defined in: src/ax/ai/base.ts:171

Parameters

ParameterType
headersRecord<string, string>

Returns

void


setName()

setName(name): void

Defined in: src/ax/ai/base.ts:163

Parameters

ParameterType
namestring

Returns

void


setOptions()

setOptions(options): void

Defined in: src/ax/ai/base.ts:175

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

Implementation of

AxAIService.setOptions

> AxBootstrapFewShot

Defined in: src/ax/dsp/optimize.ts:28

Type Parameters

Type ParameterDefault type
IN extends AxGenInAxGenIn
OUT extends AxGenOutAxGenOut

Constructors

new AxBootstrapFewShot()

new AxBootstrapFewShot<IN, OUT>(__namedParameters): AxBootstrapFewShot<IN, OUT>

Defined in: src/ax/dsp/optimize.ts:40

Parameters

ParameterType
__namedParametersReadonly<AxOptimizerArgs<IN, OUT>>

Returns

AxBootstrapFewShot<IN, OUT>

Methods

compile()

compile(metricFn, options?): Promise<AxProgramDemos[]>

Defined in: src/ax/dsp/optimize.ts:105

Parameters

ParameterType
metricFnAxMetricFn
options?Readonly<undefined | { maxDemos: number; maxExamples: number; maxRounds: number; }>

Returns

Promise<AxProgramDemos[]>

> AxChainOfThought

Defined in: src/ax/prompts/cot.ts:5

Extends

  • AxGen<IN, OUT & object>

Extended by

Type Parameters

Type ParameterDefault type
IN extends AxGenInAxGenIn
OUT extends AxGenOutAxGenOut

Constructors

new AxChainOfThought()

new AxChainOfThought<IN, OUT>(signature, options?): AxChainOfThought<IN, OUT>

Defined in: src/ax/prompts/cot.ts:9

Parameters

ParameterType
signatureReadonly<string | AxSignature>
options?Readonly<AxGenOptions>

Returns

AxChainOfThought<IN, OUT>

Overrides

AxGen.constructor

Methods

addAssert()

addAssert(fn, message?, optional?): void

Defined in: src/ax/dsp/generate.ts:115

Parameters

ParameterType
fn(values) => undefined | boolean
message?string
optional?boolean

Returns

void

Inherited from

AxGen.addAssert


addStreamingAssert()

addStreamingAssert(fieldName, fn, message?, optional?): void

Defined in: src/ax/dsp/generate.ts:123

Parameters

ParameterType
fieldNamestring
fn(content, done?) => undefined | boolean
message?string
optional?boolean

Returns

void

Inherited from

AxGen.addStreamingAssert


forward()

forward(ai, values, options?): Promise<OUT & object>

Defined in: src/ax/dsp/generate.ts:453

Parameters

ParameterType
aiReadonly<AxAIService>
valuesIN
options?Readonly<AxProgramForwardOptions>

Returns

Promise<OUT & object>

Inherited from

AxGen.forward


getSignature()

getSignature(): AxSignature

Defined in: src/ax/dsp/program.ts:117

Returns

AxSignature

Inherited from

AxGen.getSignature


getTraces()

getTraces(): AxProgramTrace[]

Defined in: src/ax/dsp/program.ts:193

Returns

AxProgramTrace[]

Inherited from

AxGen.getTraces


getUsage()

getUsage(): AxTokenUsage & object[]

Defined in: src/ax/dsp/program.ts:207

Returns

AxTokenUsage & object[]

Inherited from

AxGen.getUsage


register()

register(prog): void

Defined in: src/ax/dsp/program.ts:121

Parameters

ParameterType
progReadonly<AxTunable & AxUsable>

Returns

void

Inherited from

AxGen.register


resetUsage()

resetUsage(): void

Defined in: src/ax/dsp/program.ts:217

Returns

void

Inherited from

AxGen.resetUsage


setDemos()

setDemos(demos): void

Defined in: src/ax/dsp/program.ts:224

Parameters

ParameterType
demosreadonly AxProgramDemos[]

Returns

void

Inherited from

AxGen.setDemos


setExamples()

setExamples(examples): void

Defined in: src/ax/dsp/program.ts:152

Parameters

ParameterType
examplesReadonly<AxProgramExamples>

Returns

void

Inherited from

AxGen.setExamples


setId()

setId(id): void

Defined in: src/ax/dsp/program.ts:139

Parameters

ParameterType
idstring

Returns

void

Inherited from

AxGen.setId


setParentId()

setParentId(parentId): void

Defined in: src/ax/dsp/program.ts:146

Parameters

ParameterType
parentIdstring

Returns

void

Inherited from

AxGen.setParentId

> AxDBBase

Defined in: src/ax/db/base.ts:22

Extended by

Implements

Constructors

new AxDBBase()

new AxDBBase(__namedParameters): AxDBBase

Defined in: src/ax/db/base.ts:44

Parameters

ParameterType
__namedParametersReadonly<AxDBBaseArgs & object>

Returns

AxDBBase

Properties

_batchUpsert()?

optional _batchUpsert: (batchReq, update?, options?) => Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:33

Parameters

ParameterType
batchReqreadonly AxDBUpsertRequest[]
update?boolean
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBUpsertResponse>


_query()?

optional _query: (req, options?) => Promise<AxDBQueryResponse>

Defined in: src/ax/db/base.ts:39

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBQueryResponse>


_upsert()?

optional _upsert: (req, update?, options?) => Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:27

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
update?boolean
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBUpsertResponse>

Methods

batchUpsert()

batchUpsert(req, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:86

Parameters

ParameterType
reqreadonly AxDBUpsertRequest[]
update?boolean

Returns

Promise<AxDBUpsertResponse>

Implementation of

AxDBService.batchUpsert


query()

query(req): Promise<AxDBQueryResponse>

Defined in: src/ax/db/base.ts:124

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>

Returns

Promise<AxDBQueryResponse>

Implementation of

AxDBService.query


upsert()

upsert(req, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:54

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
update?boolean

Returns

Promise<AxDBUpsertResponse>

Implementation of

AxDBService.upsert

> AxDB

Defined in: src/ax/db/wrap.ts:19

Implements

Constructors

new AxDB()

new AxDB(args): AxDB

Defined in: src/ax/db/wrap.ts:21

Parameters

ParameterType
argsReadonly<AxDBArgs>

Returns

AxDB

Methods

batchUpsert()

batchUpsert(batchReq, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/wrap.ts:46

Parameters

ParameterType
batchReqreadonly AxDBUpsertRequest[]
update?boolean

Returns

Promise<AxDBUpsertResponse>

Implementation of

AxDBService.batchUpsert


query()

query(req): Promise<AxDBQueryResponse>

Defined in: src/ax/db/wrap.ts:53

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>

Returns

Promise<AxDBQueryResponse>

Implementation of

AxDBService.query


upsert()

upsert(req, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/wrap.ts:39

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
update?boolean

Returns

Promise<AxDBUpsertResponse>

Implementation of

AxDBService.upsert

> AxDBCloudflare

Defined in: src/ax/db/cloudflare.ts:44

Cloudflare: DB Service

Extends

Constructors

new AxDBCloudflare()

new AxDBCloudflare(__namedParameters): AxDBCloudflare

Defined in: src/ax/db/cloudflare.ts:48

Parameters

ParameterType
__namedParametersReadonly<Omit<AxDBCloudflareArgs, "name">>

Returns

AxDBCloudflare

Overrides

AxDBBase.constructor

Properties

_batchUpsert()?

optional _batchUpsert: (batchReq, update?, options?) => Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:33

Parameters

ParameterType
batchReqreadonly AxDBUpsertRequest[]
update?boolean
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBUpsertResponse>

Inherited from

AxDBBase._batchUpsert


_query()?

optional _query: (req, options?) => Promise<AxDBQueryResponse>

Defined in: src/ax/db/base.ts:39

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBQueryResponse>

Inherited from

AxDBBase._query

Methods

_upsert()

_upsert(req, _update?, options?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/cloudflare.ts:62

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
_update?boolean
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBUpsertResponse>

Overrides

AxDBBase._upsert


batchUpsert()

batchUpsert(batchReq, update?, options?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/cloudflare.ts:98

Parameters

ParameterType
batchReqreadonly AxDBUpsertRequest[]
update?boolean
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBUpsertResponse>

Overrides

AxDBBase.batchUpsert


query()

query(req, options?): Promise<AxDBQueryResponse>

Defined in: src/ax/db/cloudflare.ts:147

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBQueryResponse>

Overrides

AxDBBase.query


upsert()

upsert(req, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:54

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
update?boolean

Returns

Promise<AxDBUpsertResponse>

Inherited from

AxDBBase.upsert

> AxDBManager

Defined in: src/ax/docs/manager.ts:33

Constructors

new AxDBManager()

new AxDBManager(__namedParameters): AxDBManager

Defined in: src/ax/docs/manager.ts:40

Parameters

ParameterType
__namedParametersReadonly<AxDBManagerArgs>

Returns

AxDBManager

Methods

insert()

insert(text, options?): Promise<void>

Defined in: src/ax/docs/manager.ts:53

Parameters

ParameterType
textReadonly<string | string[]>
options?Readonly<{ batchSize: number; maxWordsPerChunk: number; minWordsPerChunk: number; }>

Returns

Promise<void>


query()

query(query, __namedParameters): Promise<AxDBMatch[][]>

Defined in: src/ax/docs/manager.ts:109

Parameters

ParameterType
queryReadonly<string | number | string[] | number[]>
__namedParametersundefined | Readonly<{ topPercent: number; }>

Returns

Promise<AxDBMatch[][]>

> AxDBMemory

Defined in: src/ax/db/memory.ts:20

MemoryDB: DB Service

Extends

Constructors

new AxDBMemory()

new AxDBMemory(__namedParameters): AxDBMemory

Defined in: src/ax/db/memory.ts:23

Parameters

ParameterType
__namedParametersReadonly<Omit<AxDBMemoryArgs, "name">>

Returns

AxDBMemory

Overrides

AxDBBase.constructor

Methods

_batchUpsert()

_batchUpsert(batchReq, update?, _options?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/memory.ts:50

Parameters

ParameterType
batchReqreadonly AxDBUpsertRequest[]
update?boolean
_options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBUpsertResponse>

Overrides

AxDBBase._batchUpsert


_query()

_query(req, _options?): Promise<AxDBQueryResponse>

Defined in: src/ax/db/memory.ts:65

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>
_options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBQueryResponse>

Overrides

AxDBBase._query


_upsert()

_upsert(req, _update?, _options?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/memory.ts:28

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
_update?boolean
_options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBUpsertResponse>

Overrides

AxDBBase._upsert


batchUpsert()

batchUpsert(req, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:86

Parameters

ParameterType
reqreadonly AxDBUpsertRequest[]
update?boolean

Returns

Promise<AxDBUpsertResponse>

Inherited from

AxDBBase.batchUpsert


clearDB()

clearDB(): void

Defined in: src/ax/db/memory.ts:100

Returns

void


getDB()

getDB(): AxDBState

Defined in: src/ax/db/memory.ts:92

Returns

AxDBState


query()

query(req): Promise<AxDBQueryResponse>

Defined in: src/ax/db/base.ts:124

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>

Returns

Promise<AxDBQueryResponse>

Inherited from

AxDBBase.query


setDB()

setDB(state): void

Defined in: src/ax/db/memory.ts:96

Parameters

ParameterType
stateAxDBState

Returns

void


upsert()

upsert(req, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:54

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
update?boolean

Returns

Promise<AxDBUpsertResponse>

Inherited from

AxDBBase.upsert

> AxDBPinecone

Defined in: src/ax/db/pinecone.ts:58

Pinecone: DB Service

Extends

Constructors

new AxDBPinecone()

new AxDBPinecone(__namedParameters): AxDBPinecone

Defined in: src/ax/db/pinecone.ts:62

Parameters

ParameterType
__namedParametersReadonly<Omit<AxDBPineconeArgs, "name">>

Returns

AxDBPinecone

Overrides

AxDBBase.constructor

Properties

_query()?

optional _query: (req, options?) => Promise<AxDBQueryResponse>

Defined in: src/ax/db/base.ts:39

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBQueryResponse>

Inherited from

AxDBBase._query

Methods

_batchUpsert()

_batchUpsert(batchReq, _update?, options?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/pinecone.ts:85

Parameters

ParameterType
batchReqreadonly AxDBUpsertRequest[]
_update?boolean
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBUpsertResponse>

Overrides

AxDBBase._batchUpsert


_upsert()

_upsert(req, update?, options?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/pinecone.ts:76

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
update?boolean
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBUpsertResponse>

Overrides

AxDBBase._upsert


batchUpsert()

batchUpsert(req, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:86

Parameters

ParameterType
reqreadonly AxDBUpsertRequest[]
update?boolean

Returns

Promise<AxDBUpsertResponse>

Inherited from

AxDBBase.batchUpsert


query()

query(req, options?): Promise<AxDBQueryResponse>

Defined in: src/ax/db/pinecone.ts:111

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBQueryResponse>

Overrides

AxDBBase.query


upsert()

upsert(req, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:54

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
update?boolean

Returns

Promise<AxDBUpsertResponse>

Inherited from

AxDBBase.upsert

> AxDBWeaviate

Defined in: src/ax/db/weaviate.ts:39

Weaviate: DB Service

Extends

Constructors

new AxDBWeaviate()

new AxDBWeaviate(__namedParameters): AxDBWeaviate

Defined in: src/ax/db/weaviate.ts:43

Parameters

ParameterType
__namedParametersReadonly<Omit<AxDBWeaviateArgs, "name">>

Returns

AxDBWeaviate

Overrides

AxDBBase.constructor

Methods

_batchUpsert()

_batchUpsert(batchReq, update?, options?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/weaviate.ts:93

Parameters

ParameterType
batchReqreadonly AxDBUpsertRequest[]
update?boolean
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBUpsertResponse>

Overrides

AxDBBase._batchUpsert


_query()

_query(req, options?): Promise<AxDBQueryResponse>

Defined in: src/ax/db/weaviate.ts:138

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBQueryResponse>

Overrides

AxDBBase._query


_upsert()

_upsert(req, update?, options?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/weaviate.ts:57

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
update?boolean
options?Readonly<AxDBBaseOpOptions>

Returns

Promise<AxDBUpsertResponse>

Overrides

AxDBBase._upsert


batchUpsert()

batchUpsert(req, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:86

Parameters

ParameterType
reqreadonly AxDBUpsertRequest[]
update?boolean

Returns

Promise<AxDBUpsertResponse>

Inherited from

AxDBBase.batchUpsert


query()

query(req): Promise<AxDBQueryResponse>

Defined in: src/ax/db/base.ts:124

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>

Returns

Promise<AxDBQueryResponse>

Inherited from

AxDBBase.query


upsert()

upsert(req, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/base.ts:54

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
update?boolean

Returns

Promise<AxDBUpsertResponse>

Inherited from

AxDBBase.upsert

> AxDefaultQueryRewriter

Defined in: src/ax/docs/rewriter.ts:8

Extends

Constructors

new AxDefaultQueryRewriter()

new AxDefaultQueryRewriter(options?): AxDefaultQueryRewriter

Defined in: src/ax/docs/rewriter.ts:9

Parameters

ParameterType
options?Readonly<AxGenOptions>

Returns

AxDefaultQueryRewriter

Overrides

AxGen.constructor

Methods

addAssert()

addAssert(fn, message?, optional?): void

Defined in: src/ax/dsp/generate.ts:115

Parameters

ParameterType
fn(values) => undefined | boolean
message?string
optional?boolean

Returns

void

Inherited from

AxGen.addAssert


addStreamingAssert()

addStreamingAssert(fieldName, fn, message?, optional?): void

Defined in: src/ax/dsp/generate.ts:123

Parameters

ParameterType
fieldNamestring
fn(content, done?) => undefined | boolean
message?string
optional?boolean

Returns

void

Inherited from

AxGen.addStreamingAssert


forward()

forward(ai, values, options?): Promise<AxRewriteOut>

Defined in: src/ax/dsp/generate.ts:453

Parameters

ParameterType
aiReadonly<AxAIService>
valuesAxRewriteIn
options?Readonly<AxProgramForwardOptions>

Returns

Promise<AxRewriteOut>

Inherited from

AxGen.forward


getSignature()

getSignature(): AxSignature

Defined in: src/ax/dsp/program.ts:117

Returns

AxSignature

Inherited from

AxGen.getSignature


getTraces()

getTraces(): AxProgramTrace[]

Defined in: src/ax/dsp/program.ts:193

Returns

AxProgramTrace[]

Inherited from

AxGen.getTraces


getUsage()

getUsage(): AxTokenUsage & object[]

Defined in: src/ax/dsp/program.ts:207

Returns

AxTokenUsage & object[]

Inherited from

AxGen.getUsage


register()

register(prog): void

Defined in: src/ax/dsp/program.ts:121

Parameters

ParameterType
progReadonly<AxTunable & AxUsable>

Returns

void

Inherited from

AxGen.register


resetUsage()

resetUsage(): void

Defined in: src/ax/dsp/program.ts:217

Returns

void

Inherited from

AxGen.resetUsage


setDemos()

setDemos(demos): void

Defined in: src/ax/dsp/program.ts:224

Parameters

ParameterType
demosreadonly AxProgramDemos[]

Returns

void

Inherited from

AxGen.setDemos


setExamples()

setExamples(examples): void

Defined in: src/ax/dsp/program.ts:152

Parameters

ParameterType
examplesReadonly<AxProgramExamples>

Returns

void

Inherited from

AxGen.setExamples


setId()

setId(id): void

Defined in: src/ax/dsp/program.ts:139

Parameters

ParameterType
idstring

Returns

void

Inherited from

AxGen.setId


setParentId()

setParentId(parentId): void

Defined in: src/ax/dsp/program.ts:146

Parameters

ParameterType
parentIdstring

Returns

void

Inherited from

AxGen.setParentId

> AxDefaultResultReranker

Defined in: src/ax/docs/reranker.ts:8

Extends

Constructors

new AxDefaultResultReranker()

new AxDefaultResultReranker(options?): AxDefaultResultReranker

Defined in: src/ax/docs/reranker.ts:12

Parameters

ParameterType
options?Readonly<AxGenOptions>

Returns

AxDefaultResultReranker

Overrides

AxGen.constructor

Methods

addAssert()

addAssert(fn, message?, optional?): void

Defined in: src/ax/dsp/generate.ts:115

Parameters

ParameterType
fn(values) => undefined | boolean
message?string
optional?boolean

Returns

void

Inherited from

AxGen.addAssert


addStreamingAssert()

addStreamingAssert(fieldName, fn, message?, optional?): void

Defined in: src/ax/dsp/generate.ts:123

Parameters

ParameterType
fieldNamestring
fn(content, done?) => undefined | boolean
message?string
optional?boolean

Returns

void

Inherited from

AxGen.addStreamingAssert


forward()

forward(ai, input, options?): Promise<AxRerankerOut>

Defined in: src/ax/docs/reranker.ts:19

Parameters

ParameterType
aiReadonly<AxAIService>
inputReadonly<AxRerankerIn>
options?Readonly<AxProgramForwardOptions>

Returns

Promise<AxRerankerOut>

Overrides

AxGen.forward


getSignature()

getSignature(): AxSignature

Defined in: src/ax/dsp/program.ts:117

Returns

AxSignature

Inherited from

AxGen.getSignature


getTraces()

getTraces(): AxProgramTrace[]

Defined in: src/ax/dsp/program.ts:193

Returns

AxProgramTrace[]

Inherited from

AxGen.getTraces


getUsage()

getUsage(): AxTokenUsage & object[]

Defined in: src/ax/dsp/program.ts:207

Returns

AxTokenUsage & object[]

Inherited from

AxGen.getUsage


register()

register(prog): void

Defined in: src/ax/dsp/program.ts:121

Parameters

ParameterType
progReadonly<AxTunable & AxUsable>

Returns

void

Inherited from

AxGen.register


resetUsage()

resetUsage(): void

Defined in: src/ax/dsp/program.ts:217

Returns

void

Inherited from

AxGen.resetUsage


setDemos()

setDemos(demos): void

Defined in: src/ax/dsp/program.ts:224

Parameters

ParameterType
demosreadonly AxProgramDemos[]

Returns

void

Inherited from

AxGen.setDemos


setExamples()

setExamples(examples): void

Defined in: src/ax/dsp/program.ts:152

Parameters

ParameterType
examplesReadonly<AxProgramExamples>

Returns

void

Inherited from

AxGen.setExamples


setId()

setId(id): void

Defined in: src/ax/dsp/program.ts:139

Parameters

ParameterType
idstring

Returns

void

Inherited from

AxGen.setId


setParentId()

setParentId(parentId): void

Defined in: src/ax/dsp/program.ts:146

Parameters

ParameterType
parentIdstring

Returns

void

Inherited from

AxGen.setParentId

> AxDockerSession

Defined in: src/ax/funcs/docker.ts:56

Constructors

new AxDockerSession()

new AxDockerSession(apiUrl): AxDockerSession

Defined in: src/ax/funcs/docker.ts:60

Parameters

ParameterTypeDefault value
apiUrlstring'http://localhost:2375'

Returns

AxDockerSession

Methods

connectToContainer()

connectToContainer(containerId): Promise<void>

Defined in: src/ax/funcs/docker.ts:186

Parameters

ParameterType
containerIdstring

Returns

Promise<void>


createContainer()

createContainer(__namedParameters): Promise<{ Id: string; }>

Defined in: src/ax/funcs/docker.ts:80

Parameters

ParameterType
__namedParametersReadonly<{ doNotPullImage: boolean; imageName: string; tag: string; volumes: object[]; }>

Returns

Promise<{ Id: string; }>


executeCommand()

executeCommand(command): Promise<string>

Defined in: src/ax/funcs/docker.ts:274

Parameters

ParameterType
commandstring

Returns

Promise<string>


findOrCreateContainer()

findOrCreateContainer(__namedParameters): Promise<{ Id: string; isNew: boolean; }>

Defined in: src/ax/funcs/docker.ts:128

Parameters

ParameterType
__namedParametersReadonly<{ doNotPullImage: boolean; imageName: string; tag: string; volumes: object[]; }>

Returns

Promise<{ Id: string; isNew: boolean; }>


getContainerLogs()

getContainerLogs(): Promise<string>

Defined in: src/ax/funcs/docker.ts:263

Returns

Promise<string>


listContainers()

listContainers(all): Promise<AxDockerContainer[]>

Defined in: src/ax/funcs/docker.ts:256

Parameters

ParameterTypeDefault value
allbooleanfalse

Returns

Promise<AxDockerContainer[]>


pullImage()

pullImage(imageName): Promise<void>

Defined in: src/ax/funcs/docker.ts:64

Parameters

ParameterType
imageNamestring

Returns

Promise<void>


startContainer()

startContainer(): Promise<void>

Defined in: src/ax/funcs/docker.ts:169

Returns

Promise<void>


stopContainers()

stopContainers(__namedParameters): Promise<object[]>

Defined in: src/ax/funcs/docker.ts:198

Parameters

ParameterType
__namedParametersReadonly<{ remove: boolean; tag: string; timeout: number; }>

Returns

Promise<object[]>


toFunction()

toFunction(): AxFunction

Defined in: src/ax/funcs/docker.ts:373

Returns

AxFunction

> AxEmbeddingAdapter

Defined in: src/ax/funcs/embed.ts:7

Constructors

new AxEmbeddingAdapter()

new AxEmbeddingAdapter(__namedParameters): AxEmbeddingAdapter

Defined in: src/ax/funcs/embed.ts:19

Parameters

ParameterType
__namedParametersReadonly<{ ai: AxAIService; func: (args, extra?) => Promise<unknown>; info: Readonly<{ argumentDescription: string; description: string; name: string; }>; }>

Returns

AxEmbeddingAdapter

Methods

toFunction()

toFunction(): AxFunction

Defined in: src/ax/funcs/embed.ts:57

Returns

AxFunction

> AxFunctionProcessor

Defined in: src/ax/dsp/functions.ts:24

Constructors

new AxFunctionProcessor()

new AxFunctionProcessor(funcList): AxFunctionProcessor

Defined in: src/ax/dsp/functions.ts:27

Parameters

ParameterType
funcListreadonly AxFunction[]

Returns

AxFunctionProcessor

Methods

execute()

execute(func, options?): Promise<AxFunctionExec>

Defined in: src/ax/dsp/functions.ts:73

Parameters

ParameterType
funcReadonly<AxChatResponseFunctionCall>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxFunctionExec>

> AxGen

Defined in: src/ax/dsp/generate.ts:84

Extends

Extended by

Type Parameters

Type ParameterDefault type
IN extends AxGenInAxGenIn
OUT extends AxGenerateResult<AxGenOut>AxGenerateResult<AxGenOut>

Constructors

new AxGen()

new AxGen<IN, OUT>(signature, options?): AxGen<IN, OUT>

Defined in: src/ax/dsp/generate.ts:95

Parameters

ParameterType
signatureReadonly<string | AxSignature>
options?Readonly<AxGenOptions>

Returns

AxGen<IN, OUT>

Overrides

AxProgramWithSignature.constructor

Methods

addAssert()

addAssert(fn, message?, optional?): void

Defined in: src/ax/dsp/generate.ts:115

Parameters

ParameterType
fn(values) => undefined | boolean
message?string
optional?boolean

Returns

void


addStreamingAssert()

addStreamingAssert(fieldName, fn, message?, optional?): void

Defined in: src/ax/dsp/generate.ts:123

Parameters

ParameterType
fieldNamestring
fn(content, done?) => undefined | boolean
message?string
optional?boolean

Returns

void


forward()

forward(ai, values, options?): Promise<OUT>

Defined in: src/ax/dsp/generate.ts:453

Parameters

ParameterType
aiReadonly<AxAIService>
valuesIN
options?Readonly<AxProgramForwardOptions>

Returns

Promise<OUT>

Overrides

AxProgramWithSignature.forward


getSignature()

getSignature(): AxSignature

Defined in: src/ax/dsp/program.ts:117

Returns

AxSignature

Inherited from

AxProgramWithSignature.getSignature


getTraces()

getTraces(): AxProgramTrace[]

Defined in: src/ax/dsp/program.ts:193

Returns

AxProgramTrace[]

Inherited from

AxProgramWithSignature.getTraces


getUsage()

getUsage(): AxTokenUsage & object[]

Defined in: src/ax/dsp/program.ts:207

Returns

AxTokenUsage & object[]

Inherited from

AxProgramWithSignature.getUsage


register()

register(prog): void

Defined in: src/ax/dsp/program.ts:121

Parameters

ParameterType
progReadonly<AxTunable & AxUsable>

Returns

void

Inherited from

AxProgramWithSignature.register


resetUsage()

resetUsage(): void

Defined in: src/ax/dsp/program.ts:217

Returns

void

Inherited from

AxProgramWithSignature.resetUsage


setDemos()

setDemos(demos): void

Defined in: src/ax/dsp/program.ts:224

Parameters

ParameterType
demosreadonly AxProgramDemos[]

Returns

void

Inherited from

AxProgramWithSignature.setDemos


setExamples()

setExamples(examples): void

Defined in: src/ax/dsp/program.ts:152

Parameters

ParameterType
examplesReadonly<AxProgramExamples>

Returns

void

Inherited from

AxProgramWithSignature.setExamples


setId()

setId(id): void

Defined in: src/ax/dsp/program.ts:139

Parameters

ParameterType
idstring

Returns

void

Inherited from

AxProgramWithSignature.setId


setParentId()

setParentId(parentId): void

Defined in: src/ax/dsp/program.ts:146

Parameters

ParameterType
parentIdstring

Returns

void

Inherited from

AxProgramWithSignature.setParentId

> AxHFDataLoader

Defined in: src/ax/dsp/loader.ts:5

Constructors

new AxHFDataLoader()

new AxHFDataLoader(__namedParameters): AxHFDataLoader

Defined in: src/ax/dsp/loader.ts:14

Parameters

ParameterType
__namedParametersReadonly<{ config: string; dataset: string; options: Readonly<{ length: number; offset: number; }>; split: string; }>

Returns

AxHFDataLoader

Methods

getData()

getData(): AxDataRow[]

Defined in: src/ax/dsp/loader.ts:67

Returns

AxDataRow[]


getRows()

getRows<T>(__namedParameters): Promise<T[]>

Defined in: src/ax/dsp/loader.ts:71

Type Parameters

Type Parameter
T

Parameters

ParameterType
__namedParametersReadonly<{ count: number; fields: readonly string[]; renameMap: Record<string, string>; }>

Returns

Promise<T[]>


loadData()

loadData(): Promise<AxDataRow[]>

Defined in: src/ax/dsp/loader.ts:51

Returns

Promise<AxDataRow[]>


setData()

setData(rows): void

Defined in: src/ax/dsp/loader.ts:63

Parameters

ParameterType
rowsAxDataRow[]

Returns

void

> AxInstanceRegistry

Defined in: src/ax/dsp/registry.ts:1

Type Parameters

Type Parameter
T

Constructors

new AxInstanceRegistry()

new AxInstanceRegistry<T>(): AxInstanceRegistry<T>

Defined in: src/ax/dsp/registry.ts:4

Returns

AxInstanceRegistry<T>

Methods

[iterator]()

[iterator](): Generator<T, void>

Defined in: src/ax/dsp/registry.ts:12

Returns

Generator<T, void>


register()

register(instance): void

Defined in: src/ax/dsp/registry.ts:8

Parameters

ParameterType
instanceT

Returns

void

> AxJSInterpreter

Defined in: src/ax/funcs/code.ts:29

Constructors

new AxJSInterpreter()

new AxJSInterpreter(__namedParameters): AxJSInterpreter

Defined in: src/ax/funcs/code.ts:32

Parameters

ParameterType
__namedParametersundefined | Readonly<{ permissions: readonly AxJSInterpreterPermission[]; }>

Returns

AxJSInterpreter

Methods

toFunction()

toFunction(): AxFunction

Defined in: src/ax/funcs/code.ts:67

Returns

AxFunction

> AxMemory

Defined in: src/ax/mem/memory.ts:8

Implements

Constructors

new AxMemory()

new AxMemory(limit): AxMemory

Defined in: src/ax/mem/memory.ts:13

Parameters

ParameterTypeDefault value
limitnumber50

Returns

AxMemory

Methods

add()

add(value, sessionId?): void

Defined in: src/ax/mem/memory.ts:20

Parameters

ParameterType
valueReadonly<Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }> | Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: … | … | …; text: string; type: "text"; } | { cache: … | … | …; details: … | … | … | …; image: string; mimeType: string; type: "image"; } | { cache: … | … | …; data: string; format: … | …; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>[]>
sessionId?string

Returns

void

Implementation of

AxAIMemory.add


addResult()

addResult(__namedParameters, sessionId?): void

Defined in: src/ax/mem/memory.ts:41

Parameters

ParameterType
__namedParametersReadonly<AxChatResponseResult>
sessionId?string

Returns

void

Implementation of

AxAIMemory.addResult


getLast()

getLast(sessionId?): undefined | Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>

Defined in: src/ax/mem/memory.ts:79

Parameters

ParameterType
sessionId?string

Returns

undefined | Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>

Implementation of

AxAIMemory.getLast


history()

history(sessionId?): Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>[]

Defined in: src/ax/mem/memory.ts:75

Parameters

ParameterType
sessionId?string

Returns

Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>[]

Implementation of

AxAIMemory.history


reset()

reset(sessionId?): void

Defined in: src/ax/mem/memory.ts:84

Parameters

ParameterType
sessionId?string

Returns

void

Implementation of

AxAIMemory.reset


updateResult()

updateResult(__namedParameters, sessionId?): void

Defined in: src/ax/mem/memory.ts:51

Parameters

ParameterType
__namedParametersReadonly<AxChatResponseResult>
sessionId?string

Returns

void

Implementation of

AxAIMemory.updateResult

> AxProgram

Defined in: src/ax/dsp/program.ts:236

Type Parameters

Type Parameter
IN extends AxGenIn
OUT extends AxGenOut

Implements

Constructors

new AxProgram()

new AxProgram<IN, OUT>(): AxProgram<IN, OUT>

Defined in: src/ax/dsp/program.ts:245

Returns

AxProgram<IN, OUT>

Methods

forward()

forward(_ai, _values, _options?): Promise<OUT>

Defined in: src/ax/dsp/program.ts:257

Parameters

ParameterType
_aiReadonly<AxAIService>
_valuesIN
_options?Readonly<AxProgramForwardOptions>

Returns

Promise<OUT>


getTraces()

getTraces(): AxProgramTrace[]

Defined in: src/ax/dsp/program.ts:291

Returns

AxProgramTrace[]

Implementation of

AxTunable.getTraces


getUsage()

getUsage(): AxTokenUsage & object[]

Defined in: src/ax/dsp/program.ts:305

Returns

AxTokenUsage & object[]

Implementation of

AxUsable.getUsage


register()

register(prog): void

Defined in: src/ax/dsp/program.ts:250

Parameters

ParameterType
progReadonly<AxTunable & AxUsable>

Returns

void


resetUsage()

resetUsage(): void

Defined in: src/ax/dsp/program.ts:315

Returns

void

Implementation of

AxUsable.resetUsage


setDemos()

setDemos(demos): void

Defined in: src/ax/dsp/program.ts:322

Parameters

ParameterType
demosreadonly AxProgramDemos[]

Returns

void

Implementation of

AxTunable.setDemos


setExamples()

setExamples(examples): void

Defined in: src/ax/dsp/program.ts:281

Parameters

ParameterType
examplesReadonly<AxProgramExamples>

Returns

void

Implementation of

AxTunable.setExamples


setId()

setId(id): void

Defined in: src/ax/dsp/program.ts:268

Parameters

ParameterType
idstring

Returns

void

Implementation of

AxTunable.setId


setParentId()

setParentId(parentId): void

Defined in: src/ax/dsp/program.ts:275

Parameters

ParameterType
parentIdstring

Returns

void

Implementation of

AxTunable.setParentId

> AxProgramWithSignature

Defined in: src/ax/dsp/program.ts:89

Extended by

Type Parameters

Type Parameter
IN extends AxGenIn
OUT extends AxGenOut

Implements

Constructors

new AxProgramWithSignature()

new AxProgramWithSignature<IN, OUT>(signature, options?): AxProgramWithSignature<IN, OUT>

Defined in: src/ax/dsp/program.ts:103

Parameters

ParameterType
signatureReadonly<string | AxSignature>
options?Readonly<AxProgramWithSignatureOptions>

Returns

AxProgramWithSignature<IN, OUT>

Methods

forward()

forward(_ai, _values, _options?): Promise<OUT>

Defined in: src/ax/dsp/program.ts:128

Parameters

ParameterType
_aiReadonly<AxAIService>
_valuesIN
_options?Readonly<AxProgramForwardOptions>

Returns

Promise<OUT>


getSignature()

getSignature(): AxSignature

Defined in: src/ax/dsp/program.ts:117

Returns

AxSignature


getTraces()

getTraces(): AxProgramTrace[]

Defined in: src/ax/dsp/program.ts:193

Returns

AxProgramTrace[]

Implementation of

AxTunable.getTraces


getUsage()

getUsage(): AxTokenUsage & object[]

Defined in: src/ax/dsp/program.ts:207

Returns

AxTokenUsage & object[]

Implementation of

AxUsable.getUsage


register()

register(prog): void

Defined in: src/ax/dsp/program.ts:121

Parameters

ParameterType
progReadonly<AxTunable & AxUsable>

Returns

void


resetUsage()

resetUsage(): void

Defined in: src/ax/dsp/program.ts:217

Returns

void

Implementation of

AxUsable.resetUsage


setDemos()

setDemos(demos): void

Defined in: src/ax/dsp/program.ts:224

Parameters

ParameterType
demosreadonly AxProgramDemos[]

Returns

void

Implementation of

AxTunable.setDemos


setExamples()

setExamples(examples): void

Defined in: src/ax/dsp/program.ts:152

Parameters

ParameterType
examplesReadonly<AxProgramExamples>

Returns

void

Implementation of

AxTunable.setExamples


setId()

setId(id): void

Defined in: src/ax/dsp/program.ts:139

Parameters

ParameterType
idstring

Returns

void

Implementation of

AxTunable.setId


setParentId()

setParentId(parentId): void

Defined in: src/ax/dsp/program.ts:146

Parameters

ParameterType
parentIdstring

Returns

void

Implementation of

AxTunable.setParentId

> AxPromptTemplate

Defined in: src/ax/dsp/prompt.ts:32

Constructors

new AxPromptTemplate()

new AxPromptTemplate(sig, functions?, fieldTemplates?): AxPromptTemplate

Defined in: src/ax/dsp/prompt.ts:37

Parameters

ParameterType
sigReadonly<AxSignature>
functions?Readonly<AxInputFunctionType>
fieldTemplates?Record<string, AxFieldTemplateFn>

Returns

AxPromptTemplate

Methods

render()

render<T>(values, __namedParameters): Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>[]

Defined in: src/ax/dsp/prompt.ts:94

Type Parameters

Type Parameter
T extends Record<string, AxFieldValue>

Parameters

ParameterType
valuesT
__namedParametersReadonly<{ demos: Record<string, AxFieldValue>[]; examples: Record<string, AxFieldValue>[]; skipSystemPrompt: boolean; }>

Returns

Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>[]


renderExtraFields()

renderExtraFields(extraFields): string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]

Defined in: src/ax/dsp/prompt.ts:159

Parameters

ParameterType
extraFieldsreadonly AxIField[]

Returns

string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]

> AxRAG

Defined in: src/ax/prompts/rag.ts:12

Extends

  • AxChainOfThought<{ context: string[]; question: string; }, { answer: string; }>

Constructors

new AxRAG()

new AxRAG(queryFn, options): AxRAG

Defined in: src/ax/prompts/rag.ts:23

Parameters

ParameterType
queryFn(query) => Promise<string>
optionsReadonly<AxGenOptions & object>

Returns

AxRAG

Overrides

AxChainOfThought.constructor

Methods

addAssert()

addAssert(fn, message?, optional?): void

Defined in: src/ax/dsp/generate.ts:115

Parameters

ParameterType
fn(values) => undefined | boolean
message?string
optional?boolean

Returns

void

Inherited from

AxChainOfThought.addAssert


addStreamingAssert()

addStreamingAssert(fieldName, fn, message?, optional?): void

Defined in: src/ax/dsp/generate.ts:123

Parameters

ParameterType
fieldNamestring
fn(content, done?) => undefined | boolean
message?string
optional?boolean

Returns

void

Inherited from

AxChainOfThought.addStreamingAssert


forward()

forward(ai, __namedParameters, options?): Promise<{ answer: string; reason: string; }>

Defined in: src/ax/prompts/rag.ts:44

Parameters

ParameterType
aiReadonly<AxAIService>
__namedParametersReadonly<{ question: string; }>
options?Readonly<AxProgramForwardOptions>

Returns

Promise<{ answer: string; reason: string; }>

Overrides

AxChainOfThought.forward


getSignature()

getSignature(): AxSignature

Defined in: src/ax/dsp/program.ts:117

Returns

AxSignature

Inherited from

AxChainOfThought.getSignature


getTraces()

getTraces(): AxProgramTrace[]

Defined in: src/ax/dsp/program.ts:193

Returns

AxProgramTrace[]

Inherited from

AxChainOfThought.getTraces


getUsage()

getUsage(): AxTokenUsage & object[]

Defined in: src/ax/dsp/program.ts:207

Returns

AxTokenUsage & object[]

Inherited from

AxChainOfThought.getUsage


register()

register(prog): void

Defined in: src/ax/dsp/program.ts:121

Parameters

ParameterType
progReadonly<AxTunable & AxUsable>

Returns

void

Inherited from

AxChainOfThought.register


resetUsage()

resetUsage(): void

Defined in: src/ax/dsp/program.ts:217

Returns

void

Inherited from

AxChainOfThought.resetUsage


setDemos()

setDemos(demos): void

Defined in: src/ax/dsp/program.ts:224

Parameters

ParameterType
demosreadonly AxProgramDemos[]

Returns

void

Inherited from

AxChainOfThought.setDemos


setExamples()

setExamples(examples): void

Defined in: src/ax/dsp/program.ts:152

Parameters

ParameterType
examplesReadonly<AxProgramExamples>

Returns

void

Inherited from

AxChainOfThought.setExamples


setId()

setId(id): void

Defined in: src/ax/dsp/program.ts:139

Parameters

ParameterType
idstring

Returns

void

Inherited from

AxChainOfThought.setId


setParentId()

setParentId(parentId): void

Defined in: src/ax/dsp/program.ts:146

Parameters

ParameterType
parentIdstring

Returns

void

Inherited from

AxChainOfThought.setParentId

> AxRateLimiterTokenUsage

Defined in: src/ax/util/rate-limit.ts:9

Constructors

new AxRateLimiterTokenUsage()

new AxRateLimiterTokenUsage(maxTokens, refillRate, options?): AxRateLimiterTokenUsage

Defined in: src/ax/util/rate-limit.ts:16

Parameters

ParameterType
maxTokensnumber
refillRatenumber
options?Readonly<AxRateLimiterTokenUsageOptions>

Returns

AxRateLimiterTokenUsage

Methods

acquire()

acquire(tokens): Promise<void>

Defined in: src/ax/util/rate-limit.ts:56

Parameters

ParameterType
tokensnumber

Returns

Promise<void>

> AxRoute

Defined in: src/ax/dsp/router.ts:11

Constructors

new AxRoute()

new AxRoute(name, context): AxRoute

Defined in: src/ax/dsp/router.ts:15

Parameters

ParameterType
namestring
contextreadonly string[]

Returns

AxRoute

Methods

getContext()

getContext(): readonly string[]

Defined in: src/ax/dsp/router.ts:24

Returns

readonly string[]


getName()

getName(): string

Defined in: src/ax/dsp/router.ts:20

Returns

string

> AxRouter

Defined in: src/ax/dsp/router.ts:29

Constructors

new AxRouter()

new AxRouter(ai): AxRouter

Defined in: src/ax/dsp/router.ts:35

Parameters

ParameterType
aiAxAIService

Returns

AxRouter

Methods

forward()

forward(text, options?): Promise<string>

Defined in: src/ax/dsp/router.ts:59

Parameters

ParameterType
textstring
options?Readonly<AxRouterForwardOptions>

Returns

Promise<string>


getState()

getState(): undefined | AxDBState

Defined in: src/ax/dsp/router.ts:40

Returns

undefined | AxDBState


setOptions()

setOptions(options): void

Defined in: src/ax/dsp/router.ts:94

Parameters

ParameterType
optionsReadonly<{ debug: boolean; }>

Returns

void


setRoutes()

setRoutes(routes): Promise<void>

Defined in: src/ax/dsp/router.ts:48

Parameters

ParameterType
routesreadonly AxRoute[]

Returns

Promise<void>


setState()

setState(state): void

Defined in: src/ax/dsp/router.ts:44

Parameters

ParameterType
stateAxDBState

Returns

void

> AxSignature

Defined in: src/ax/dsp/sig.ts:35

Constructors

new AxSignature()

new AxSignature(signature?): AxSignature

Defined in: src/ax/dsp/sig.ts:43

Parameters

ParameterType
signature?Readonly<string | AxSignature>

Returns

AxSignature

Methods

addInputField()

addInputField(field): void

Defined in: src/ax/dsp/sig.ts:115

Parameters

ParameterType
fieldReadonly<AxField>

Returns

void


addOutputField()

addOutputField(field): void

Defined in: src/ax/dsp/sig.ts:120

Parameters

ParameterType
fieldReadonly<AxField>

Returns

void


getDescription()

getDescription(): undefined | string

Defined in: src/ax/dsp/sig.ts:137

Returns

undefined | string


getInputFields()

getInputFields(): readonly AxIField[]

Defined in: src/ax/dsp/sig.ts:135

Returns

readonly AxIField[]


getOutputFields()

getOutputFields(): readonly AxIField[]

Defined in: src/ax/dsp/sig.ts:136

Returns

readonly AxIField[]


hash()

hash(): string

Defined in: src/ax/dsp/sig.ts:207

Returns

string


setDescription()

setDescription(desc): void

Defined in: src/ax/dsp/sig.ts:110

Parameters

ParameterType
descstring

Returns

void


setInputFields()

setInputFields(fields): void

Defined in: src/ax/dsp/sig.ts:125

Parameters

ParameterType
fieldsreadonly AxField[]

Returns

void


setOutputFields()

setOutputFields(fields): void

Defined in: src/ax/dsp/sig.ts:130

Parameters

ParameterType
fieldsreadonly AxField[]

Returns

void


toJSONSchema()

toJSONSchema(): AxFunctionJSONSchema

Defined in: src/ax/dsp/sig.ts:145

Returns

AxFunctionJSONSchema


toString()

toString(): string

Defined in: src/ax/dsp/sig.ts:209

Returns

string

> AxTestPrompt

Defined in: src/ax/dsp/evaluate.ts:13

Type Parameters

Type ParameterDefault type
IN extends AxGenInAxGenIn
OUT extends AxGenOutAxGenOut

Constructors

new AxTestPrompt()

new AxTestPrompt<IN, OUT>(__namedParameters): AxTestPrompt<IN, OUT>

Defined in: src/ax/dsp/evaluate.ts:21

Parameters

ParameterType
__namedParametersReadonly<AxEvaluateArgs<IN, OUT>>

Returns

AxTestPrompt<IN, OUT>

Methods

run()

run(metricFn): Promise<void>

Defined in: src/ax/dsp/evaluate.ts:34

Parameters

ParameterType
metricFnAxMetricFn

Returns

Promise<void>

> AxValidationError

Defined in: src/ax/dsp/validate.ts:4

Extends

  • Error

Constructors

new AxValidationError()

new AxValidationError(__namedParameters): AxValidationError

Defined in: src/ax/dsp/validate.ts:8

Parameters

ParameterType
__namedParametersReadonly<{ field: AxField; message: string; value: string; }>

Returns

AxValidationError

Overrides

Error.constructor

Properties

cause?

optional cause: unknown

Defined in: node_modules/typescript/lib/lib.es2022.error.d.ts:26

Inherited from

Error.cause


message

message: string

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1077

Inherited from

Error.message


name

name: string

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1076

Inherited from

Error.name


stack?

optional stack: string

Defined in: node_modules/typescript/lib/lib.es5.d.ts:1078

Inherited from

Error.stack


prepareStackTrace()?

static optional prepareStackTrace: (err, stackTraces) => any

Defined in: node_modules/@types/node/globals.d.ts:143

Optional override for formatting stack traces

Parameters

ParameterType
errError
stackTracesCallSite[]

Returns

any

See

https://v8.dev/docs/stack-trace-api#customizing-stack-traces

Inherited from

Error.prepareStackTrace


stackTraceLimit

static stackTraceLimit: number

Defined in: node_modules/@types/node/globals.d.ts:145

Inherited from

Error.stackTraceLimit

Methods

getField()

getField(): AxField

Defined in: src/ax/dsp/validate.ts:24

Returns

AxField


getFixingInstructions()

getFixingInstructions(): object[]

Defined in: src/ax/dsp/validate.ts:27

Returns

object[]


getValue()

getValue(): string

Defined in: src/ax/dsp/validate.ts:25

Returns

string


captureStackTrace()

static captureStackTrace(targetObject, constructorOpt?): void

Defined in: node_modules/@types/node/globals.d.ts:136

Create .stack property on a target object

Parameters

ParameterType
targetObjectobject
constructorOpt?Function

Returns

void

Inherited from

Error.captureStackTrace

> AxAIAnthropicModel

Defined in: src/ax/ai/anthropic/types.ts:3

Enumeration Members

Claude21

Claude21: "claude-2.1"

Defined in: src/ax/ai/anthropic/types.ts:11


Claude35Haiku

Claude35Haiku: "claude-3-5-haiku-latest"

Defined in: src/ax/ai/anthropic/types.ts:5


Claude35Sonnet

Claude35Sonnet: "claude-3-5-sonnet-latest"

Defined in: src/ax/ai/anthropic/types.ts:4


Claude3Haiku

Claude3Haiku: "claude-3-haiku-20240307"

Defined in: src/ax/ai/anthropic/types.ts:9


Claude3Opus

Claude3Opus: "claude-3-opus-latest"

Defined in: src/ax/ai/anthropic/types.ts:7


Claude3Sonnet

Claude3Sonnet: "claude-3-sonnet-20240229"

Defined in: src/ax/ai/anthropic/types.ts:8


ClaudeInstant12

ClaudeInstant12: "claude-instant-1.2"

Defined in: src/ax/ai/anthropic/types.ts:12

> AxAICohereEmbedModel

Defined in: src/ax/ai/cohere/types.ts:16

Cohere: Models for use in embeddings

Enumeration Members

EmbedEnglishLightV30

EmbedEnglishLightV30: "embed-english-light-v3.0"

Defined in: src/ax/ai/cohere/types.ts:18


EmbedEnglishV30

EmbedEnglishV30: "embed-english-v3.0"

Defined in: src/ax/ai/cohere/types.ts:17


EmbedMultiLingualLightV30

EmbedMultiLingualLightV30: "embed-multilingual-light-v3.0"

Defined in: src/ax/ai/cohere/types.ts:20


EmbedMultiLingualV30

EmbedMultiLingualV30: "embed-multilingual-v3.0"

Defined in: src/ax/ai/cohere/types.ts:19

> AxAICohereModel

Defined in: src/ax/ai/cohere/types.ts:6

Cohere: Models for text generation

Enumeration Members

Command

Command: "command"

Defined in: src/ax/ai/cohere/types.ts:9


CommandLight

CommandLight: "command-light"

Defined in: src/ax/ai/cohere/types.ts:10


CommandR

CommandR: "command-r"

Defined in: src/ax/ai/cohere/types.ts:8


CommandRPlus

CommandRPlus: "command-r-plus"

Defined in: src/ax/ai/cohere/types.ts:7

> AxAIGoogleGeminiEmbedModel

Defined in: src/ax/ai/google-gemini/types.ts:12

Enumeration Members

TextEmbedding004

TextEmbedding004: "text-embedding-004"

Defined in: src/ax/ai/google-gemini/types.ts:13

> AxAIDeepSeekModel

Defined in: src/ax/ai/deepseek/types.ts:4

DeepSeek: Models for text generation

Enumeration Members

DeepSeekChat

DeepSeekChat: "deepseek-chat"

Defined in: src/ax/ai/deepseek/types.ts:5


DeepSeekCoder

DeepSeekCoder: "deepseek-coder"

Defined in: src/ax/ai/deepseek/types.ts:6

> AxAIGoogleGeminiModel

Defined in: src/ax/ai/google-gemini/types.ts:3

Enumeration Members

AQA

AQA: "aqa"

Defined in: src/ax/ai/google-gemini/types.ts:9


Gemini15Flash

Gemini15Flash: "gemini-1.5-flash"

Defined in: src/ax/ai/google-gemini/types.ts:5


Gemini15Flash8B

Gemini15Flash8B: "gemini-1.5-flash-8b"

Defined in: src/ax/ai/google-gemini/types.ts:6


Gemini15Pro

Gemini15Pro: "gemini-1.5-pro"

Defined in: src/ax/ai/google-gemini/types.ts:7


Gemini1Pro

Gemini1Pro: "gemini-1.0-pro"

Defined in: src/ax/ai/google-gemini/types.ts:4


Gemma2

Gemma2: "gemma-2-27b-it"

Defined in: src/ax/ai/google-gemini/types.ts:8

> AxAIGoogleGeminiSafetyCategory

Defined in: src/ax/ai/google-gemini/types.ts:16

Enumeration Members

HarmCategoryDangerousContent

HarmCategoryDangerousContent: "HARM_CATEGORY_DANGEROUS_CONTENT"

Defined in: src/ax/ai/google-gemini/types.ts:20


HarmCategoryHarassment

HarmCategoryHarassment: "HARM_CATEGORY_HARASSMENT"

Defined in: src/ax/ai/google-gemini/types.ts:17


HarmCategoryHateSpeech

HarmCategoryHateSpeech: "HARM_CATEGORY_HATE_SPEECH"

Defined in: src/ax/ai/google-gemini/types.ts:18


HarmCategorySexuallyExplicit

HarmCategorySexuallyExplicit: "HARM_CATEGORY_SEXUALLY_EXPLICIT"

Defined in: src/ax/ai/google-gemini/types.ts:19

> AxAIGoogleGeminiSafetyThreshold

Defined in: src/ax/ai/google-gemini/types.ts:23

Enumeration Members

BlockDefault

BlockDefault: "HARM_BLOCK_THRESHOLD_UNSPECIFIED"

Defined in: src/ax/ai/google-gemini/types.ts:28


BlockLowAndAbove

BlockLowAndAbove: "BLOCK_LOW_AND_ABOVE"

Defined in: src/ax/ai/google-gemini/types.ts:27


BlockMediumAndAbove

BlockMediumAndAbove: "BLOCK_MEDIUM_AND_ABOVE"

Defined in: src/ax/ai/google-gemini/types.ts:26


BlockNone

BlockNone: "BLOCK_NONE"

Defined in: src/ax/ai/google-gemini/types.ts:24


BlockOnlyHigh

BlockOnlyHigh: "BLOCK_ONLY_HIGH"

Defined in: src/ax/ai/google-gemini/types.ts:25

> AxAIGroqModel

Defined in: src/ax/ai/groq/types.ts:1

Enumeration Members

Gemma_7B

Gemma_7B: "gemma-7b-it"

Defined in: src/ax/ai/groq/types.ts:5


Llama3_70B

Llama3_70B: "llama3-70b-8192"

Defined in: src/ax/ai/groq/types.ts:3


Llama3_8B

Llama3_8B: "llama3-8b-8192"

Defined in: src/ax/ai/groq/types.ts:2


Mixtral_8x7B

Mixtral_8x7B: "mixtral-8x7b-32768"

Defined in: src/ax/ai/groq/types.ts:4

> AxAIHuggingFaceModel

Defined in: src/ax/ai/huggingface/types.ts:3

Enumeration Members

MetaLlama270BChatHF

MetaLlama270BChatHF: "meta-llama/Llama-2-70b-chat-hf"

Defined in: src/ax/ai/huggingface/types.ts:4

> AxAIMistralEmbedModels

Defined in: src/ax/ai/mistral/types.ts:14

Enumeration Members

MistralEmbed

MistralEmbed: "mistral-embed"

Defined in: src/ax/ai/mistral/types.ts:15

> AxAIMistralModel

Defined in: src/ax/ai/mistral/types.ts:3

Enumeration Members

Codestral

Codestral: "codestral-latest"

Defined in: src/ax/ai/mistral/types.ts:9


Mistral7B

Mistral7B: "open-mistral-7b"

Defined in: src/ax/ai/mistral/types.ts:4


Mistral8x7B

Mistral8x7B: "open-mixtral-8x7b"

Defined in: src/ax/ai/mistral/types.ts:5


MistralLarge

MistralLarge: "mistral-large-latest"

Defined in: src/ax/ai/mistral/types.ts:8


MistralNemo

MistralNemo: "mistral-nemo-latest"

Defined in: src/ax/ai/mistral/types.ts:7


MistralSmall

MistralSmall: "mistral-small-latest"

Defined in: src/ax/ai/mistral/types.ts:6


OpenCodestralMamba

OpenCodestralMamba: "open-codestral-mamba"

Defined in: src/ax/ai/mistral/types.ts:10


OpenMistralNemo

OpenMistralNemo: "open-mistral-nemo-latest"

Defined in: src/ax/ai/mistral/types.ts:11

> AxAIOpenAIEmbedModel

Defined in: src/ax/ai/openai/types.ts:18

Enumeration Members

TextEmbedding3Large

TextEmbedding3Large: "text-embedding-3-large"

Defined in: src/ax/ai/openai/types.ts:21


TextEmbedding3Small

TextEmbedding3Small: "text-embedding-3-small"

Defined in: src/ax/ai/openai/types.ts:20


TextEmbeddingAda002

TextEmbeddingAda002: "text-embedding-ada-002"

Defined in: src/ax/ai/openai/types.ts:19

> AxAIRekaModel

Defined in: src/ax/ai/reka/types.ts:3

Enumeration Members

RekaCore

RekaCore: "reka-core"

Defined in: src/ax/ai/reka/types.ts:4


RekaEdge

RekaEdge: "reka-edge"

Defined in: src/ax/ai/reka/types.ts:6


RekaFlash

RekaFlash: "reka-flash"

Defined in: src/ax/ai/reka/types.ts:5

> AxAIOpenAIModel

Defined in: src/ax/ai/openai/types.ts:3

Enumeration Members

GPT35TextDavinci002

GPT35TextDavinci002: "text-davinci-002"

Defined in: src/ax/ai/openai/types.ts:13


GPT35Turbo

GPT35Turbo: "gpt-3.5-turbo"

Defined in: src/ax/ai/openai/types.ts:11


GPT35TurboInstruct

GPT35TurboInstruct: "gpt-3.5-turbo-instruct"

Defined in: src/ax/ai/openai/types.ts:12


GPT3TextAda001

GPT3TextAda001: "text-ada-001"

Defined in: src/ax/ai/openai/types.ts:15


GPT3TextBabbage002

GPT3TextBabbage002: "text-babbage-002"

Defined in: src/ax/ai/openai/types.ts:14


GPT4

GPT4: "gpt-4"

Defined in: src/ax/ai/openai/types.ts:6


GPT4ChatGPT4O

GPT4ChatGPT4O: "chatgpt-4o-latest"

Defined in: src/ax/ai/openai/types.ts:9


GPT4O

GPT4O: "gpt-4o"

Defined in: src/ax/ai/openai/types.ts:7


GPT4OMini

GPT4OMini: "gpt-4o-mini"

Defined in: src/ax/ai/openai/types.ts:8


GPT4Turbo

GPT4Turbo: "gpt-4-turbo"

Defined in: src/ax/ai/openai/types.ts:10


O1Mini

O1Mini: "o1-mini"

Defined in: src/ax/ai/openai/types.ts:5


O1Preview

O1Preview: "o1-preview"

Defined in: src/ax/ai/openai/types.ts:4

> AxJSInterpreterPermission

Defined in: src/ax/funcs/code.ts:11

Enumeration Members

CRYPTO

CRYPTO: "crypto"

Defined in: src/ax/funcs/code.ts:15


FS

FS: "node:fs"

Defined in: src/ax/funcs/code.ts:12


NET

NET: "net"

Defined in: src/ax/funcs/code.ts:13


OS

OS: "os"

Defined in: src/ax/funcs/code.ts:14


PROCESS

PROCESS: "process"

Defined in: src/ax/funcs/code.ts:16

> AxLLMRequestTypeValues

Defined in: src/ax/trace/trace.ts:46

Enumeration Members

CHAT

CHAT: "chat"

Defined in: src/ax/trace/trace.ts:48


COMPLETION

COMPLETION: "completion"

Defined in: src/ax/trace/trace.ts:47


RERANK

RERANK: "rerank"

Defined in: src/ax/trace/trace.ts:49


UNKNOWN

UNKNOWN: "unknown"

Defined in: src/ax/trace/trace.ts:50

> AxSpanKindValues

Defined in: src/ax/trace/trace.ts:53

Enumeration Members

AGENT

AGENT: "agent"

Defined in: src/ax/trace/trace.ts:56


TASK

TASK: "task"

Defined in: src/ax/trace/trace.ts:55


TOOL

TOOL: "tool"

Defined in: src/ax/trace/trace.ts:57


UNKNOWN

UNKNOWN: "unknown"

Defined in: src/ax/trace/trace.ts:58


WORKFLOW

WORKFLOW: "workflow"

Defined in: src/ax/trace/trace.ts:54

> AxAIAnthropicArgs

Defined in: src/ax/ai/anthropic/api.ts:34

Properties

apiKey

apiKey: string

Defined in: src/ax/ai/anthropic/api.ts:36


config?

optional config: Readonly<Partial<AxAIAnthropicConfig>>

Defined in: src/ax/ai/anthropic/api.ts:37


modelMap?

optional modelMap: Record<string, string>

Defined in: src/ax/ai/anthropic/api.ts:39


name

name: "anthropic"

Defined in: src/ax/ai/anthropic/api.ts:35


options?

optional options: Readonly<AxAIServiceOptions>

Defined in: src/ax/ai/anthropic/api.ts:38

> AxAIAnthropicContentBlockDeltaEvent

Defined in: src/ax/ai/anthropic/types.ts:166

Properties

delta

delta: { text: string; type: "text_delta"; } | { partial_json: string; type: "input_json_delta"; }

Defined in: src/ax/ai/anthropic/types.ts:169


index

index: number

Defined in: src/ax/ai/anthropic/types.ts:167


type

type: "content_block_delta"

Defined in: src/ax/ai/anthropic/types.ts:168

> AxAIAnthropicContentBlockStartEvent

Defined in: src/ax/ai/anthropic/types.ts:149

Properties

content_block

content_block: { text: string; type: "text"; } | { id: string; input: object; name: string; type: "tool_use"; }

Defined in: src/ax/ai/anthropic/types.ts:152


index

index: number

Defined in: src/ax/ai/anthropic/types.ts:150


type

type: "content_block_start"

Defined in: src/ax/ai/anthropic/types.ts:151

> AxAIAnthropicContentBlockStopEvent

Defined in: src/ax/ai/anthropic/types.ts:181

Properties

index

index: number

Defined in: src/ax/ai/anthropic/types.ts:183


type

type: "content_block_stop"

Defined in: src/ax/ai/anthropic/types.ts:182

> AxAIAnthropicErrorEvent

Defined in: src/ax/ai/anthropic/types.ts:209

Properties

error

error: object

Defined in: src/ax/ai/anthropic/types.ts:211

message

message: string

type

type: "overloaded_error"


type

type: "error"

Defined in: src/ax/ai/anthropic/types.ts:210

> AxAIAnthropicMessageDeltaEvent

Defined in: src/ax/ai/anthropic/types.ts:187

Properties

delta

delta: object

Defined in: src/ax/ai/anthropic/types.ts:189

stop_reason

stop_reason: null | "end_turn" | "max_tokens" | "stop_sequence"

stop_sequence

stop_sequence: null | string


type

type: "message_delta"

Defined in: src/ax/ai/anthropic/types.ts:188


usage

usage: object

Defined in: src/ax/ai/anthropic/types.ts:193

output_tokens

output_tokens: number

> AxAIAnthropicMessageStartEvent

Defined in: src/ax/ai/anthropic/types.ts:131

Properties

message

message: object

Defined in: src/ax/ai/anthropic/types.ts:133

content

content: []

id

id: string

model

model: string

role

role: "assistant"

stop_reason

stop_reason: null | string

stop_sequence

stop_sequence: null | string

type

type: "message"

usage

{ input_tokens: number; output_tokens: number; }


type

type: "message_start"

Defined in: src/ax/ai/anthropic/types.ts:132

> AxAIAnthropicMessageStopEvent

Defined in: src/ax/ai/anthropic/types.ts:199

Properties

type

type: "message_stop"

Defined in: src/ax/ai/anthropic/types.ts:200

> AxAIAnthropicPingEvent

Defined in: src/ax/ai/anthropic/types.ts:204

Properties

type

type: "ping"

Defined in: src/ax/ai/anthropic/types.ts:205

> AxAIAzureOpenAIArgs

Defined in: src/ax/ai/azure-openai/api.ts:23

Properties

apiKey

apiKey: string

Defined in: src/ax/ai/azure-openai/api.ts:25


config?

optional config: Readonly<Partial<AxAIOpenAIConfig>>

Defined in: src/ax/ai/azure-openai/api.ts:29


deploymentName

deploymentName: string

Defined in: src/ax/ai/azure-openai/api.ts:27


modelMap?

optional modelMap: Record<string, AxAIOpenAIModel | AxAIOpenAIEmbedModel>

Defined in: src/ax/ai/azure-openai/api.ts:31


name

name: "azure-openai"

Defined in: src/ax/ai/azure-openai/api.ts:24


options?

optional options: Readonly<AxAIServiceOptions>

Defined in: src/ax/ai/azure-openai/api.ts:30


resourceName

resourceName: string

Defined in: src/ax/ai/azure-openai/api.ts:26


version?

optional version: string

Defined in: src/ax/ai/azure-openai/api.ts:28

> AxAICohereArgs

Defined in: src/ax/ai/cohere/api.ts:45

Properties

apiKey

apiKey: string

Defined in: src/ax/ai/cohere/api.ts:47


config?

optional config: Readonly<Partial<AxAICohereConfig>>

Defined in: src/ax/ai/cohere/api.ts:48


modelMap?

optional modelMap: Record<string, string>

Defined in: src/ax/ai/cohere/api.ts:50


name

name: "cohere"

Defined in: src/ax/ai/cohere/api.ts:46


options?

optional options: Readonly<AxAIServiceOptions>

Defined in: src/ax/ai/cohere/api.ts:49

> AxAIDeepSeekArgs

Defined in: src/ax/ai/deepseek/api.ts:26

Properties

apiKey

apiKey: string

Defined in: src/ax/ai/deepseek/api.ts:28


config?

optional config: Readonly<Partial<AxAIOpenAIConfig>>

Defined in: src/ax/ai/deepseek/api.ts:29


modelMap?

optional modelMap: Record<string, string>

Defined in: src/ax/ai/deepseek/api.ts:31


name

name: "deepseek"

Defined in: src/ax/ai/deepseek/api.ts:27


options?

optional options: Readonly<AxAIServiceOptions>

Defined in: src/ax/ai/deepseek/api.ts:30

> AxAIGoogleGeminiArgs

Defined in: src/ax/ai/google-gemini/api.ts:81

Properties

apiKey

apiKey: string

Defined in: src/ax/ai/google-gemini/api.ts:83


config?

optional config: Readonly<Partial<AxAIGoogleGeminiConfig>>

Defined in: src/ax/ai/google-gemini/api.ts:86


modelMap?

optional modelMap: Record<string, string>

Defined in: src/ax/ai/google-gemini/api.ts:88


name

name: "google-gemini"

Defined in: src/ax/ai/google-gemini/api.ts:82


options?

optional options: Readonly<AxAIServiceOptions & AxAIGoogleGeminiOptionsTools>

Defined in: src/ax/ai/google-gemini/api.ts:87


projectId?

optional projectId: string

Defined in: src/ax/ai/google-gemini/api.ts:84


region?

optional region: string

Defined in: src/ax/ai/google-gemini/api.ts:85

> AxAIGoogleGeminiOptionsTools

Defined in: src/ax/ai/google-gemini/api.ts:73

Properties

codeExecution?

optional codeExecution: boolean

Defined in: src/ax/ai/google-gemini/api.ts:74


googleSearchRetrieval?

optional googleSearchRetrieval: object

Defined in: src/ax/ai/google-gemini/api.ts:75

dynamicThreshold?

optional dynamicThreshold: number

mode?

optional mode: "MODE_DYNAMIC"

> AxAIGroqArgs

Defined in: src/ax/ai/groq/api.ts:18

Properties

apiKey

apiKey: string

Defined in: src/ax/ai/groq/api.ts:20


config?

optional config: Readonly<Partial<AxAIOpenAIConfig>>

Defined in: src/ax/ai/groq/api.ts:21


modelMap?

optional modelMap: Record<string, AxAIGroqModel>

Defined in: src/ax/ai/groq/api.ts:23


name

name: "groq"

Defined in: src/ax/ai/groq/api.ts:19


options?

optional options: Readonly<AxAIServiceOptions> & object

Defined in: src/ax/ai/groq/api.ts:22

Type declaration

tokensPerMinute?

optional tokensPerMinute: number

> AxAIHuggingFaceArgs

Defined in: src/ax/ai/huggingface/api.ts:36

Properties

apiKey

apiKey: string

Defined in: src/ax/ai/huggingface/api.ts:38


config?

optional config: Readonly<Partial<AxAIHuggingFaceConfig>>

Defined in: src/ax/ai/huggingface/api.ts:39


modelMap?

optional modelMap: Record<string, MetaLlama270BChatHF>

Defined in: src/ax/ai/huggingface/api.ts:41


name

name: "huggingface"

Defined in: src/ax/ai/huggingface/api.ts:37


options?

optional options: Readonly<AxAIServiceOptions>

Defined in: src/ax/ai/huggingface/api.ts:40

> AxAIMistralArgs

Defined in: src/ax/ai/mistral/api.ts:23

Properties

apiKey

apiKey: string

Defined in: src/ax/ai/mistral/api.ts:25


config?

optional config: Readonly<Partial<AxAIOpenAIConfig>>

Defined in: src/ax/ai/mistral/api.ts:26


modelMap?

optional modelMap: Record<string, string>

Defined in: src/ax/ai/mistral/api.ts:28


name

name: "mistral"

Defined in: src/ax/ai/mistral/api.ts:24


options?

optional options: Readonly<AxAIServiceOptions>

Defined in: src/ax/ai/mistral/api.ts:27

> AxAIMemory

Defined in: src/ax/mem/types.ts:3

Methods

add()

add(result, sessionId?): void

Defined in: src/ax/mem/types.ts:4

Parameters

ParameterType
resultReadonly<Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }> | Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: … | … | …; text: string; type: "text"; } | { cache: … | … | …; details: … | … | … | …; image: string; mimeType: string; type: "image"; } | { cache: … | … | …; data: string; format: … | …; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>[]>
sessionId?string

Returns

void


addResult()

addResult(result, sessionId?): void

Defined in: src/ax/mem/types.ts:10

Parameters

ParameterType
resultReadonly<AxChatResponseResult>
sessionId?string

Returns

void


getLast()

getLast(sessionId?): undefined | Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>

Defined in: src/ax/mem/types.ts:16

Parameters

ParameterType
sessionId?string

Returns

undefined | Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>


history()

history(sessionId?): Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>[]

Defined in: src/ax/mem/types.ts:13

Parameters

ParameterType
sessionId?string

Returns

Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: "high" | "low" | "auto"; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>[]


reset()

reset(sessionId?): void

Defined in: src/ax/mem/types.ts:14

Parameters

ParameterType
sessionId?string

Returns

void


updateResult()

updateResult(result, sessionId?): void

Defined in: src/ax/mem/types.ts:11

Parameters

ParameterType
resultReadonly<AxChatResponseResult>
sessionId?string

Returns

void

> AxAIOpenAIArgs

Defined in: src/ax/ai/openai/api.ts:57

Properties

apiKey

apiKey: string

Defined in: src/ax/ai/openai/api.ts:59


apiURL?

optional apiURL: string

Defined in: src/ax/ai/openai/api.ts:60


config?

optional config: Readonly<Partial<AxAIOpenAIConfig>>

Defined in: src/ax/ai/openai/api.ts:61


modelInfo?

optional modelInfo: readonly AxModelInfo[]

Defined in: src/ax/ai/openai/api.ts:63


modelMap?

optional modelMap: Record<string, string>

Defined in: src/ax/ai/openai/api.ts:64


name

name: "openai"

Defined in: src/ax/ai/openai/api.ts:58


options?

optional options: Readonly<AxAIServiceOptions & object>

Defined in: src/ax/ai/openai/api.ts:62

> AxAIOpenAIResponseDelta

Defined in: src/ax/ai/openai/types.ts:51

Type Parameters

Type Parameter
T

Properties

choices

choices: object[]

Defined in: src/ax/ai/openai/types.ts:56

delta

delta: T

finish_reason

finish_reason: "stop" | "length" | "content_filter" | "tool_calls"

index

index: number


created

created: number

Defined in: src/ax/ai/openai/types.ts:54


id

id: string

Defined in: src/ax/ai/openai/types.ts:52


model

model: string

Defined in: src/ax/ai/openai/types.ts:55


object

object: string

Defined in: src/ax/ai/openai/types.ts:53


system_fingerprint

system_fingerprint: string

Defined in: src/ax/ai/openai/types.ts:62


usage?

optional usage: AxAIOpenAIUsage

Defined in: src/ax/ai/openai/types.ts:61

> AxAIRekaArgs

Defined in: src/ax/ai/reka/api.ts:51

Properties

apiKey

apiKey: string

Defined in: src/ax/ai/reka/api.ts:53


apiURL?

optional apiURL: string

Defined in: src/ax/ai/reka/api.ts:54


config?

optional config: Readonly<Partial<AxAIRekaConfig>>

Defined in: src/ax/ai/reka/api.ts:55


modelInfo?

optional modelInfo: readonly AxModelInfo[]

Defined in: src/ax/ai/reka/api.ts:57


modelMap?

optional modelMap: Record<string, string>

Defined in: src/ax/ai/reka/api.ts:58


name

name: "reka"

Defined in: src/ax/ai/reka/api.ts:52


options?

optional options: Readonly<AxAIServiceOptions & object>

Defined in: src/ax/ai/reka/api.ts:56

> AxAIService

Defined in: src/ax/ai/types.ts:224

Methods

chat()

chat(req, options?): Promise<AxChatResponse | ReadableStream<AxChatResponse>>

Defined in: src/ax/ai/types.ts:232

Parameters

ParameterType
reqReadonly<AxChatRequest>
options?Readonly<AxAIPromptConfig & AxAIServiceActionOptions>

Returns

Promise<AxChatResponse | ReadableStream<AxChatResponse>>


embed()

embed(req, options?): Promise<AxEmbedResponse>

Defined in: src/ax/ai/types.ts:236

Parameters

ParameterType
reqReadonly<AxEmbedRequest>
options?Readonly<AxAIServiceActionOptions>

Returns

Promise<AxEmbedResponse>


getEmbedModelInfo()

getEmbedModelInfo(): undefined | Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/types.ts:227

Returns

undefined | Readonly<AxModelInfoWithProvider>


getFeatures()

getFeatures(model?): object

Defined in: src/ax/ai/types.ts:228

Parameters

ParameterType
model?string

Returns

object

functions

functions: boolean

streaming

streaming: boolean


getMetrics()

getMetrics(): AxAIServiceMetrics

Defined in: src/ax/ai/types.ts:230

Returns

AxAIServiceMetrics


getModelInfo()

getModelInfo(): Readonly<AxModelInfoWithProvider>

Defined in: src/ax/ai/types.ts:226

Returns

Readonly<AxModelInfoWithProvider>


getModelMap()

getModelMap(): undefined | AxAIModelMap

Defined in: src/ax/ai/types.ts:229

Returns

undefined | AxAIModelMap


getName()

getName(): string

Defined in: src/ax/ai/types.ts:225

Returns

string


setOptions()

setOptions(options): void

Defined in: src/ax/ai/types.ts:241

Parameters

ParameterType
optionsReadonly<AxAIServiceOptions>

Returns

void

> AxAIServiceImpl

Defined in: src/ax/ai/types.ts:244

Type Parameters

Type Parameter
TChatRequest
TEmbedRequest
TChatResponse
TChatResponseDelta
TEmbedResponse

Methods

createChatReq()

createChatReq(req, config): [AxAPI, TChatRequest]

Defined in: src/ax/ai/types.ts:251

Parameters

ParameterType
reqReadonly<AxInternalChatRequest>
configReadonly<AxAIPromptConfig>

Returns

[AxAPI, TChatRequest]


createChatResp()

createChatResp(resp): AxChatResponse

Defined in: src/ax/ai/types.ts:256

Parameters

ParameterType
respReadonly<TChatResponse>

Returns

AxChatResponse


createChatStreamResp()?

optional createChatStreamResp(resp, state): AxChatResponse

Defined in: src/ax/ai/types.ts:258

Parameters

ParameterType
respReadonly<TChatResponseDelta>
stateobject

Returns

AxChatResponse


createEmbedReq()?

optional createEmbedReq(req): [AxAPI, TEmbedRequest]

Defined in: src/ax/ai/types.ts:263

Parameters

ParameterType
reqReadonly<AxInternalEmbedRequest>

Returns

[AxAPI, TEmbedRequest]


createEmbedResp()?

optional createEmbedResp(resp): AxEmbedResponse

Defined in: src/ax/ai/types.ts:265

Parameters

ParameterType
respReadonly<TEmbedResponse>

Returns

AxEmbedResponse


getModelConfig()

getModelConfig(): AxModelConfig

Defined in: src/ax/ai/types.ts:267

Returns

AxModelConfig

> AxAIServiceMetrics

Defined in: src/ax/ai/types.ts:161

Properties

errors

errors: object

Defined in: src/ax/ai/types.ts:176

chat

{ count: number; rate: number; total: number; }

embed

{ count: number; rate: number; total: number; }


latency

latency: object

Defined in: src/ax/ai/types.ts:162

chat

{ mean: number; p95: number; p99: number; samples: number[]; }

embed

{ mean: number; p95: number; p99: number; samples: number[]; }

> AxAITogetherArgs

Defined in: src/ax/ai/together/api.ts:17

Properties

apiKey

apiKey: string

Defined in: src/ax/ai/together/api.ts:19


config?

optional config: Readonly<Partial<AxAIOpenAIConfig>>

Defined in: src/ax/ai/together/api.ts:20


modelMap?

optional modelMap: Record<string, string>

Defined in: src/ax/ai/together/api.ts:22


name

name: "together"

Defined in: src/ax/ai/together/api.ts:18


options?

optional options: Readonly<AxAIServiceOptions>

Defined in: src/ax/ai/together/api.ts:21

> AxAgentic

Defined in: src/ax/prompts/agent.ts:17

Extends

Properties

getTraces()

getTraces: () => AxProgramTrace[]

Defined in: src/ax/dsp/program.ts:71

Returns

AxProgramTrace[]

Inherited from

AxTunable.getTraces


getUsage()

getUsage: () => AxTokenUsage & object[]

Defined in: src/ax/dsp/program.ts:76

Returns

AxTokenUsage & object[]

Inherited from

AxUsable.getUsage


resetUsage()

resetUsage: () => void

Defined in: src/ax/dsp/program.ts:77

Returns

void

Inherited from

AxUsable.resetUsage


setDemos()

setDemos: (demos) => void

Defined in: src/ax/dsp/program.ts:72

Parameters

ParameterType
demosreadonly AxProgramDemos[]

Returns

void

Inherited from

AxTunable.setDemos


setExamples()

setExamples: (examples) => void

Defined in: src/ax/dsp/program.ts:68

Parameters

ParameterType
examplesReadonly<AxProgramExamples>

Returns

void

Inherited from

AxTunable.setExamples


setId()

setId: (id) => void

Defined in: src/ax/dsp/program.ts:69

Parameters

ParameterType
idstring

Returns

void

Inherited from

AxTunable.setId


setParentId()

setParentId: (parentId) => void

Defined in: src/ax/dsp/program.ts:70

Parameters

ParameterType
parentIdstring

Returns

void

Inherited from

AxTunable.setParentId

Methods

getFunction()

getFunction(): AxFunction

Defined in: src/ax/prompts/agent.ts:18

Returns

AxFunction

> AxApacheTikaArgs

Defined in: src/ax/docs/tika.ts:3

Properties

fetch()?

optional fetch: (input, init?) => Promise<Response>

Defined in: src/ax/docs/tika.ts:5

Parameters

ParameterType
inputstring | URL | Request
init?RequestInit

Returns

Promise<Response>


url?

optional url: string | URL

Defined in: src/ax/docs/tika.ts:4

> AxApacheTikaConvertOptions

Defined in: src/ax/docs/tika.ts:8

Properties

format?

optional format: "text" | "html"

Defined in: src/ax/docs/tika.ts:9

> AxAssertion

Defined in: src/ax/dsp/asserts.ts:4

Properties

message?

optional message: string

Defined in: src/ax/dsp/asserts.ts:6


optional?

optional optional: boolean

Defined in: src/ax/dsp/asserts.ts:7

Methods

fn()

fn(values): undefined | boolean

Defined in: src/ax/dsp/asserts.ts:5

Parameters

ParameterType
valuesRecord<string, unknown>

Returns

undefined | boolean

> AxBaseAIArgs

Defined in: src/ax/ai/base.ts:36

Properties

apiURL

apiURL: string

Defined in: src/ax/ai/base.ts:38


headers

headers: Record<string, string>

Defined in: src/ax/ai/base.ts:39


modelInfo

modelInfo: readonly AxModelInfo[]

Defined in: src/ax/ai/base.ts:40


modelMap?

optional modelMap: AxAIModelMap

Defined in: src/ax/ai/base.ts:44


models

models: Readonly<{ embedModel: string; model: string; }>

Defined in: src/ax/ai/base.ts:41


name

name: string

Defined in: src/ax/ai/base.ts:37


options?

optional options: Readonly<AxAIServiceOptions>

Defined in: src/ax/ai/base.ts:42


supportFor

supportFor: AxBaseAIFeatures | (model) => AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:43

> AxBaseAIFeatures

Defined in: src/ax/ai/base.ts:31

Properties

functions

functions: boolean

Defined in: src/ax/ai/base.ts:32


streaming

streaming: boolean

Defined in: src/ax/ai/base.ts:33

> AxDBBaseArgs

Defined in: src/ax/db/base.ts:13

Extended by

Properties

fetch()?

optional fetch: (input, init?) => Promise<Response>

Defined in: src/ax/db/base.ts:14

Parameters

ParameterType
inputstring | URL | Request
init?RequestInit

Returns

Promise<Response>


tracer?

optional tracer: Tracer

Defined in: src/ax/db/base.ts:15

> AxDBBaseOpOptions

Defined in: src/ax/db/base.ts:18

Properties

span?

optional span: Span

Defined in: src/ax/db/base.ts:19

> AxDBCloudflareArgs

Defined in: src/ax/db/cloudflare.ts:34

Extends

Properties

accountId

accountId: string

Defined in: src/ax/db/cloudflare.ts:37


apiKey

apiKey: string

Defined in: src/ax/db/cloudflare.ts:36


fetch()?

optional fetch: (input, init?) => Promise<Response>

Defined in: src/ax/db/cloudflare.ts:38

Parameters

ParameterType
inputstring | URL | Request
init?RequestInit

Returns

Promise<Response>

Overrides

AxDBBaseArgs.fetch


name

name: "cloudflare"

Defined in: src/ax/db/cloudflare.ts:35


tracer?

optional tracer: Tracer

Defined in: src/ax/db/base.ts:15

Inherited from

AxDBBaseArgs.tracer

> AxDBLoaderOptions

Defined in: src/ax/docs/manager.ts:14

Properties

chunker()?

optional chunker: (text) => string[]

Defined in: src/ax/docs/manager.ts:15

Parameters

ParameterType
textstring

Returns

string[]


reranker?

optional reranker: AxProgram<AxRerankerIn, AxRerankerOut>

Defined in: src/ax/docs/manager.ts:17


rewriter?

optional rewriter: AxProgram<AxRewriteIn, AxRewriteOut>

Defined in: src/ax/docs/manager.ts:16

> AxDBManagerArgs

Defined in: src/ax/docs/manager.ts:20

Properties

ai

ai: AxAIService

Defined in: src/ax/docs/manager.ts:21


config?

optional config: AxDBLoaderOptions

Defined in: src/ax/docs/manager.ts:23


db

db: AxDBService

Defined in: src/ax/docs/manager.ts:22

> AxDBMatch

Defined in: src/ax/docs/manager.ts:26

Properties

score

score: number

Defined in: src/ax/docs/manager.ts:27


text

text: string

Defined in: src/ax/docs/manager.ts:28

> AxDBMemoryArgs

Defined in: src/ax/db/memory.ts:11

Extends

Properties

fetch()?

optional fetch: (input, init?) => Promise<Response>

Defined in: src/ax/db/base.ts:14

Parameters

ParameterType
inputstring | URL | Request
init?RequestInit

Returns

Promise<Response>

Inherited from

AxDBBaseArgs.fetch


name

name: "memory"

Defined in: src/ax/db/memory.ts:12


tracer?

optional tracer: Tracer

Defined in: src/ax/db/base.ts:15

Inherited from

AxDBBaseArgs.tracer

> AxDBPineconeArgs

Defined in: src/ax/db/pinecone.ts:48

Extends

Properties

apiKey

apiKey: string

Defined in: src/ax/db/pinecone.ts:50


fetch()?

optional fetch: (input, init?) => Promise<Response>

Defined in: src/ax/db/pinecone.ts:52

Parameters

ParameterType
inputstring | URL | Request
init?RequestInit

Returns

Promise<Response>

Overrides

AxDBBaseArgs.fetch


host

host: string

Defined in: src/ax/db/pinecone.ts:51


name

name: "pinecone"

Defined in: src/ax/db/pinecone.ts:49


tracer?

optional tracer: Tracer

Defined in: src/ax/db/base.ts:15

Inherited from

AxDBBaseArgs.tracer

> AxDBQueryService

Defined in: src/ax/db/types.ts:48

Extended by

Methods

query()

query(req): Promise<AxDBQueryResponse>

Defined in: src/ax/db/types.ts:49

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>

Returns

Promise<AxDBQueryResponse>

> AxDBService

Defined in: src/ax/db/types.ts:36

Extends

Methods

batchUpsert()

batchUpsert(batchReq, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/types.ts:42

Parameters

ParameterType
batchReqreadonly AxDBUpsertRequest[]
update?boolean

Returns

Promise<AxDBUpsertResponse>


query()

query(req): Promise<AxDBQueryResponse>

Defined in: src/ax/db/types.ts:49

Parameters

ParameterType
reqReadonly<AxDBQueryRequest>

Returns

Promise<AxDBQueryResponse>

Inherited from

AxDBQueryService.query


upsert()

upsert(req, update?): Promise<AxDBUpsertResponse>

Defined in: src/ax/db/types.ts:37

Parameters

ParameterType
reqReadonly<AxDBUpsertRequest>
update?boolean

Returns

Promise<AxDBUpsertResponse>

> AxDBWeaviateArgs

Defined in: src/ax/db/weaviate.ts:29

Extends

Properties

apiKey

apiKey: string

Defined in: src/ax/db/weaviate.ts:31


fetch()?

optional fetch: (input, init?) => Promise<Response>

Defined in: src/ax/db/weaviate.ts:33

Parameters

ParameterType
inputstring | URL | Request
init?RequestInit

Returns

Promise<Response>

Overrides

AxDBBaseArgs.fetch


host

host: string

Defined in: src/ax/db/weaviate.ts:32


name

name: "weaviate"

Defined in: src/ax/db/weaviate.ts:30


tracer?

optional tracer: Tracer

Defined in: src/ax/db/base.ts:15

Inherited from

AxDBBaseArgs.tracer

> AxDockerContainer

Defined in: src/ax/funcs/docker.ts:3

Properties

Command

Command: string

Defined in: src/ax/funcs/docker.ts:8


Created

Created: number

Defined in: src/ax/funcs/docker.ts:9


HostConfig

HostConfig: object

Defined in: src/ax/funcs/docker.ts:33

NetworkMode

NetworkMode: string


Id

Id: string

Defined in: src/ax/funcs/docker.ts:4


Image

Image: string

Defined in: src/ax/funcs/docker.ts:6


ImageID

ImageID: string

Defined in: src/ax/funcs/docker.ts:7


Labels

Labels: object

Defined in: src/ax/funcs/docker.ts:30

Index Signature

[key: string]: string


Mounts

Mounts: object[]

Defined in: src/ax/funcs/docker.ts:46

Destination

Destination: string

Mode

Mode: string

Propagation

Propagation: string

RW

RW: boolean

Source

Source: string

Type

Type: string


Names

Names: string[]

Defined in: src/ax/funcs/docker.ts:5


NetworkSettings

NetworkSettings: object

Defined in: src/ax/funcs/docker.ts:36

Networks

{}


Ports

Ports: object[]

Defined in: src/ax/funcs/docker.ts:24

IP

IP: string

PrivatePort

PrivatePort: number

PublicPort

PublicPort: number

Type

Type: string


SizeRootFs

SizeRootFs: number

Defined in: src/ax/funcs/docker.ts:32


SizeRw

SizeRw: number

Defined in: src/ax/funcs/docker.ts:31


State

State: object

Defined in: src/ax/funcs/docker.ts:10

Dead

Dead: boolean

Error

Error: string

ExitCode

ExitCode: number

FinishedAt

FinishedAt: Date

OOMKilled

OOMKilled: boolean

Paused

Paused: boolean

Pid

Pid: number

Restarting

Restarting: boolean

Running

Running: boolean

StartedAt

StartedAt: Date

Status

Status: string


Status

Status: string

Defined in: src/ax/funcs/docker.ts:23

> AxField

Defined in: src/ax/dsp/sig.ts:12

Properties

description?

optional description: string

Defined in: src/ax/dsp/sig.ts:15


isOptional?

optional isOptional: boolean

Defined in: src/ax/dsp/sig.ts:30


name

name: string

Defined in: src/ax/dsp/sig.ts:13


title?

optional title: string

Defined in: src/ax/dsp/sig.ts:14


type?

optional type: object

Defined in: src/ax/dsp/sig.ts:16

classes?

optional classes: string[]

isArray

isArray: boolean

name

name: "string" | "number" | "boolean" | "image" | "audio" | "json" | "datetime" | "date" | "class"

> AxGenOptions

Defined in: src/ax/dsp/generate.ts:48

Properties

asserts?

optional asserts: AxAssertion[]

Defined in: src/ax/dsp/generate.ts:63


debug?

optional debug: boolean

Defined in: src/ax/dsp/generate.ts:56


description?

optional description: string

Defined in: src/ax/dsp/generate.ts:57


functionCall?

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

Defined in: src/ax/dsp/generate.ts:60


functions?

optional functions: AxInputFunctionType

Defined in: src/ax/dsp/generate.ts:59


maxCompletions?

optional maxCompletions: number

Defined in: src/ax/dsp/generate.ts:49


maxRetries?

optional maxRetries: number

Defined in: src/ax/dsp/generate.ts:50


maxSteps?

optional maxSteps: number

Defined in: src/ax/dsp/generate.ts:51


mem?

optional mem: AxAIMemory

Defined in: src/ax/dsp/generate.ts:52


promptTemplate?

optional promptTemplate: typeof AxPromptTemplate

Defined in: src/ax/dsp/generate.ts:62


rateLimiter?

optional rateLimiter: AxRateLimiterFunction

Defined in: src/ax/dsp/generate.ts:54


stopFunction?

optional stopFunction: string

Defined in: src/ax/dsp/generate.ts:61


stream?

optional stream: boolean

Defined in: src/ax/dsp/generate.ts:55


streamingAsserts?

optional streamingAsserts: AxStreamingAssertion[]

Defined in: src/ax/dsp/generate.ts:64


tracer?

optional tracer: Tracer

Defined in: src/ax/dsp/generate.ts:53

> AxProgramWithSignatureOptions

Defined in: src/ax/dsp/program.ts:85

Properties

description?

optional description: string

Defined in: src/ax/dsp/program.ts:86

> AxRateLimiterTokenUsageOptions

Defined in: src/ax/util/rate-limit.ts:5

Properties

debug?

optional debug: boolean

Defined in: src/ax/util/rate-limit.ts:6

> AxRouterForwardOptions

Defined in: src/ax/dsp/router.ts:7

Properties

cutoff?

optional cutoff: number

Defined in: src/ax/dsp/router.ts:8

> AxStreamingAssertion

Defined in: src/ax/dsp/asserts.ts:10

Properties

fieldName

fieldName: string

Defined in: src/ax/dsp/asserts.ts:11


message?

optional message: string

Defined in: src/ax/dsp/asserts.ts:13


optional?

optional optional: boolean

Defined in: src/ax/dsp/asserts.ts:14

Methods

fn()

fn(content, done?): undefined | boolean

Defined in: src/ax/dsp/asserts.ts:12

Parameters

ParameterType
contentstring
done?boolean

Returns

undefined | boolean

> AxResponseHandlerArgs

Defined in: src/ax/dsp/generate.ts:71

Type Parameters

Type Parameter
T

Properties

ai

ai: Readonly<AxAIService>

Defined in: src/ax/dsp/generate.ts:72


functions?

optional functions: readonly AxFunction[]

Defined in: src/ax/dsp/generate.ts:79


mem

mem: AxAIMemory

Defined in: src/ax/dsp/generate.ts:76


model?

optional model: string

Defined in: src/ax/dsp/generate.ts:73


res

res: T

Defined in: src/ax/dsp/generate.ts:74


sessionId?

optional sessionId: string

Defined in: src/ax/dsp/generate.ts:77


traceId?

optional traceId: string

Defined in: src/ax/dsp/generate.ts:78


usageInfo

usageInfo: object

Defined in: src/ax/dsp/generate.ts:75

ai

ai: string

model

model: string

> AxTunable

Defined in: src/ax/dsp/program.ts:67

Extended by

Properties

getTraces()

getTraces: () => AxProgramTrace[]

Defined in: src/ax/dsp/program.ts:71

Returns

AxProgramTrace[]


setDemos()

setDemos: (demos) => void

Defined in: src/ax/dsp/program.ts:72

Parameters

ParameterType
demosreadonly AxProgramDemos[]

Returns

void


setExamples()

setExamples: (examples) => void

Defined in: src/ax/dsp/program.ts:68

Parameters

ParameterType
examplesReadonly<AxProgramExamples>

Returns

void


setId()

setId: (id) => void

Defined in: src/ax/dsp/program.ts:69

Parameters

ParameterType
idstring

Returns

void


setParentId()

setParentId: (parentId) => void

Defined in: src/ax/dsp/program.ts:70

Parameters

ParameterType
parentIdstring

Returns

void

> AxUsable

Defined in: src/ax/dsp/program.ts:75

Extended by

Properties

getUsage()

getUsage: () => AxTokenUsage & object[]

Defined in: src/ax/dsp/program.ts:76

Returns

AxTokenUsage & object[]


resetUsage()

resetUsage: () => void

Defined in: src/ax/dsp/program.ts:77

Returns

void

> AxAIAnthropicChatError

AxAIAnthropicChatError: object

Defined in: src/ax/ai/anthropic/types.ts:122

Type declaration

error

{ message: string; type: "authentication_error"; }

type

type: "error"

> @ax-llm/ax

Enumerations

Classes

Interfaces

Type Aliases

> AxAIAnthropicChatRequest

AxAIAnthropicChatRequest: object

Defined in: src/ax/ai/anthropic/types.ts:24

Type declaration

max_tokens?

optional max_tokens: number

messages

messages: ({ content: string | (… & … | … & … | { content: … | …; is_error: boolean; tool_use_id: string; type: "tool_result"; })[]; role: "user"; } | { content: string | ({ text: string; type: "text"; } | { id: string; input: object; name: string; type: "tool_use"; })[]; role: "assistant"; })[]

metadata?

{ user_id: string; }

model

model: string

stop_sequences?

optional stop_sequences: string[]

stream?

optional stream: boolean

system?

optional system: string | object & AxAIAnthropicChatRequestCacheParam[]

temperature?

optional temperature: number

tool_choice?

optional tool_choice: { type: "auto" | "any"; } | { name: string; type: "tool"; }

tools?

optional tools: object & AxAIAnthropicChatRequestCacheParam[]

top_k?

optional top_k: number

top_p?

optional top_p: number

> AxAIAnthropicChatRequestCacheParam

AxAIAnthropicChatRequestCacheParam: object

Defined in: src/ax/ai/anthropic/types.ts:19

Type declaration

cache_control?

{ type: "ephemeral"; }

> AxAIAnthropicChatResponse

AxAIAnthropicChatResponse: object

Defined in: src/ax/ai/anthropic/types.ts:97

Type declaration

content

content: ({ text: string; type: "text"; } | { id: string; input: string; name: string; type: "tool_use"; })[]

id

id: string

model

model: string

role

role: "assistant"

stop_reason

stop_reason: "end_turn" | "max_tokens" | "stop_sequence" | "tool_use"

stop_sequence?

optional stop_sequence: string

type

type: "message"

usage

{ input_tokens: number; output_tokens: number; }

> AxAIAnthropicChatResponseDelta

> AxAIAnthropicConfig

AxAIAnthropicConfig: AxModelConfig & object

Defined in: src/ax/ai/anthropic/types.ts:15

Type declaration

model

model: AxAIAnthropicModel

> AxAIArgs

> AxAICohereChatRequest

AxAICohereChatRequest: object

Defined in: src/ax/ai/cohere/types.ts:41

Type declaration

chat_history

chat_history: ({ message: string; role: "CHATBOT"; tool_calls: AxAICohereChatResponseToolCalls; } | { message: string; role: "SYSTEM"; } | { message: string; role: "USER"; } | { message: string; role: "TOOL"; tool_results: AxAICohereChatRequestToolResults; })[]

end_sequences?

optional end_sequences: readonly string[]

frequency_penalty?

optional frequency_penalty: number

k?

optional k: number

max_tokens?

optional max_tokens: number

message?

optional message: string

model

model: AxAICohereModel | string

p?

optional p: number

preamble?

optional preamble: string

presence_penalty?

optional presence_penalty: number

stop_sequences?

optional stop_sequences: string[]

temperature?

optional temperature: number

tool_results?

optional tool_results: AxAICohereChatRequestToolResults

tools?

optional tools: object[]

> AxAICohereChatRequestToolResults

AxAICohereChatRequestToolResults: object[]

Defined in: src/ax/ai/cohere/types.ts:36

Type declaration

call

call: AxAICohereChatResponseToolCalls[0]

outputs

outputs: object[]

> AxAICohereChatResponseDelta

AxAICohereChatResponseDelta: AxAICohereChatResponse & object

Defined in: src/ax/ai/cohere/types.ts:109

Type declaration

event_type

event_type: "stream-start" | "text-generation" | "tool-calls-generation" | "stream-end"

> AxAICohereChatResponse

AxAICohereChatResponse: object

Defined in: src/ax/ai/cohere/types.ts:89

Type declaration

finish_reason

finish_reason: "COMPLETE" | "ERROR" | "ERROR_TOXIC" | "ERROR_LIMIT" | "USER_CANCEL" | "MAX_TOKENS"

generation_id

generation_id: string

meta

{ billed_units: { input_tokens: number; output_tokens: number; }; }

response_id

response_id: string

text

text: string

tool_calls

tool_calls: AxAICohereChatResponseToolCalls

> AxAICohereConfig

AxAICohereConfig: AxModelConfig & object

Defined in: src/ax/ai/cohere/types.ts:26

Cohere: Model options for text generation

Type declaration

embedModel?

optional embedModel: AxAICohereEmbedModel

model

model: AxAICohereModel

> AxAICohereChatResponseToolCalls

AxAICohereChatResponseToolCalls: object[]

Defined in: src/ax/ai/cohere/types.ts:31

Type declaration

name

name: string

parameters?

optional parameters: object

> AxAICohereEmbedRequest

AxAICohereEmbedRequest: object

Defined in: src/ax/ai/cohere/types.ts:117

Type declaration

model

model: AxAICohereModel | string

texts

texts: readonly string[]

truncate

truncate: string

> AxAICohereEmbedResponse

AxAICohereEmbedResponse: object

Defined in: src/ax/ai/cohere/types.ts:123

Type declaration

embeddings

embeddings: number[][]

id

id: string

model

model: string

texts

texts: string[]

> AxAIEmbedModels

> AxAIGoogleGeminiBatchEmbedResponse

AxAIGoogleGeminiBatchEmbedResponse: object

Defined in: src/ax/ai/google-gemini/types.ts:183

AxAIGoogleGeminiEmbedResponse: Structure for handling responses from the Google Gemini API embedding requests.

Type declaration

embeddings

embeddings: object[]

> AxAIGoogleGeminiBatchEmbedRequest

AxAIGoogleGeminiBatchEmbedRequest: object

Defined in: src/ax/ai/google-gemini/types.ts:171

AxAIGoogleGeminiEmbedRequest: Structure for making an embedding request to the Google Gemini API.

Type declaration

requests

requests: object[]

> AxAIGoogleGeminiChatRequest

AxAIGoogleGeminiChatRequest: object

Defined in: src/ax/ai/google-gemini/types.ts:115

Type declaration

contents

contents: AxAIGoogleGeminiContent[]

generationConfig

generationConfig: AxAIGoogleGeminiGenerationConfig

safetySettings?

optional safetySettings: AxAIGoogleGeminiSafetySettings

systemInstruction?

optional systemInstruction: AxAIGoogleGeminiContent

toolConfig?

optional toolConfig: AxAIGoogleGeminiToolConfig

tools?

optional tools: AxAIGoogleGeminiTool[]

> AxAIGoogleGeminiChatResponseDelta

AxAIGoogleGeminiChatResponseDelta: AxAIGoogleGeminiChatResponse

Defined in: src/ax/ai/google-gemini/types.ts:157

> AxAIGoogleGeminiChatResponse

AxAIGoogleGeminiChatResponse: object

Defined in: src/ax/ai/google-gemini/types.ts:124

Type declaration

candidates

candidates: object[]

usageMetadata

{ candidatesTokenCount: number; promptTokenCount: number; totalTokenCount: number; }

> AxAIGoogleGeminiConfig

AxAIGoogleGeminiConfig: AxModelConfig & object

Defined in: src/ax/ai/google-gemini/types.ts:162

AxAIGoogleGeminiConfig: Configuration options for Google Gemini API

Type declaration

embedModel?

optional embedModel: AxAIGoogleGeminiEmbedModel

model

model: AxAIGoogleGeminiModel | string

safetySettings?

optional safetySettings: AxAIGoogleGeminiSafetySettings

> AxAIGoogleGeminiContent

AxAIGoogleGeminiContent: { parts: ({ text: string; } | { inlineData: { data: string; mimeType: string; }; } | { fileData: { fileUri: string; mimeType: string; }; })[]; role: "user"; } | { parts: object[] | object[]; role: "model"; } | { parts: object[]; role: "function"; }

Defined in: src/ax/ai/google-gemini/types.ts:31

> AxAIGoogleGeminiGenerationConfig

AxAIGoogleGeminiGenerationConfig: object

Defined in: src/ax/ai/google-gemini/types.ts:101

Type declaration

candidateCount?

optional candidateCount: number

maxOutputTokens?

optional maxOutputTokens: number

stopSequences?

optional stopSequences: readonly string[]

temperature?

optional temperature: number

topK?

optional topK: number

topP?

optional topP: number

> AxAIGoogleGeminiSafetySettings

AxAIGoogleGeminiSafetySettings: object[]

Defined in: src/ax/ai/google-gemini/types.ts:110

Type declaration

category

category: AxAIGoogleGeminiSafetyCategory

threshold

threshold: AxAIGoogleGeminiSafetyThreshold

> AxAIGoogleGeminiTool

AxAIGoogleGeminiTool: object

Defined in: src/ax/ai/google-gemini/types.ts:88

Type declaration

code_execution?

optional code_execution: object

function_declarations?

optional function_declarations: AxAIGoogleGeminiToolFunctionDeclaration[]

google_search_retrieval?

optional google_search_retrieval: AxAIGoogleGeminiToolGoogleSearchRetrieval

> AxAIGoogleGeminiToolConfig

AxAIGoogleGeminiToolConfig: object

Defined in: src/ax/ai/google-gemini/types.ts:94

Type declaration

function_calling_config

{ allowed_function_names: string[]; mode: "ANY" | "NONE" | "AUTO"; }

> AxAIGoogleGeminiToolGoogleSearchRetrieval

AxAIGoogleGeminiToolGoogleSearchRetrieval: object

Defined in: src/ax/ai/google-gemini/types.ts:81

Type declaration

dynamic_retrieval_config

{ dynamic_threshold: number; mode: "MODE_DYNAMIC"; }

> AxAIGoogleGeminiToolFunctionDeclaration

AxAIGoogleGeminiToolFunctionDeclaration: object

Defined in: src/ax/ai/google-gemini/types.ts:75

Type declaration

description?

optional description: string

name

name: string

parameters?

optional parameters: object

> AxAIHuggingFaceConfig

AxAIHuggingFaceConfig: AxModelConfig & object

Defined in: src/ax/ai/huggingface/types.ts:7

Type declaration

doSample?

optional doSample: boolean

maxTime?

optional maxTime: number

model

model: AxAIHuggingFaceModel

returnFullText?

optional returnFullText: boolean

useCache?

optional useCache: boolean

waitForModel?

optional waitForModel: boolean

> AxAIHuggingFaceRequest

AxAIHuggingFaceRequest: object

Defined in: src/ax/ai/huggingface/types.ts:16

Type declaration

inputs

inputs: string

model

model: AxAIHuggingFaceModel | string

options?

{ use_cache: boolean; wait_for_model: boolean; }

parameters

{ do_sample: boolean; max_new_tokens: number; max_time: number; num_return_sequences: number; repetition_penalty: number; return_full_text: boolean; temperature: number; top_k: number; top_p: number; }

> AxAIHuggingFaceResponse

AxAIHuggingFaceResponse: object

Defined in: src/ax/ai/huggingface/types.ts:36

Type declaration

generated_text

generated_text: string

> AxAIModelMap

AxAIModelMap: Record<string, string>

Defined in: src/ax/ai/types.ts:7

> AxAIOllamaAIConfig

AxAIOllamaAIConfig: AxAIOpenAIConfig

Defined in: src/ax/ai/ollama/api.ts:9

> AxAIOpenAIChatRequest

AxAIOpenAIChatRequest: object

Defined in: src/ax/ai/openai/types.ts:65

Type declaration

frequency_penalty?

optional frequency_penalty: number

logit_bias?

optional logit_bias: Map<string, number>

max_tokens

max_tokens: number

messages

messages: ({ content: string; role: "system"; } | { content: string | ({ text: string; type: "text"; } | { image_url: { details: …; url: …; }; type: "image_url"; } | { input_audio: { data: …; format: …; }; type: "input_audio"; })[]; name: string; role: "user"; } | { content: string; name: string; role: "assistant"; tool_calls: object[]; } | { content: string; role: "tool"; tool_call_id: string; })[]

model

model: string

n?

optional n: number

organization?

optional organization: string

presence_penalty?

optional presence_penalty: number

response_format?

{ type: string; }

stop?

optional stop: readonly string[]

stream?

optional stream: boolean

temperature?

optional temperature: number

tool_choice?

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

tools?

optional tools: object[]

top_p?

optional top_p: number

user?

optional user: string

> AxAIModels

> AxAIOllamaArgs

AxAIOllamaArgs: object

Defined in: src/ax/ai/ollama/api.ts:25

Type declaration

apiKey?

optional apiKey: string

config?

optional config: Readonly<Partial<AxAIOllamaAIConfig>>

embedModel?

optional embedModel: string

model?

optional model: string

modelMap?

optional modelMap: Record<string, string>

name

name: "ollama"

options?

optional options: Readonly<AxAIServiceOptions>

url?

optional url: string

> AxAIOpenAIChatResponse

AxAIOpenAIChatResponse: object

Defined in: src/ax/ai/openai/types.ts:131

Type declaration

choices

choices: object[]

created

created: number

error?

{ code: number; message: string; param: string; type: string; }

id

id: string

model

model: string

object

object: "chat.completion"

system_fingerprint

system_fingerprint: string

usage?

optional usage: AxAIOpenAIUsage

> AxAIOpenAIChatResponseDelta

AxAIOpenAIChatResponseDelta: AxAIOpenAIResponseDelta<{ content: string; role: string; tool_calls: NonNullable<…[…][0]["message"]["tool_calls"]>[0] & object[]; }>

Defined in: src/ax/ai/openai/types.ts:160

> AxAIOpenAIConfig

AxAIOpenAIConfig: Omit<AxModelConfig, "topK"> & object

Defined in: src/ax/ai/openai/types.ts:24

Type declaration

bestOf?

optional bestOf: number

dimensions?

optional dimensions: number

echo?

optional echo: boolean

embedModel?

optional embedModel: AxAIOpenAIEmbedModel | string

logitBias?

optional logitBias: Map<string, number>

logprobs?

optional logprobs: number

model

model: AxAIOpenAIModel | string

responseFormat?

optional responseFormat: "json_object"

stop?

optional stop: string[]

suffix?

optional suffix: string | null

user?

optional user: string

> AxAIOpenAIEmbedRequest

AxAIOpenAIEmbedRequest: object

Defined in: src/ax/ai/openai/types.ts:170

Type declaration

dimensions?

optional dimensions: number

input

input: readonly string[]

model

model: string

user?

optional user: string

> AxAIOpenAIEmbedResponse

AxAIOpenAIEmbedResponse: object

Defined in: src/ax/ai/openai/types.ts:177

Type declaration

data

data: object[]

model

model: string

usage

usage: AxAIOpenAIUsage

> AxAIOpenAIUsage

AxAIOpenAIUsage: object

Defined in: src/ax/ai/openai/types.ts:45

Type declaration

completion_tokens

completion_tokens: number

prompt_tokens

prompt_tokens: number

total_tokens

total_tokens: number

> AxAIOpenAILogprob

AxAIOpenAILogprob: object

Defined in: src/ax/ai/openai/types.ts:38

Type declaration

text_offset

text_offset: number[]

token_logprobs

token_logprobs: number[]

tokens

tokens: string[]

top_logprobs

top_logprobs: Map<string, number>

> AxAIPromptConfig

AxAIPromptConfig: object

Defined in: src/ax/ai/types.ts:206

Type declaration

stream?

optional stream: boolean

> AxAIRekaChatRequest

AxAIRekaChatRequest: object

Defined in: src/ax/ai/reka/types.ts:20

Type declaration

frequency_penalty?

optional frequency_penalty: number

max_tokens

max_tokens: number

messages

messages: ({ content: string | object[]; role: "user"; } | { content: string | object[]; role: "assistant"; })[]

model

model: string

presence_penalty?

optional presence_penalty: number

response_format?

{ type: string; }

stop?

optional stop: readonly string[]

stream?

optional stream: boolean

temperature?

optional temperature: number

top_k?

optional top_k: number

top_p?

optional top_p: number

usage?

optional usage: AxAIRekaUsage

use_search_engine?

optional use_search_engine: boolean

> AxAIRekaChatResponse

AxAIRekaChatResponse: object

Defined in: src/ax/ai/reka/types.ts:55

Type declaration

id

id: string

model

model: string

responses

responses: object[]

usage?

optional usage: AxAIRekaUsage

> AxAIRekaChatResponseDelta

AxAIRekaChatResponseDelta: object

Defined in: src/ax/ai/reka/types.ts:72

Type declaration

id

id: string

model

model: string

responses

responses: object[]

usage?

optional usage: AxAIRekaUsage

> AxAIRekaConfig

AxAIRekaConfig: Omit<AxModelConfig, "topK"> & object

Defined in: src/ax/ai/reka/types.ts:9

Type declaration

model

model: AxAIRekaModel | string

stop?

optional stop: readonly string[]

useSearchEngine?

optional useSearchEngine: boolean

> AxAIRekaUsage

AxAIRekaUsage: object

Defined in: src/ax/ai/reka/types.ts:15

Type declaration

input_tokens

input_tokens: number

output_tokens

output_tokens: number

> AxAIServiceActionOptions

AxAIServiceActionOptions: object

Defined in: src/ax/ai/types.ts:217

Type declaration

ai?

optional ai: Readonly<AxAIService>

rateLimiter?

optional rateLimiter: AxRateLimiterFunction

sessionId?

optional sessionId: string

traceId?

optional traceId: string

> AxAIServiceOptions

AxAIServiceOptions: object

Defined in: src/ax/ai/types.ts:210

Type declaration

debug?

optional debug: boolean

fetch?

optional fetch: typeof __type

rateLimiter?

optional rateLimiter: AxRateLimiterFunction

tracer?

optional tracer: Tracer

> AxAPI

AxAPI: object

Defined in: src/ax/util/apicall.ts:15

Util: API details

Type declaration

headers?

optional headers: Record<string, string>

name?

optional name: string

put?

optional put: boolean

> AxAgentOptions

AxAgentOptions: Omit<AxGenOptions, "functions">

Defined in: src/ax/prompts/agent.ts:21

> AxBalancerOptions

AxBalancerOptions: object

Defined in: src/ax/ai/balance.ts:40

Options for the balancer.

Type declaration

comparator()?

(a, b) => number

> AxChatRequest

AxChatRequest: object

Defined in: src/ax/ai/types.ts:100

Type declaration

chatPrompt

chatPrompt: Readonly<{ cache: boolean; content: string; role: "system"; } | { content: string | ({ cache: boolean; text: string; type: "text"; } | { cache: boolean; details: … | … | …; image: string; mimeType: string; type: "image"; } | { cache: boolean; data: string; format: "wav"; type: "audio"; })[]; name: string; role: "user"; } | { cache: boolean; content: string; functionCalls: object[]; name: string; role: "assistant"; } | { cache: boolean; functionId: string; result: string; role: "function"; }>[]

functionCall?

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

functions?

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

model?

optional model: string

modelConfig?

optional modelConfig: Readonly<AxModelConfig>

> AxChatResponse

AxChatResponse: object

Defined in: src/ax/ai/types.ts:83

Type declaration

embedModelUsage?

optional embedModelUsage: AxTokenUsage

modelUsage?

optional modelUsage: AxTokenUsage

remoteId?

optional remoteId: string

results

results: readonly AxChatResponseResult[]

sessionId?

optional sessionId: string

> AxChatResponseFunctionCall

AxChatResponseFunctionCall: object

Defined in: src/ax/dsp/functions.ts:13

Type declaration

args

args: string

id?

optional id: string

name

name: string

> AxChatResponseResult

AxChatResponseResult: object

Defined in: src/ax/ai/types.ts:66

Type declaration

content?

optional content: string

finishReason?

optional finishReason: "stop" | "length" | "function_call" | "content_filter" | "error"

functionCalls?

optional functionCalls: object[]

id?

optional id: string

name?

optional name: string

> AxDBArgs

> AxDBCloudflareOpOptions

AxDBCloudflareOpOptions: AxDBBaseOpOptions

Defined in: src/ax/db/cloudflare.ts:13

> AxDBMemoryOpOptions

AxDBMemoryOpOptions: AxDBBaseOpOptions

Defined in: src/ax/db/memory.ts:9

> AxDBPineconeOpOptions

AxDBPineconeOpOptions: AxDBBaseOpOptions

Defined in: src/ax/db/pinecone.ts:11

> AxDBQueryRequest

AxDBQueryRequest: object

Defined in: src/ax/db/types.ts:17

Type declaration

columns?

optional columns: string[]

id?

optional id: string

limit?

optional limit: number

namespace?

optional namespace: string

table

table: string

text?

optional text: string

values?

optional values: readonly number[]

> AxDBState

AxDBState: Record<string, Record<string, AxDBUpsertRequest>>

Defined in: src/ax/db/memory.ts:15

> AxDBQueryResponse

AxDBQueryResponse: object

Defined in: src/ax/db/types.ts:27

Type declaration

matches

matches: object[]

> AxDBUpsertRequest

AxDBUpsertRequest: object

Defined in: src/ax/db/types.ts:3

Type declaration

id

id: string

metadata?

optional metadata: Record<string, string>

namespace?

optional namespace: string

table

table: string

text?

optional text: string

values?

optional values: readonly number[]

> AxDBUpsertResponse

AxDBUpsertResponse: object

Defined in: src/ax/db/types.ts:12

Type declaration

ids

ids: string[]

> AxDBWeaviateOpOptions

AxDBWeaviateOpOptions: AxDBBaseOpOptions

Defined in: src/ax/db/weaviate.ts:11

> AxDataRow

AxDataRow: object

Defined in: src/ax/dsp/loader.ts:3

Type declaration

row

row: Record<string, AxFieldValue>

> AxEmbedRequest

AxEmbedRequest: object

Defined in: src/ax/ai/types.ts:193

Type declaration

embedModel?

optional embedModel: string

texts?

optional texts: readonly string[]

> AxEmbedResponse

AxEmbedResponse: object

Defined in: src/ax/ai/types.ts:91

Type declaration

embeddings

embeddings: readonly readonly number[][]

modelUsage?

optional modelUsage: AxTokenUsage

remoteId?

optional remoteId: string

sessionId?

optional sessionId: string

> AxEvaluateArgs

AxEvaluateArgs<IN, OUT>: object

Defined in: src/ax/dsp/evaluate.ts:7

Type Parameters

Type Parameter
IN extends AxGenIn
OUT extends AxGenOut

Type declaration

ai

ai: AxAIService

examples

examples: Readonly<AxExample[]>

program

program: Readonly<AxProgram<IN, OUT>>

> AxExample

AxExample: Record<string, AxFieldValue>

Defined in: src/ax/dsp/optimize.ts:13

> AxFieldTemplateFn

AxFieldTemplateFn: (field, value) => any[]

Defined in: src/ax/dsp/prompt.ts:27

Parameters

ParameterType
fieldReadonly<AxField>
valueReadonly<AxFieldValue>

Returns

any[]

> AxFieldValue

AxFieldValue: string | string[] | number | boolean | object | null | undefined | { data: string; mimeType: string; } | object[] | { data: string; format: "wav"; } | object[]

Defined in: src/ax/dsp/program.ts:17

> AxFunctionExec

AxFunctionExec: object

Defined in: src/ax/dsp/functions.ts:19

Type declaration

id?

optional id: string

result?

optional result: string

> AxFunction

AxFunction: object

Defined in: src/ax/ai/types.ts:59

Type declaration

description

description: string

func

func: AxFunctionHandler

name

name: string

parameters?

optional parameters: AxFunctionJSONSchema

> AxFunctionHandler

AxFunctionHandler: (args?, extra?) => unknown

Defined in: src/ax/ai/types.ts:37

Parameters

ParameterType
args?any
extra?Readonly<{ sessionId: string; traceId: string; }>

Returns

unknown

> AxFunctionJSONSchema

AxFunctionJSONSchema: object

Defined in: src/ax/ai/types.ts:46

Type declaration

items?

optional items: AxFunctionJSONSchema

properties?

optional properties: Record<string, AxFunctionJSONSchema & object>

required?

optional required: string[]

type

type: string

> AxGenIn

AxGenIn: object

Defined in: src/ax/dsp/program.ts:30

Index Signature

[key: symbol]: AxFieldValue

> AxGenOut

AxGenOut: Record<string, AxFieldValue>

Defined in: src/ax/dsp/program.ts:32

> AxGenerateResult

AxGenerateResult<OUT>: OUT & object

Defined in: src/ax/dsp/generate.ts:67

Type declaration

functions?

optional functions: AxChatResponseFunctionCall[]

Type Parameters

Type Parameter
OUT extends AxGenOut

> AxIField

AxIField: Omit<AxField, "title"> & object

Defined in: src/ax/dsp/sig.ts:33

Type declaration

title

title: string

> AxInputFunctionType

AxInputFunctionType: AxFunction[] | object[]

Defined in: src/ax/dsp/functions.ts:92

> AxInternalChatRequest

AxInternalChatRequest: Omit<AxChatRequest, "model"> & Required<Pick<AxChatRequest, "model">>

Defined in: src/ax/ai/types.ts:190

> AxInternalEmbedRequest

AxInternalEmbedRequest: Omit<AxEmbedRequest, "embedModel"> & Required<Pick<AxEmbedRequest, "embedModel">>

Defined in: src/ax/ai/types.ts:198

> AxMetricFn

AxMetricFn: <T>(arg0) => boolean

Defined in: src/ax/dsp/optimize.ts:15

Type Parameters

Type ParameterDefault type
T extends AxGenOutAxGenOut

Parameters

ParameterType
arg0Readonly<{ example: AxExample; prediction: T; }>

Returns

boolean

> AxMetricFnArgs

AxMetricFnArgs: Parameters<AxMetricFn>[0]

Defined in: src/ax/dsp/optimize.ts:19

> AxModelConfig

AxModelConfig: object

Defined in: src/ax/ai/types.ts:24

Type declaration

endSequences?

optional endSequences: string[]

frequencyPenalty?

optional frequencyPenalty: number

maxTokens?

optional maxTokens: number

n?

optional n: number

presencePenalty?

optional presencePenalty: number

stopSequences?

optional stopSequences: string[]

stream?

optional stream: boolean

temperature?

optional temperature: number

topK?

optional topK: number

topP?

optional topP: number

> AxModelInfo

AxModelInfo: object

Defined in: src/ax/ai/types.ts:9

Type declaration

aliases?

optional aliases: string[]

characterIsToken?

optional characterIsToken: boolean

completionTokenCostPer1M?

optional completionTokenCostPer1M: number

currency?

optional currency: string

name

name: string

promptTokenCostPer1M?

optional promptTokenCostPer1M: number

> AxOptimizerArgs

AxOptimizerArgs<IN, OUT>: object

Defined in: src/ax/dsp/optimize.ts:21

Type Parameters

Type Parameter
IN extends AxGenIn
OUT extends AxGenOut

Type declaration

ai

ai: AxAIService

examples

examples: Readonly<AxExample[]>

options?

{ maxDemos: number; maxExamples: number; maxRounds: number; }

program

program: Readonly<AxProgram<IN, OUT>>

> AxModelInfoWithProvider

AxModelInfoWithProvider: AxModelInfo & object

Defined in: src/ax/ai/types.ts:98

Type declaration

provider

provider: string

> AxProgramDemos

AxProgramDemos: object

Defined in: src/ax/dsp/program.ts:40

Type declaration

programId

programId: string

traces

traces: Record<string, AxFieldValue>[]

> AxProgramExamples

AxProgramExamples: AxProgramDemos | AxProgramDemos["traces"]

Defined in: src/ax/dsp/program.ts:46

> AxProgramForwardOptions

AxProgramForwardOptions: object

Defined in: src/ax/dsp/program.ts:48

Type declaration

ai?

optional ai: AxAIService

debug?

optional debug: boolean

functionCall?

optional functionCall: AxChatRequest["functionCall"]

functions?

optional functions: AxFunction[]

maxCompletions?

optional maxCompletions: number

maxRetries?

optional maxRetries: number

maxSteps?

optional maxSteps: number

mem?

optional mem: AxAIMemory

model?

optional model: string

modelConfig?

optional modelConfig: AxModelConfig

rateLimiter?

optional rateLimiter: AxRateLimiterFunction

sessionId?

optional sessionId: string

stopFunction?

optional stopFunction: string

stream?

optional stream: boolean

traceId?

optional traceId: string

tracer?

optional tracer: Tracer

> AxProgramTrace

AxProgramTrace: object

Defined in: src/ax/dsp/program.ts:34

Type declaration

programId

programId: string

trace

trace: Record<string, AxFieldValue>

> AxProgramUsage

AxProgramUsage: AxChatResponse["modelUsage"] & object

Defined in: src/ax/dsp/program.ts:80

Type declaration

ai

ai: string

model

model: string

> AxRateLimiterFunction

AxRateLimiterFunction: <T>(reqFunc, info) => Promise<T | ReadableStream<T>>

Defined in: src/ax/ai/types.ts:201

Type Parameters

Type ParameterDefault type
Tunknown

Parameters

ParameterType
reqFunc() => Promise<T | ReadableStream<T>>
infoReadonly<{ embedModelUsage: AxTokenUsage; modelUsage: AxTokenUsage; }>

Returns

Promise<T | ReadableStream<T>>

> AxRerankerIn

AxRerankerIn: object

Defined in: src/ax/docs/manager.ts:11

Type declaration

items

items: string[]

query

query: string

> AxRerankerOut

AxRerankerOut: object

Defined in: src/ax/docs/manager.ts:12

Type declaration

rankedItems

rankedItems: string[]

> AxRewriteIn

AxRewriteIn: object

Defined in: src/ax/docs/manager.ts:8

Type declaration

query

query: string

> AxRewriteOut

AxRewriteOut: object

Defined in: src/ax/docs/manager.ts:9

Type declaration

rewrittenQuery

rewrittenQuery: string

> AxTokenUsage

AxTokenUsage: object

Defined in: src/ax/ai/types.ts:18

Type declaration

completionTokens

completionTokens: number

promptTokens

promptTokens: number

totalTokens

totalTokens: number