22
33** Stop wrestling with prompts. Start shipping AI features.**
44
5- Ax brings DSPy's revolutionary approach to TypeScript – just describe what you want, and let the framework handle the rest. Production-ready, type-safe, and works with all major LLMs.
5+ Ax brings DSPy's revolutionary approach to TypeScript – just describe what you
6+ want, and let the framework handle the rest. Production-ready, type-safe, and
7+ works with all major LLMs.
68
79[ ![ NPM Package] ( https://img.shields.io/npm/v/@ax-llm/ax?style=for-the-badge&color=green )] ( https://www.npmjs.com/package/@ax-llm/ax )
810[ ![ Twitter] ( https://img.shields.io/twitter/follow/dosco?style=for-the-badge&color=red )] ( https://twitter.com/dosco )
@@ -17,69 +19,105 @@ import { ai, ax } from "@ax-llm/ax";
1719const llm = ai ({ name: " openai" , apiKey: process .env .OPENAI_APIKEY ! });
1820
1921// 2. Say what you want
20- const classifier = ax (' review:string -> sentiment:class "positive, negative, neutral"' );
22+ const classifier = ax (
23+ ' review:string -> sentiment:class "positive, negative, neutral"' ,
24+ );
2125
2226// 3. Get type-safe results
23- const result = await classifier .forward (llm , {
24- review: " This product is amazing!"
27+ const result = await classifier .forward (llm , {
28+ review: " This product is amazing!" ,
2529});
2630console .log (result .sentiment ); // "positive" ✨
2731```
2832
29- ** That's it.** No prompt engineering. No trial and error. It works with GPT-4, Claude, Gemini, or any LLM.
33+ ** That's it.** No prompt engineering. No trial and error. It works with GPT-4,
34+ Claude, Gemini, or any LLM.
3035
3136## Why Thousands of Developers Choose Ax
3237
3338### 🎯 ** Define Once, Run Anywhere**
34- Write your logic once. Switch between OpenAI, Anthropic, Google, or 15+ providers with one line. No rewrites needed.
39+
40+ Write your logic once. Switch between OpenAI, Anthropic, Google, or 15+
41+ providers with one line. No rewrites needed.
3542
3643### ⚡ ** Ship 10x Faster**
37- Stop tweaking prompts. Define inputs → outputs. The framework generates optimal prompts automatically.
44+
45+ Stop tweaking prompts. Define inputs → outputs. The framework generates optimal
46+ prompts automatically.
3847
3948### 🛡️ ** Production-Ready from Day One**
40- Built-in streaming, validation, error handling, observability. Used by startups in production handling millions of requests.
49+
50+ Built-in streaming, validation, error handling, observability. Used by startups
51+ in production handling millions of requests.
4152
4253### 🚀 ** Gets Smarter Over Time**
43- Train your programs with examples. Watch accuracy improve automatically. No ML expertise needed.
54+
55+ Train your programs with examples. Watch accuracy improve automatically. No ML
56+ expertise needed.
4457
4558## Real Apps, Real Simple
4659
47- ### Intelligent Customer Support
60+ ### Extract Structured Data from Customer Emails
61+
4862``` typescript
49- const supportAgent = ax (`
50- message:string ->
51- category:class "billing, technical, general",
52- priority:class "high, medium, low",
53- response:string
63+ const extractor = ax (`
64+ customerEmail:string, currentDate:datetime ->
65+ priority:class "high, normal, low",
66+ sentiment:class "positive, negative, neutral",
67+ ticketNumber?:number,
68+ nextSteps:string[],
69+ estimatedResponseTime:string
5470` );
55- // Complete ticket routing + response generation in 4 lines
71+
72+ const result = await extractor .forward (ai , {
73+ customerEmail: " Order #12345 hasn't arrived. Need this resolved immediately!" ,
74+ currentDate: new Date (),
75+ });
76+ // Automatically extracts all fields with proper types and validation
5677```
5778
58- ### Multi-Modal Analysis
79+ ### Build Agents That Use Tools (ReAct Pattern)
80+
5981``` typescript
60- const analyzer = ax (" image:image, question:string -> answer:string" );
61- // Computer vision without the complexity
82+ const assistant = ax (
83+ " question:string -> answer:string" ,
84+ {
85+ functions: [
86+ { name: " getCurrentWeather" , func: weatherAPI },
87+ { name: " searchNews" , func: newsAPI },
88+ ],
89+ },
90+ );
91+
92+ const result = await assistant .forward (ai , {
93+ question: " What's the weather in Tokyo and any news about it?" ,
94+ });
95+ // AI automatically calls both functions and combines results
6296```
6397
64- ### Smart Document Processing
98+ ### Multi-Modal Analysis with Images
99+
65100``` typescript
66- const extractor = ax (`
67- document:string ->
68- summary:string,
69- keyPoints:string[],
70- actionItems:string[]
101+ const analyzer = ax (`
102+ image:image, question:string ->
103+ description:string,
104+ mainColors:string[],
105+ category:class "electronics, clothing, food, other",
106+ estimatedPrice:string
71107` );
72- // Extract structured data from any document
108+ // Process images and text together seamlessly
73109```
74110
75111## Quick Start
76112
77113### Install
114+
78115``` bash
79116npm install @ax-llm/ax
80117```
81118
82119### Your First AI Feature (2 minutes)
120+
83121``` typescript
84122import { ai , ax } from " @ax-llm/ax" ;
85123
@@ -93,14 +131,15 @@ const translator = ax(`
93131
94132const result = await translator .forward (llm , {
95133 text: " Hello world" ,
96- language: " Spanish"
134+ language: " Spanish" ,
97135});
98136console .log (result .translation ); // "Hola mundo"
99137```
100138
101139## Powerful Features, Zero Complexity
102140
103- - ✅ ** 15+ LLM Providers** - OpenAI, Anthropic, Google, Mistral, Ollama, and more
141+ - ✅ ** 15+ LLM Providers** - OpenAI, Anthropic, Google, Mistral, Ollama, and
142+ more
104143- ✅ ** Type-Safe Everything** - Full TypeScript support with auto-completion
105144- ✅ ** Streaming First** - Real-time responses with validation
106145- ✅ ** Multi-Modal** - Images, audio, text in the same signature
@@ -114,37 +153,56 @@ console.log(result.translation); // "Hola mundo"
114153## Learn More
115154
116155### 🚀 Quick Wins
117- - [ ** Getting Started Guide** ] ( https://github.com/ax-llm/ax/blob/main/QUICKSTART.md ) - Set up in 5 minutes
118- - [ ** DSPy Concepts** ] ( https://github.com/ax-llm/ax/blob/main/DSPY.md ) - Understand the revolutionary approach
119- - [ ** Examples** ] ( #examples ) - Copy-paste templates for common use cases
156+
157+ - [ ** Getting Started Guide** ] ( https://github.com/ax-llm/ax/blob/main/docs/QUICKSTART.md ) -
158+ Set up in 5 minutes
159+ - [ ** Examples Guide** ] ( https://github.com/ax-llm/ax/blob/main/docs/EXAMPLES.md ) -
160+ Comprehensive examples with explanations
161+ - [ ** DSPy Concepts** ] ( https://github.com/ax-llm/ax/blob/main/docs/DSPY.md ) -
162+ Understand the revolutionary approach
120163
121164### 📚 Deep Dives
122- - [ ** AxFlow Workflows** ] ( https://github.com/ax-llm/ax/blob/main/AXFLOW.md ) - Build complex AI systems
123- - [ ** Optimization Guide** ] ( https://github.com/ax-llm/ax/blob/main/OPTIMIZE.md ) - Make your programs smarter
124- - [ ** Advanced RAG** ] ( https://github.com/ax-llm/ax/blob/main/AXRAG.md ) - Production search & retrieval
125- - [ ** API Reference** ] ( https://github.com/ax-llm/ax/blob/main/API.md ) - Complete documentation
165+
166+ - [ ** AxFlow Workflows** ] ( https://github.com/ax-llm/ax/blob/main/docs/AXFLOW.md ) -
167+ Build complex AI systems
168+ - [ ** Optimization Guide** ] ( https://github.com/ax-llm/ax/blob/main/docs/OPTIMIZE.md ) -
169+ Make your programs smarter
170+ - [ ** Advanced RAG** ] ( https://github.com/ax-llm/ax/blob/main/docs/AXRAG.md ) -
171+ Production search & retrieval
172+ - [ ** API Reference** ] ( https://github.com/ax-llm/ax/blob/main/docs/API.md ) -
173+ Complete documentation
126174
127175## Examples
128176
129177Run any example:
178+
130179``` bash
131180OPENAI_APIKEY=your-key npm run tsx ./src/examples/[example-name].ts
132181```
133182
134- ### Essential Examples
135- - [ summarize.ts] ( src/examples/summarize.ts ) - Text summarization
136- - [ simple-classify.ts] ( src/examples/simple-classify.ts ) - Classification tasks
137- - [ agent.ts] ( src/examples/agent.ts ) - Agent framework basics
138- - [ streaming1.ts] ( src/examples/streaming1.ts ) - Real-time streaming
183+ ### Core Examples
184+
185+ - [ extract.ts] ( src/examples/extract.ts ) - Extract structured data from text
186+ - [ react.ts] ( src/examples/react.ts ) - ReAct pattern with function calling
187+ - [ agent.ts] ( src/examples/agent.ts ) - Multi-agent collaboration
188+ - [ streaming1.ts] ( src/examples/streaming1.ts ) - Real-time streaming responses
139189- [ multi-modal.ts] ( src/examples/multi-modal.ts ) - Image + text processing
140190
141191### Production Patterns
142- - [ customer-support.ts] ( src/examples/customer-support.ts ) - Customer service automation
143- - [ advanced-rag.ts] ( src/examples/advanced-rag.ts ) - Enterprise RAG implementation
144- - [ ax-flow.ts] ( src/examples/ax-flow.ts ) - Complex workflow orchestration
145- - [ tune-mipro.ts] ( src/examples/tune-mipro.ts ) - Automatic optimization
146192
147- [ View All 50+ Examples →] ( src/examples/ )
193+ - [ customer-support.ts] ( src/examples/customer-support.ts ) - Complete support
194+ system
195+ - [ food-search.ts] ( src/examples/food-search.ts ) - Restaurant recommendations
196+ with tools
197+ - [ simple-optimizer-test.ts] ( src/examples/simple-optimizer-test.ts ) - Automatic
198+ optimization
199+ - [ mipro-python-optimizer.ts] ( src/examples/mipro-python-optimizer.ts ) - Advanced
200+ MIPRO optimization
201+ - [ ax-flow-enhanced-demo.ts] ( src/examples/ax-flow-enhanced-demo.ts ) - Complex
202+ workflows
203+
204+ [ 📚 ** View Full Examples Guide** →] ( docs/EXAMPLES.md ) \
205+ [ View All 70+ Examples →] ( src/examples/ )
148206
149207## Join the Community
150208
@@ -167,10 +225,11 @@ MIT - Use it anywhere, build anything.
167225
168226---
169227
170- ** Ready to build the future?** Stop fighting with prompts. Start shipping with signatures.
228+ ** Ready to build the future?** Stop fighting with prompts. Start shipping with
229+ signatures.
171230
172231``` bash
173232npm install @ax-llm/ax
174233```
175234
176- * Built with ❤️ by developers, for developers.*
235+ _ Built with ❤️ by developers, for developers._
0 commit comments