@ax-llm/ax 22.0.3 → 22.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/index.cjs +190 -190
- package/index.cjs.map +1 -1
- package/index.d.cts +8 -2
- package/index.d.ts +8 -2
- package/index.global.js +161 -161
- package/index.global.js.map +1 -1
- package/index.js +179 -179
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/ax-agent-memory-skills.md +3 -2
- package/skills/ax-agent-observability.md +1 -1
- package/skills/ax-agent-optimize.md +3 -2
- package/skills/ax-agent-rlm.md +8 -3
- package/skills/ax-agent.md +4 -4
- package/skills/ax-ai.md +1 -1
- package/skills/ax-audio.md +1 -1
- package/skills/ax-flow.md +4 -2
- package/skills/ax-gen.md +1 -1
- package/skills/ax-gepa.md +15 -17
- package/skills/ax-llm.md +3 -3
- package/skills/ax-refine.md +1 -1
- package/skills/ax-signature.md +1 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-agent-memory-skills
|
|
3
3
|
description: This skill helps an LLM generate correct AxAgent memory retrieval, context-map, and dynamic skill-loading code using @ax-llm/ax. Use when the user asks about contextMap, AxAgentContextMap, onMemoriesSearch, recall(...), inputs.memories, onLoadedMemories, onUsedMemories, onSkillsSearch, discover({ skills }), onLoadedSkills, onUsedSkills, preloaded skills, loaded memory/skill IDs, or carrying memories across forward() calls.
|
|
4
|
-
version: "22.0.
|
|
4
|
+
version: "22.0.4"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AxAgent Memory And Skills Rules (@ax-llm/ax)
|
|
@@ -24,7 +24,7 @@ Use this skill when an agent needs a persistent context map, task-relevant memor
|
|
|
24
24
|
|
|
25
25
|
Use `contextMap` when repeated runs ask different questions over the same long context, document set, or repository. The map is prompt-resident orientation knowledge: structure, concepts, constants, parsing schema, reusable aggregate results, and concrete error patterns. It is not a task-specific answer cache.
|
|
26
26
|
|
|
27
|
-
Runnable example: [`src/examples/rlm-context-map.ts`](https://raw.githubusercontent.com/ax-llm/ax/refs/heads/main/src/examples/rlm-context-map.ts) demonstrates
|
|
27
|
+
Runnable example: [`src/examples/rlm-context-map-live.ts`](https://raw.githubusercontent.com/ax-llm/ax/refs/heads/main/src/examples/rlm-context-map-live.ts) demonstrates a provider-backed context-map update, `onUpdate` snapshot persistence, finite evolve, and frozen map reuse.
|
|
28
28
|
|
|
29
29
|
When `contextMap` is configured:
|
|
30
30
|
|
|
@@ -325,6 +325,7 @@ skills?: readonly AxAgentSkillResult[];
|
|
|
325
325
|
Fetch this for full working code:
|
|
326
326
|
|
|
327
327
|
- [RLM Memories and Skills](https://raw.githubusercontent.com/ax-llm/ax/refs/heads/main/src/examples/rlm-memories-and-skills.ts) - `onMemoriesSearch` + `recall()` and `onSkillsSearch` + `discover({ skills })` with load observability and actual usage tracking via `onUsedMemories` / `onUsedSkills`
|
|
328
|
+
- [Skills + Memory Ops Assistant](https://raw.githubusercontent.com/ax-llm/ax/refs/heads/main/src/examples/typescript/long-agents/skills-and-memory-assistant.ts) - an on-call assistant that recalls past decisions from a memory store and loads the right runbook skill on demand (also ported to Python, Go, Rust, Java, and C++ under `src/examples/<lang>/long-agents/`). All six languages support the native `onMemoriesSearch` / `onSkillsSearch` host callbacks, passed in the agent options at construction (Go/Java use native function values, Rust a `agent_with_search_callbacks` constructor, C++ a `register_*_search` helper); a static `memory_search_results` / `skill_search_results` config is also available.
|
|
328
329
|
|
|
329
330
|
## Do Not Generate
|
|
330
331
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-agent-observability
|
|
3
3
|
description: This skill helps an LLM generate correct AxAgent observability code using @ax-llm/ax. Use when the user asks about actorTurnCallback, onContextEvent, agentStatusCallback, onFunctionCall, reportSuccess, reportFailure, getChatLog(), getUsage(), resetUsage(), debug traces, progress updates, or telemetry for AxAgent runs.
|
|
4
|
-
version: "22.0.
|
|
4
|
+
version: "22.0.4"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AxAgent Observability Rules (@ax-llm/ax)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-agent-optimize
|
|
3
3
|
description: This skill helps an LLM generate correct AxAgent tuning and evaluation code using @ax-llm/ax. Use when the user asks about agent.optimize(...), judgeOptions, eval datasets, optimization targets, saved optimizedProgram artifacts, or agent optimization guidance.
|
|
4
|
-
version: "22.0.
|
|
4
|
+
version: "22.0.4"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AxAgent Optimize Codegen Rules (@ax-llm/ax)
|
|
8
8
|
|
|
9
|
-
Use this skill for `agent.optimize(...)` workflows. Prefer short, modern, copyable patterns. Do not repeat general agent-authoring guidance unless the user needs it.
|
|
9
|
+
Use this skill for `agent.optimize(...)` workflows. Prefer short, modern, copyable patterns. Do not repeat general agent-authoring guidance unless the user needs it. For generic `ax(...)` or `flow(...)` tuning with top-level `optimize(...)`, use the `ax-gepa` skill instead.
|
|
10
10
|
|
|
11
11
|
Your job is to help the model choose a good optimization setup for the user's actual goal:
|
|
12
12
|
|
|
@@ -19,6 +19,7 @@ Your job is to help the model choose a good optimization setup for the user's ac
|
|
|
19
19
|
|
|
20
20
|
- Use `agent.optimize(...)` only after the agent is already configured and runnable.
|
|
21
21
|
- Prefer the built-in judge path first for normal agent tuning. Most users should start with tasks that include `input` and `criteria`, then let `agent.optimize(...)` use its default actor target and judge-based metric.
|
|
22
|
+
- Keep top-level `optimize(program, train, metric, options)` for non-agent generators and flows; do not rewrite normal agent task-record examples to the generic helper.
|
|
22
23
|
- Prefer a deterministic custom `metric` only when success is easy to score from the prediction and task record.
|
|
23
24
|
- Add `judgeAI` plus `judgeOptions` when the judge should run on a stronger or separate model than the agent runtime model.
|
|
24
25
|
- Only reach for a plain typed `AxGen` evaluator when the user needs LLM-as-judge behavior outside the built-in `agent.optimize(...)` flow.
|
package/skills/ax-agent-rlm.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-agent-rlm
|
|
3
3
|
description: This skill helps an LLM generate correct AxAgent RLM/runtime code using @ax-llm/ax. Use when the user asks about RLM code execution, AxJSRuntime, contextFields, contextPolicy, liveRuntimeState, promptLevel, stage prompt controls, executorModelPolicy, maxRuntimeChars, agent.test(...), llmQuery(...), recursionOptions, or long-running agent runtime behavior.
|
|
4
|
-
version: "22.0.
|
|
4
|
+
version: "22.0.4"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AxAgent RLM Runtime Rules (@ax-llm/ax)
|
|
@@ -470,8 +470,13 @@ Fetch these for full working code:
|
|
|
470
470
|
- [RLM Long Task](https://raw.githubusercontent.com/ax-llm/ax/refs/heads/main/src/examples/rlm-long-task.ts) - RLM context policy
|
|
471
471
|
- [RLM Discovery](https://raw.githubusercontent.com/ax-llm/ax/refs/heads/main/src/examples/rlm-discovery.ts) - discovery mode, grouped tools, child agents as functions, and semantic `llmQuery(...)`
|
|
472
472
|
- [RLM Adaptive Replay](https://raw.githubusercontent.com/ax-llm/ax/refs/heads/main/src/examples/rlm-adaptive-replay.ts) - adaptive replay
|
|
473
|
-
|
|
474
|
-
-
|
|
473
|
+
|
|
474
|
+
Flagship real-world long-agents (also ported to Python, Go, Rust, Java, and C++ under `src/examples/<lang>/long-agents/`; run with `npm run example -- <lang> <path>`):
|
|
475
|
+
|
|
476
|
+
- [Incident Log Forensics](https://raw.githubusercontent.com/ax-llm/ax/refs/heads/main/src/examples/typescript/long-agents/incident-log-forensics.ts) - large-context log forensics over `contextFields` (Gemini)
|
|
477
|
+
- [Codebase Peek Map](https://raw.githubusercontent.com/ax-llm/ax/refs/heads/main/src/examples/typescript/long-agents/codebase-peek-map.ts) - Peek-paper context-map orientation over a large repo snapshot
|
|
478
|
+
- [Data Analyst with Tools](https://raw.githubusercontent.com/ax-llm/ax/refs/heads/main/src/examples/typescript/long-agents/data-analyst-with-tools.ts) - large data dictionary in `contextFields` + typed warehouse tools the model queries instead of inlining
|
|
479
|
+
- [Self-Improving Lab](https://raw.githubusercontent.com/ax-llm/ax/refs/heads/main/src/examples/typescript/long-agents/self-improving-lab.ts) - many-tool agent that runs experiments, grades them with an independent verifier, and distills verified rules into memory
|
|
475
480
|
|
|
476
481
|
## Do Not Generate
|
|
477
482
|
|
package/skills/ax-agent.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-agent
|
|
3
3
|
description: This skill helps an LLM generate correct core AxAgent code using @ax-llm/ax. Use when the user asks about agent(), child agents, namespaced functions, discovery mode, clarification, bubbleErrors, host-side final/clarification protocol, or ordinary agent runtime behavior. For RLM/code-runtime work use ax-agent-rlm; for callbacks and telemetry use ax-agent-observability; for recall/memory/skill loading use ax-agent-memory-skills; for agent.optimize(...) use ax-agent-optimize.
|
|
4
|
-
version: "22.0.
|
|
4
|
+
version: "22.0.4"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AxAgent Codegen Rules (@ax-llm/ax)
|
|
@@ -558,7 +558,7 @@ Use these method groups as the compact AxAgent surface map:
|
|
|
558
558
|
|
|
559
559
|
- Running: `forward(ai, values, options?)` and `streamingForward(ai, values, options?)`.
|
|
560
560
|
- Forward-time agent options: `skills`, `onUsedMemories`, and `onUsedSkills`; use `ax-agent-memory-skills` for details.
|
|
561
|
-
- State and control: `getState()`, `setState(state?)`, `getContextMap()`, `setContextMap(map?)`, `stop()`, `getSignature()`, `setSignature(signature)`, `getFunction()`, `getId()`, and `setId(id)`. Context-map evolve policy lives on `AxAgentContextMap` (`infiniteEvolve`, `evolveSteps`, `maxChars`), not on the agent config. See [`src/examples/rlm-context-map.ts`](https://raw.githubusercontent.com/ax-llm/ax/refs/heads/main/src/examples/rlm-context-map.ts) for persistence and finite-evolve usage.
|
|
561
|
+
- State and control: `getState()`, `setState(state?)`, `getContextMap()`, `setContextMap(map?)`, `stop()`, `getSignature()`, `setSignature(signature)`, `getFunction()`, `getId()`, and `setId(id)`. Context-map evolve policy lives on `AxAgentContextMap` (`infiniteEvolve`, `evolveSteps`, `maxChars`), not on the agent config. See [`src/examples/rlm-context-map-live.ts`](https://raw.githubusercontent.com/ax-llm/ax/refs/heads/main/src/examples/rlm-context-map-live.ts) for provider-backed persistence and finite-evolve usage.
|
|
562
562
|
- Observability: `getChatLog()`, `getUsage()`, `getStagedUsage()`, `resetUsage()`, and `getTraces()`; use `ax-agent-observability` for details.
|
|
563
563
|
- Demos and tuning: `setDemos(...)`, `namedPrograms()`, `namedProgramInstances()`, `optimize(...)`, `applyOptimization(...)`, `getOptimizableComponents()`, and `applyOptimizedComponents(...)`; use `ax-agent-optimize` for tuning details.
|
|
564
564
|
|
|
@@ -575,9 +575,9 @@ When the user wants `agent.optimize(...)`, judge configuration, eval datasets, s
|
|
|
575
575
|
|
|
576
576
|
Keep this skill focused on building and running agents. For tuning work:
|
|
577
577
|
|
|
578
|
-
- use eval-safe tools
|
|
578
|
+
- use eval-safe tools
|
|
579
579
|
- treat `judgeOptions` as part of the optimize workflow
|
|
580
|
-
- choose
|
|
580
|
+
- choose an objective `metric` when scoring is mechanical; use the built-in judge only when run quality needs qualitative review
|
|
581
581
|
- keep runtime authoring guidance here and optimization guidance in `ax-agent-optimize`
|
|
582
582
|
|
|
583
583
|
## Examples
|
package/skills/ax-ai.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-ai
|
|
3
3
|
description: This skill helps an LLM generate correct AI provider setup and configuration code using @ax-llm/ax. Use when the user asks about ai(), providers, models, presets, embeddings, batch audio with ai.transcribe() or ai.speak(), extended thinking, context caching, or mentions OpenAI/Anthropic/Google/Azure/DeepSeek/Mistral/Cohere/Reka/Grok with @ax-llm/ax.
|
|
4
|
-
version: "22.0.
|
|
4
|
+
version: "22.0.4"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AI Provider Codegen Rules (@ax-llm/ax)
|
package/skills/ax-audio.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-audio
|
|
3
3
|
description: This skill helps an LLM generate correct audio code with @ax-llm/ax. Use when the user asks about ai.transcribe(), ai.speak(), signature audio inputs or outputs, agent audio behavior, .chat() conversational audio, OpenAI audio or realtime models, Gemini Live native audio, Grok Voice Agent models, voices, formats, transcripts, or how audio fits with structured outputs.
|
|
4
|
-
version: "22.0.
|
|
4
|
+
version: "22.0.4"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Audio I/O Codegen Rules (@ax-llm/ax)
|
package/skills/ax-flow.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-flow
|
|
3
3
|
description: This skill helps an LLM generate correct AxFlow workflow code using @ax-llm/ax. Use when the user asks about flow(), AxFlow, workflow orchestration, parallel execution, DAG workflows, conditional routing, map/reduce patterns, or multi-node AI pipelines.
|
|
4
|
-
version: "22.0.
|
|
4
|
+
version: "22.0.4"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AxFlow Codegen Rules (@ax-llm/ax)
|
|
@@ -386,6 +386,9 @@ wf.setDemos([{ programId: 'root.summarizer', traces: [] }]);
|
|
|
386
386
|
wf.applyOptimization(optimizedProgram);
|
|
387
387
|
```
|
|
388
388
|
|
|
389
|
+
For tuning a flow, use top-level `optimize(wf, train, metric, options)` from the
|
|
390
|
+
`ax-gepa` skill. There is no separate `flow.optimize(...)` helper.
|
|
391
|
+
|
|
389
392
|
## Chat Logs
|
|
390
393
|
|
|
391
394
|
`AxFlow.getChatLog()` returns a flat `readonly AxChatLogEntry[]` after `forward()`. Each child-node entry is tagged with `entry.name` so callers can filter by node:
|
|
@@ -424,7 +427,6 @@ Fetch these for full working code:
|
|
|
424
427
|
- [Enhanced Demo](https://raw.githubusercontent.com/ax-llm/ax/refs/heads/main/src/examples/ax-flow-enhanced-demo.ts) — instance-based nodes
|
|
425
428
|
- [Flow as Function](https://raw.githubusercontent.com/ax-llm/ax/refs/heads/main/src/examples/ax-flow-to-function.ts) — flow as callable function
|
|
426
429
|
- [Fluent Builder](https://raw.githubusercontent.com/ax-llm/ax/refs/heads/main/src/examples/fluent-flow-example.ts) — fluent builder pattern
|
|
427
|
-
- [Flow Logging](https://raw.githubusercontent.com/ax-llm/ax/refs/heads/main/src/examples/flow-logging-simple.ts) — flow logging
|
|
428
430
|
- [Load Balancing](https://raw.githubusercontent.com/ax-llm/ax/refs/heads/main/src/examples/balancer.ts) — load balancing
|
|
429
431
|
|
|
430
432
|
## Do Not Generate
|
package/skills/ax-gen.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-gen
|
|
3
3
|
description: This skill helps an LLM generate correct AxGen code using @ax-llm/ax. Use when the user asks about ax(), AxGen, generators, forward(), streamingForward(), validation, assertions, streaming assertions, field processors, step hooks, self-tuning, or structured outputs.
|
|
4
|
-
version: "22.0.
|
|
4
|
+
version: "22.0.4"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# AxGen Codegen Rules (@ax-llm/ax)
|
package/skills/ax-gepa.md
CHANGED
|
@@ -1,28 +1,29 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-gepa
|
|
3
3
|
description: This skill helps an LLM generate correct AxGEPA optimization code using @ax-llm/ax. Use when the user asks about AxGEPA, GEPA, Pareto optimization, multi-objective prompt tuning, reflective prompt evolution, validationExamples, maxMetricCalls, or optimizing a generator, flow, or agent tree.
|
|
4
|
-
version: "22.0.
|
|
4
|
+
version: "22.0.4"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
|
-
#
|
|
7
|
+
# GEPA Optimization Codegen Rules (@ax-llm/ax)
|
|
8
8
|
|
|
9
|
-
Use this skill to generate
|
|
9
|
+
Use this skill to generate GEPA optimization code. Prefer the top-level `optimize(...)` helper for normal code, and use direct `AxGEPA` / `AxBootstrapFewShot` only when the user needs low-level optimizer control.
|
|
10
10
|
|
|
11
11
|
## Use These Defaults
|
|
12
12
|
|
|
13
|
-
- Use `
|
|
13
|
+
- Use `optimize(program, train, metric, { studentAI, teacherAI, ... })` for normal generator and flow tuning.
|
|
14
14
|
- Prefer `ai()`, `ax()`, and `flow()` for new code.
|
|
15
15
|
- Use a strong `teacherAI` and a cheaper `studentAI`.
|
|
16
|
-
-
|
|
17
|
-
-
|
|
16
|
+
- Pass `validationExamples` when you have a holdout set.
|
|
17
|
+
- Set `maxMetricCalls` to bound optimizer cost; `optimize(...)` defaults it to `100`.
|
|
18
18
|
- Use scalar metrics for one objective and object metrics for Pareto optimization.
|
|
19
19
|
- Apply results with `program.applyOptimization(result.optimizedProgram!)`.
|
|
20
20
|
- For tree-wide runs, expect `optimizedProgram.componentMap`.
|
|
21
21
|
- Persist artifacts with `axSerializeOptimizedProgram(...)` and restore them with `axDeserializeOptimizedProgram(...)` so the same flow works in browsers and Node.
|
|
22
|
+
- `optimize(...)` runs `AxBootstrapFewShot -> AxGEPA` for small starter sets by default, preserving the demos in `result.optimizedProgram.demos`.
|
|
22
23
|
|
|
23
24
|
## Critical Rules
|
|
24
25
|
|
|
25
|
-
- `AxGEPA.compile()`
|
|
26
|
+
- `optimize(...)` and `AxGEPA.compile()` work for a single generator and for tree-aware roots such as flows or agents with registered optimizable descendants.
|
|
26
27
|
- There is no separate flow-only GEPA optimizer. Use `AxGEPA` for flows too.
|
|
27
28
|
- The metric may return either `number` or `Record<string, number>`.
|
|
28
29
|
- Keep metrics deterministic and cheap by default.
|
|
@@ -32,7 +33,7 @@ Use this skill to generate direct `AxGEPA` optimization code. Prefer short, mode
|
|
|
32
33
|
- GEPA optimizes generic string components exposed by `getOptimizableComponents()`. If a tree exposes no components, optimization will fail.
|
|
33
34
|
- Use held-out validation examples for selection. Do not reuse the training set as `validationExamples`.
|
|
34
35
|
- `result.optimizedProgram` is the easy-to-apply best candidate. `result.paretoFront` is the full trade-off set for multi-objective runs.
|
|
35
|
-
-
|
|
36
|
+
- Direct `AxGEPA` still has its own `bootstrap` option, but top-level `optimize(...)` composes the existing `AxBootstrapFewShot` optimizer before GEPA instead.
|
|
36
37
|
|
|
37
38
|
## Metric Selection
|
|
38
39
|
|
|
@@ -45,13 +46,13 @@ Choose the evaluation path deliberately:
|
|
|
45
46
|
|
|
46
47
|
Rule of thumb:
|
|
47
48
|
|
|
48
|
-
- `
|
|
49
|
+
- `optimize(...)` on `AxGen` or flow: use a metric first, optionally a plain typed `AxGen` evaluator if needed.
|
|
49
50
|
- `agent.optimize(...)`: use custom `metric` for crisp scoring, otherwise let the built-in judge handle scoring. Add `judgeAI` plus `judgeOptions` only when you want a stronger or separate judge model.
|
|
50
51
|
|
|
51
52
|
## Canonical Scalar Pattern
|
|
52
53
|
|
|
53
54
|
```typescript
|
|
54
|
-
import { ai, ax,
|
|
55
|
+
import { ai, ax, optimize, AxAIOpenAIModel } from '@ax-llm/ax';
|
|
55
56
|
|
|
56
57
|
const student = ai({
|
|
57
58
|
name: 'openai',
|
|
@@ -82,7 +83,7 @@ const validation = [
|
|
|
82
83
|
const metric = ({ prediction, example }: { prediction: any; example: any }) =>
|
|
83
84
|
prediction?.priority === example?.priority ? 1 : 0;
|
|
84
85
|
|
|
85
|
-
const
|
|
86
|
+
const result = await optimize(classifier, train, metric, {
|
|
86
87
|
studentAI: student,
|
|
87
88
|
teacherAI: teacher,
|
|
88
89
|
numTrials: 12,
|
|
@@ -90,9 +91,6 @@ const optimizer = new AxGEPA({
|
|
|
90
91
|
minibatchSize: 4,
|
|
91
92
|
earlyStoppingTrials: 4,
|
|
92
93
|
sampleCount: 1,
|
|
93
|
-
});
|
|
94
|
-
|
|
95
|
-
const result = await optimizer.compile(classifier, train, metric, {
|
|
96
94
|
validationExamples: validation,
|
|
97
95
|
maxMetricCalls: 120,
|
|
98
96
|
});
|
|
@@ -104,7 +102,7 @@ console.log(result.bestScore);
|
|
|
104
102
|
## Canonical Pareto Pattern
|
|
105
103
|
|
|
106
104
|
```typescript
|
|
107
|
-
import { ai, flow,
|
|
105
|
+
import { ai, flow, optimize, AxAIOpenAIModel } from '@ax-llm/ax';
|
|
108
106
|
|
|
109
107
|
const student = ai({
|
|
110
108
|
name: 'openai',
|
|
@@ -153,7 +151,7 @@ const metric = ({ prediction, example }: { prediction: any; example: any }) => {
|
|
|
153
151
|
return { accuracy, brevity };
|
|
154
152
|
};
|
|
155
153
|
|
|
156
|
-
const result = await
|
|
154
|
+
const result = await optimize(wf, train, metric, {
|
|
157
155
|
studentAI: student,
|
|
158
156
|
teacherAI: teacher,
|
|
159
157
|
numTrials: 16,
|
|
@@ -161,7 +159,6 @@ const result = await new AxGEPA({
|
|
|
161
159
|
minibatchSize: 6,
|
|
162
160
|
earlyStoppingTrials: 5,
|
|
163
161
|
sampleCount: 1,
|
|
164
|
-
}).compile(wf, train, metric, {
|
|
165
162
|
validationExamples: validation,
|
|
166
163
|
maxMetricCalls: 240,
|
|
167
164
|
});
|
|
@@ -259,6 +256,7 @@ const optimizer = new AxGEPA({
|
|
|
259
256
|
|
|
260
257
|
## Good Example Targets
|
|
261
258
|
|
|
259
|
+
- `/Users/vr/src/ax/src/examples/optimize.ts`
|
|
262
260
|
- `/Users/vr/src/ax/src/examples/gepa.ts`
|
|
263
261
|
- `/Users/vr/src/ax/src/examples/gepa-flow.ts`
|
|
264
262
|
- `/Users/vr/src/ax/src/examples/gepa-train-inference.ts`
|
package/skills/ax-llm.md
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-llm
|
|
3
3
|
description: This skill helps with using the @ax-llm/ax TypeScript library for building LLM applications. Use when the user asks about ax(), ai(), f(), s(), agent(), flow(), AxGen, AxAgent, AxFlow, signatures, streaming, or mentions @ax-llm/ax.
|
|
4
|
-
version: "22.0.
|
|
4
|
+
version: "22.0.4"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Ax Library (@ax-llm/ax) Quick Reference
|
|
8
8
|
|
|
9
9
|
Ax is a TypeScript library for building LLM-powered applications with type-safe signatures, streaming support, and multi-provider compatibility.
|
|
10
10
|
|
|
11
|
-
> **Detailed skills available:** ax-ai (providers), ax-signature (signatures/types), ax-gen (generators), ax-agent (core agents/tools), ax-agent-rlm (agent runtime/RLM/delegation), ax-agent-observability (callbacks/logs/usage), ax-agent-memory-skills (recall and dynamic skill loading), ax-agent-optimize (agent tuning/eval), ax-flow (workflows), ax-gepa (Pareto optimization).
|
|
11
|
+
> **Detailed skills available:** ax-ai (providers), ax-signature (signatures/types), ax-gen (generators), ax-agent (core agents/tools), ax-agent-rlm (agent runtime/RLM/delegation), ax-agent-observability (callbacks/logs/usage), ax-agent-memory-skills (recall and dynamic skill loading), ax-agent-optimize (agent tuning/eval), ax-flow (workflows), ax-gepa (top-level `optimize(...)`, BootstrapFewShot -> GEPA, Pareto optimization).
|
|
12
12
|
|
|
13
13
|
## Imports & Factories
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
|
-
// Prefer factory functions: ax(), ai(), agent(), flow()
|
|
16
|
+
// Prefer factory functions: ax(), ai(), agent(), flow(); avoid class constructors.
|
|
17
17
|
import { ax, ai, f, s, fn, agent, flow, AxMemory, AxMCPClient } from '@ax-llm/ax';
|
|
18
18
|
import { z } from 'zod'; // optional — any Standard Schema v1 library works
|
|
19
19
|
|
package/skills/ax-refine.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-refine
|
|
3
3
|
description: Use this skill when writing or reviewing Ax bestOfN/refine code, reward functions, thresholds, native sample selection, serial attempts, generated advice, and attempt diagnostics.
|
|
4
|
-
version: "22.0.
|
|
4
|
+
version: "22.0.4"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Ax Refine And BestOfN
|
package/skills/ax-signature.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ax-signature
|
|
3
3
|
description: This skill helps an LLM generate correct DSPy signature code using @ax-llm/ax. Use when the user asks about signatures, s(), f(), field types, string syntax, fluent builder API, validation constraints, or type-safe inputs/outputs.
|
|
4
|
-
version: "22.0.
|
|
4
|
+
version: "22.0.4"
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
# Ax Signature Reference
|