ax-llm/ax

每日信息看板 · 2026-03-07
开源项目
Category
github_search
Source
1
Score
2026-03-07T01:57:05Z
Published

AI 总结

Ax 是一个将 DSPy 方法引入 TypeScript 的开源框架,帮助开发者以类型安全方式构建可在多家 LLM 提供商间切换的生产级 AI 应用,从而减少提示词调试和基础设施维护成本。
#GitHub #repo #开源项目 #TypeScript #DSPy #Agents #RAG #Agent

内容摘录

Ax - Build Reliable AI Apps in TypeScript with DSPy

Ax brings DSPy's approach to TypeScript – describe what you want, and let the framework handle the rest. Production-ready, type-safe, works with all major LLMs.

NPM Package
Twitter
Discord Chat
The Problem

Building with LLMs is painful. You write prompts, test them, they break. You switch providers, everything needs rewriting. You add validation, error handling, retries – suddenly you're maintaining infrastructure instead of shipping features.
The Solution

Define what goes in and what comes out. Ax handles the rest.

No prompt engineering. No trial and error. Works with GPT-4, Claude, Gemini, or any LLM.
Why Ax

**Write once, run anywhere.** Switch between OpenAI, Anthropic, Google, or 15+ providers with one line. No rewrites.

**Ship faster.** Stop tweaking prompts. Define inputs and outputs. The framework generates optimal prompts automatically.

**Production-ready.** Built-in streaming, validation, error handling, observability. Used in production handling millions of requests.

**Gets smarter.** Train your programs with examples. Watch accuracy improve automatically. No ML expertise needed.
Examples
Extract structured data
Complex nested objects
Validation and constraints

Available constraints: .min(n), .max(n), .email(), .url(), .date(), .datetime(), .regex(pattern, description), .optional()

Validation runs on both input and output. Automatic retry with corrections on validation errors.
Agents with tools (ReAct pattern)
AxAgent + RLM for long context

RLM mode keeps long context out of the root prompt, runs iterative analysis in a persistent runtime session, and uses bounded sub-queries for semantic extraction (typically targeting <=10k chars per sub-call).
AxJSRuntime

AxJSRuntime is the built-in JavaScript runtime used by RLM and tool-style execution.
It works across:
Node.js/Bun-style backends (worker_threads runtime path)
Deno backends (module worker path)
Browser environments (Web Worker path)

It supports:
Persistent sessions via createSession()
Function tool usage via toFunction()
Sandbox permissions via AxJSRuntimePermission
Multi-modal (images, audio)
Install

Additional packages:
Features
**15+ LLM Providers** – OpenAI, Anthropic, Google, Mistral, Ollama, and more
**Type-safe** – Full TypeScript support with auto-completion
**Streaming** – Real-time responses with validation
**Multi-modal** – Images, audio, text in the same signature
**Optimization** – Automatic prompt tuning with MiPRO, ACE, GEPA
**Observability** – OpenTelemetry tracing built-in
**Workflows** – Compose complex pipelines with AxFlow
**RAG** – Multi-hop retrieval with quality loops
**Agents** – Tools and multi-agent collaboration
**RLM in AxAgent** – Long-context analysis with recursive runtime loops
**Zero dependencies** – Lightweight, fast, reliable
Documentation

**Get Started**
Quick Start Guide – Set up in 5 minutes
Examples Guide – Comprehensive examples
DSPy Concepts – Understanding the approach
Signatures Guide – Type-safe signature design

**Deep Dives**
AI Providers – All providers, AWS Bedrock, Vercel AI SDK
AxFlow Workflows – Build complex AI systems
Optimization (MiPRO, ACE, GEPA) – Make programs smarter
AxAgent & RLM – Agents, child agents, tools, and RLM for long contexts
Advanced RAG – Production search and retrieval
Run Examples

Core examples: extract.ts, react.ts, agent.ts, streaming1.ts, multi-modal.ts

Production patterns: customer-support.ts, food-search.ts, rlm.ts, ace-train-inference.ts, ax-flow-enhanced-demo.ts

View all 70+ examples
Community
Twitter – Updates
Discord – Help and discussion
GitHub – Star the project
DeepWiki – AI-powered docs
Production Ready
Battle-tested in production
Stable minor versions
Comprehensive test coverage
OpenTelemetry built-in
TypeScript first
Contributors
Author: @dosco
GEPA and ACE optimizers: @monotykamary
License

Apache 2.0

---