@ax-llm/ax 10.0.24 → 10.0.26
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/package.json +19 -22
- package/ai/anthropic/api.d.ts +0 -20
- package/ai/anthropic/api.js +0 -353
- package/ai/anthropic/api.js.map +0 -1
- package/ai/anthropic/index.d.ts +0 -3
- package/ai/anthropic/index.js +0 -4
- package/ai/anthropic/index.js.map +0 -1
- package/ai/anthropic/info.d.ts +0 -2
- package/ai/anthropic/info.js +0 -49
- package/ai/anthropic/info.js.map +0 -1
- package/ai/anthropic/types.d.ts +0 -181
- package/ai/anthropic/types.js +0 -11
- package/ai/anthropic/types.js.map +0 -1
- package/ai/azure-openai/api.d.ts +0 -20
- package/ai/azure-openai/api.js +0 -30
- package/ai/azure-openai/api.js.map +0 -1
- package/ai/azure-openai/index.d.ts +0 -1
- package/ai/azure-openai/index.js +0 -2
- package/ai/azure-openai/index.js.map +0 -1
- package/ai/balance.d.ts +0 -40
- package/ai/balance.js +0 -104
- package/ai/balance.js.map +0 -1
- package/ai/base.d.ts +0 -66
- package/ai/base.js +0 -490
- package/ai/base.js.map +0 -1
- package/ai/cohere/api.d.ts +0 -23
- package/ai/cohere/api.js +0 -267
- package/ai/cohere/api.js.map +0 -1
- package/ai/cohere/index.d.ts +0 -3
- package/ai/cohere/index.js +0 -4
- package/ai/cohere/index.js.map +0 -1
- package/ai/cohere/info.d.ts +0 -2
- package/ai/cohere/info.js +0 -52
- package/ai/cohere/info.js.map +0 -1
- package/ai/cohere/types.d.ts +0 -102
- package/ai/cohere/types.js +0 -23
- package/ai/cohere/types.js.map +0 -1
- package/ai/deepseek/api.d.ts +0 -18
- package/ai/deepseek/api.js +0 -33
- package/ai/deepseek/api.js.map +0 -1
- package/ai/deepseek/index.d.ts +0 -3
- package/ai/deepseek/index.js +0 -4
- package/ai/deepseek/index.js.map +0 -1
- package/ai/deepseek/info.d.ts +0 -2
- package/ai/deepseek/info.js +0 -16
- package/ai/deepseek/info.js.map +0 -1
- package/ai/deepseek/types.d.ts +0 -8
- package/ai/deepseek/types.js +0 -10
- package/ai/deepseek/types.js.map +0 -1
- package/ai/google-gemini/api.d.ts +0 -43
- package/ai/google-gemini/api.js +0 -346
- package/ai/google-gemini/api.js.map +0 -1
- package/ai/google-gemini/index.d.ts +0 -3
- package/ai/google-gemini/index.js +0 -4
- package/ai/google-gemini/index.js.map +0 -1
- package/ai/google-gemini/info.d.ts +0 -6
- package/ai/google-gemini/info.js +0 -36
- package/ai/google-gemini/info.js.map +0 -1
- package/ai/google-gemini/types.d.ts +0 -159
- package/ai/google-gemini/types.js +0 -29
- package/ai/google-gemini/types.js.map +0 -1
- package/ai/groq/api.d.ts +0 -20
- package/ai/groq/api.js +0 -54
- package/ai/groq/api.js.map +0 -1
- package/ai/groq/index.d.ts +0 -3
- package/ai/groq/index.js +0 -4
- package/ai/groq/index.js.map +0 -1
- package/ai/groq/info.d.ts +0 -6
- package/ai/groq/info.js +0 -36
- package/ai/groq/info.js.map +0 -1
- package/ai/groq/types.d.ts +0 -6
- package/ai/groq/types.js +0 -8
- package/ai/groq/types.js.map +0 -1
- package/ai/huggingface/api.d.ts +0 -20
- package/ai/huggingface/api.js +0 -116
- package/ai/huggingface/api.js.map +0 -1
- package/ai/huggingface/index.d.ts +0 -3
- package/ai/huggingface/index.js +0 -4
- package/ai/huggingface/index.js.map +0 -1
- package/ai/huggingface/info.d.ts +0 -6
- package/ai/huggingface/info.js +0 -6
- package/ai/huggingface/info.js.map +0 -1
- package/ai/huggingface/types.d.ts +0 -34
- package/ai/huggingface/types.js +0 -5
- package/ai/huggingface/types.js.map +0 -1
- package/ai/index.d.ts +0 -16
- package/ai/index.js +0 -16
- package/ai/index.js.map +0 -1
- package/ai/mistral/api.d.ts +0 -18
- package/ai/mistral/api.js +0 -33
- package/ai/mistral/api.js.map +0 -1
- package/ai/mistral/index.d.ts +0 -3
- package/ai/mistral/index.js +0 -4
- package/ai/mistral/index.js.map +0 -1
- package/ai/mistral/info.d.ts +0 -2
- package/ai/mistral/info.js +0 -53
- package/ai/mistral/info.js.map +0 -1
- package/ai/mistral/types.d.ts +0 -13
- package/ai/mistral/types.js +0 -17
- package/ai/mistral/types.js.map +0 -1
- package/ai/ollama/api.d.ts +0 -23
- package/ai/ollama/api.js +0 -33
- package/ai/ollama/api.js.map +0 -1
- package/ai/ollama/index.d.ts +0 -1
- package/ai/ollama/index.js +0 -2
- package/ai/ollama/index.js.map +0 -1
- package/ai/openai/api.d.ts +0 -31
- package/ai/openai/api.js +0 -315
- package/ai/openai/api.js.map +0 -1
- package/ai/openai/index.d.ts +0 -3
- package/ai/openai/index.js +0 -4
- package/ai/openai/index.js.map +0 -1
- package/ai/openai/info.d.ts +0 -6
- package/ai/openai/info.js +0 -74
- package/ai/openai/info.js.map +0 -1
- package/ai/openai/types.d.ts +0 -177
- package/ai/openai/types.js +0 -22
- package/ai/openai/types.js.map +0 -1
- package/ai/reka/api.d.ts +0 -27
- package/ai/reka/api.js +0 -203
- package/ai/reka/api.js.map +0 -1
- package/ai/reka/index.d.ts +0 -3
- package/ai/reka/index.js +0 -4
- package/ai/reka/index.js.map +0 -1
- package/ai/reka/info.d.ts +0 -6
- package/ai/reka/info.js +0 -26
- package/ai/reka/info.js.map +0 -1
- package/ai/reka/types.d.ts +0 -67
- package/ai/reka/types.js +0 -7
- package/ai/reka/types.js.map +0 -1
- package/ai/together/api.d.ts +0 -16
- package/ai/together/api.js +0 -29
- package/ai/together/api.js.map +0 -1
- package/ai/together/index.d.ts +0 -2
- package/ai/together/index.js +0 -3
- package/ai/together/index.js.map +0 -1
- package/ai/together/info.d.ts +0 -2
- package/ai/together/info.js +0 -2
- package/ai/together/info.js.map +0 -1
- package/ai/types.d.ts +0 -202
- package/ai/types.js +0 -2
- package/ai/types.js.map +0 -1
- package/ai/util.d.ts +0 -12
- package/ai/util.js +0 -63
- package/ai/util.js.map +0 -1
- package/ai/wrap.d.ts +0 -42
- package/ai/wrap.js +0 -88
- package/ai/wrap.js.map +0 -1
- package/cjs/ai/anthropic/api.d.ts +0 -20
- package/cjs/ai/anthropic/api.js +0 -358
- package/cjs/ai/anthropic/api.js.map +0 -1
- package/cjs/ai/anthropic/index.d.ts +0 -3
- package/cjs/ai/anthropic/index.js +0 -20
- package/cjs/ai/anthropic/index.js.map +0 -1
- package/cjs/ai/anthropic/info.d.ts +0 -2
- package/cjs/ai/anthropic/info.js +0 -52
- package/cjs/ai/anthropic/info.js.map +0 -1
- package/cjs/ai/anthropic/types.d.ts +0 -181
- package/cjs/ai/anthropic/types.js +0 -14
- package/cjs/ai/anthropic/types.js.map +0 -1
- package/cjs/ai/azure-openai/api.d.ts +0 -20
- package/cjs/ai/azure-openai/api.js +0 -34
- package/cjs/ai/azure-openai/api.js.map +0 -1
- package/cjs/ai/azure-openai/index.d.ts +0 -1
- package/cjs/ai/azure-openai/index.js +0 -18
- package/cjs/ai/azure-openai/index.js.map +0 -1
- package/cjs/ai/balance.d.ts +0 -40
- package/cjs/ai/balance.js +0 -110
- package/cjs/ai/balance.js.map +0 -1
- package/cjs/ai/base.d.ts +0 -66
- package/cjs/ai/base.js +0 -496
- package/cjs/ai/base.js.map +0 -1
- package/cjs/ai/cohere/api.d.ts +0 -23
- package/cjs/ai/cohere/api.js +0 -273
- package/cjs/ai/cohere/api.js.map +0 -1
- package/cjs/ai/cohere/index.d.ts +0 -3
- package/cjs/ai/cohere/index.js +0 -20
- package/cjs/ai/cohere/index.js.map +0 -1
- package/cjs/ai/cohere/info.d.ts +0 -2
- package/cjs/ai/cohere/info.js +0 -55
- package/cjs/ai/cohere/info.js.map +0 -1
- package/cjs/ai/cohere/types.d.ts +0 -102
- package/cjs/ai/cohere/types.js +0 -26
- package/cjs/ai/cohere/types.js.map +0 -1
- package/cjs/ai/deepseek/api.d.ts +0 -18
- package/cjs/ai/deepseek/api.js +0 -39
- package/cjs/ai/deepseek/api.js.map +0 -1
- package/cjs/ai/deepseek/index.d.ts +0 -3
- package/cjs/ai/deepseek/index.js +0 -20
- package/cjs/ai/deepseek/index.js.map +0 -1
- package/cjs/ai/deepseek/info.d.ts +0 -2
- package/cjs/ai/deepseek/info.js +0 -19
- package/cjs/ai/deepseek/info.js.map +0 -1
- package/cjs/ai/deepseek/types.d.ts +0 -8
- package/cjs/ai/deepseek/types.js +0 -13
- package/cjs/ai/deepseek/types.js.map +0 -1
- package/cjs/ai/google-gemini/api.d.ts +0 -43
- package/cjs/ai/google-gemini/api.js +0 -352
- package/cjs/ai/google-gemini/api.js.map +0 -1
- package/cjs/ai/google-gemini/index.d.ts +0 -3
- package/cjs/ai/google-gemini/index.js +0 -20
- package/cjs/ai/google-gemini/index.js.map +0 -1
- package/cjs/ai/google-gemini/info.d.ts +0 -6
- package/cjs/ai/google-gemini/info.js +0 -39
- package/cjs/ai/google-gemini/info.js.map +0 -1
- package/cjs/ai/google-gemini/types.d.ts +0 -159
- package/cjs/ai/google-gemini/types.js +0 -32
- package/cjs/ai/google-gemini/types.js.map +0 -1
- package/cjs/ai/groq/api.d.ts +0 -20
- package/cjs/ai/groq/api.js +0 -58
- package/cjs/ai/groq/api.js.map +0 -1
- package/cjs/ai/groq/index.d.ts +0 -3
- package/cjs/ai/groq/index.js +0 -20
- package/cjs/ai/groq/index.js.map +0 -1
- package/cjs/ai/groq/info.d.ts +0 -6
- package/cjs/ai/groq/info.js +0 -39
- package/cjs/ai/groq/info.js.map +0 -1
- package/cjs/ai/groq/types.d.ts +0 -6
- package/cjs/ai/groq/types.js +0 -11
- package/cjs/ai/groq/types.js.map +0 -1
- package/cjs/ai/huggingface/api.d.ts +0 -20
- package/cjs/ai/huggingface/api.js +0 -122
- package/cjs/ai/huggingface/api.js.map +0 -1
- package/cjs/ai/huggingface/index.d.ts +0 -3
- package/cjs/ai/huggingface/index.js +0 -20
- package/cjs/ai/huggingface/index.js.map +0 -1
- package/cjs/ai/huggingface/info.d.ts +0 -6
- package/cjs/ai/huggingface/info.js +0 -9
- package/cjs/ai/huggingface/info.js.map +0 -1
- package/cjs/ai/huggingface/types.d.ts +0 -34
- package/cjs/ai/huggingface/types.js +0 -8
- package/cjs/ai/huggingface/types.js.map +0 -1
- package/cjs/ai/index.d.ts +0 -16
- package/cjs/ai/index.js +0 -32
- package/cjs/ai/index.js.map +0 -1
- package/cjs/ai/mistral/api.d.ts +0 -18
- package/cjs/ai/mistral/api.js +0 -39
- package/cjs/ai/mistral/api.js.map +0 -1
- package/cjs/ai/mistral/index.d.ts +0 -3
- package/cjs/ai/mistral/index.js +0 -20
- package/cjs/ai/mistral/index.js.map +0 -1
- package/cjs/ai/mistral/info.d.ts +0 -2
- package/cjs/ai/mistral/info.js +0 -56
- package/cjs/ai/mistral/info.js.map +0 -1
- package/cjs/ai/mistral/types.d.ts +0 -13
- package/cjs/ai/mistral/types.js +0 -20
- package/cjs/ai/mistral/types.js.map +0 -1
- package/cjs/ai/ollama/api.d.ts +0 -23
- package/cjs/ai/ollama/api.js +0 -39
- package/cjs/ai/ollama/api.js.map +0 -1
- package/cjs/ai/ollama/index.d.ts +0 -1
- package/cjs/ai/ollama/index.js +0 -18
- package/cjs/ai/ollama/index.js.map +0 -1
- package/cjs/ai/openai/api.d.ts +0 -31
- package/cjs/ai/openai/api.js +0 -323
- package/cjs/ai/openai/api.js.map +0 -1
- package/cjs/ai/openai/index.d.ts +0 -3
- package/cjs/ai/openai/index.js +0 -20
- package/cjs/ai/openai/index.js.map +0 -1
- package/cjs/ai/openai/info.d.ts +0 -6
- package/cjs/ai/openai/info.js +0 -77
- package/cjs/ai/openai/info.js.map +0 -1
- package/cjs/ai/openai/types.d.ts +0 -177
- package/cjs/ai/openai/types.js +0 -25
- package/cjs/ai/openai/types.js.map +0 -1
- package/cjs/ai/reka/api.d.ts +0 -27
- package/cjs/ai/reka/api.js +0 -211
- package/cjs/ai/reka/api.js.map +0 -1
- package/cjs/ai/reka/index.d.ts +0 -3
- package/cjs/ai/reka/index.js +0 -20
- package/cjs/ai/reka/index.js.map +0 -1
- package/cjs/ai/reka/info.d.ts +0 -6
- package/cjs/ai/reka/info.js +0 -29
- package/cjs/ai/reka/info.js.map +0 -1
- package/cjs/ai/reka/types.d.ts +0 -67
- package/cjs/ai/reka/types.js +0 -10
- package/cjs/ai/reka/types.js.map +0 -1
- package/cjs/ai/together/api.d.ts +0 -16
- package/cjs/ai/together/api.js +0 -34
- package/cjs/ai/together/api.js.map +0 -1
- package/cjs/ai/together/index.d.ts +0 -2
- package/cjs/ai/together/index.js +0 -19
- package/cjs/ai/together/index.js.map +0 -1
- package/cjs/ai/together/info.d.ts +0 -2
- package/cjs/ai/together/info.js +0 -5
- package/cjs/ai/together/info.js.map +0 -1
- package/cjs/ai/types.d.ts +0 -202
- package/cjs/ai/types.js +0 -3
- package/cjs/ai/types.js.map +0 -1
- package/cjs/ai/util.d.ts +0 -12
- package/cjs/ai/util.js +0 -71
- package/cjs/ai/util.js.map +0 -1
- package/cjs/ai/wrap.d.ts +0 -42
- package/cjs/ai/wrap.js +0 -92
- package/cjs/ai/wrap.js.map +0 -1
- package/cjs/db/base.d.ts +0 -23
- package/cjs/db/base.js +0 -91
- package/cjs/db/base.js.map +0 -1
- package/cjs/db/cloudflare.d.ts +0 -21
- package/cjs/db/cloudflare.js +0 -102
- package/cjs/db/cloudflare.js.map +0 -1
- package/cjs/db/index.d.ts +0 -6
- package/cjs/db/index.js +0 -23
- package/cjs/db/index.js.map +0 -1
- package/cjs/db/memory.d.ts +0 -21
- package/cjs/db/memory.js +0 -103
- package/cjs/db/memory.js.map +0 -1
- package/cjs/db/pinecone.d.ts +0 -21
- package/cjs/db/pinecone.js +0 -75
- package/cjs/db/pinecone.js.map +0 -1
- package/cjs/db/types.d.ts +0 -35
- package/cjs/db/types.js +0 -4
- package/cjs/db/types.js.map +0 -1
- package/cjs/db/weaviate.d.ts +0 -21
- package/cjs/db/weaviate.js +0 -131
- package/cjs/db/weaviate.js.map +0 -1
- package/cjs/db/wrap.d.ts +0 -13
- package/cjs/db/wrap.js +0 -39
- package/cjs/db/wrap.js.map +0 -1
- package/cjs/docs/index.d.ts +0 -4
- package/cjs/docs/index.js +0 -21
- package/cjs/docs/index.js.map +0 -1
- package/cjs/docs/manager.d.ts +0 -45
- package/cjs/docs/manager.js +0 -165
- package/cjs/docs/manager.js.map +0 -1
- package/cjs/docs/reranker.d.ts +0 -7
- package/cjs/docs/reranker.js +0 -30
- package/cjs/docs/reranker.js.map +0 -1
- package/cjs/docs/rewriter.d.ts +0 -4
- package/cjs/docs/rewriter.js +0 -13
- package/cjs/docs/rewriter.js.map +0 -1
- package/cjs/docs/tika.d.ts +0 -18
- package/cjs/docs/tika.js +0 -50
- package/cjs/docs/tika.js.map +0 -1
- package/cjs/dsp/asserts.d.ts +0 -32
- package/cjs/dsp/asserts.js +0 -98
- package/cjs/dsp/asserts.js.map +0 -1
- package/cjs/dsp/datetime.d.ts +0 -4
- package/cjs/dsp/datetime.js +0 -72
- package/cjs/dsp/datetime.js.map +0 -1
- package/cjs/dsp/eval.d.ts +0 -43
- package/cjs/dsp/eval.js +0 -128
- package/cjs/dsp/eval.js.map +0 -1
- package/cjs/dsp/evaluate.d.ts +0 -15
- package/cjs/dsp/evaluate.js +0 -38
- package/cjs/dsp/evaluate.js.map +0 -1
- package/cjs/dsp/extract.d.ts +0 -9
- package/cjs/dsp/extract.js +0 -169
- package/cjs/dsp/extract.js.map +0 -1
- package/cjs/dsp/functions.d.ts +0 -23
- package/cjs/dsp/functions.js +0 -121
- package/cjs/dsp/functions.js.map +0 -1
- package/cjs/dsp/generate.d.ts +0 -58
- package/cjs/dsp/generate.js +0 -254
- package/cjs/dsp/generate.js.map +0 -1
- package/cjs/dsp/index.d.ts +0 -15
- package/cjs/dsp/index.js +0 -27
- package/cjs/dsp/index.js.map +0 -1
- package/cjs/dsp/jsonschema.d.ts +0 -2
- package/cjs/dsp/jsonschema.js +0 -101
- package/cjs/dsp/jsonschema.js.map +0 -1
- package/cjs/dsp/loader.d.ts +0 -30
- package/cjs/dsp/loader.js +0 -85
- package/cjs/dsp/loader.js.map +0 -1
- package/cjs/dsp/modelinfo.d.ts +0 -8
- package/cjs/dsp/modelinfo.js +0 -35
- package/cjs/dsp/modelinfo.js.map +0 -1
- package/cjs/dsp/optimize.d.ts +0 -30
- package/cjs/dsp/optimize.js +0 -101
- package/cjs/dsp/optimize.js.map +0 -1
- package/cjs/dsp/parser.d.ts +0 -40
- package/cjs/dsp/parser.js +0 -169
- package/cjs/dsp/parser.js.map +0 -1
- package/cjs/dsp/program.d.ts +0 -104
- package/cjs/dsp/program.js +0 -198
- package/cjs/dsp/program.js.map +0 -1
- package/cjs/dsp/prompt.d.ts +0 -48
- package/cjs/dsp/prompt.js +0 -380
- package/cjs/dsp/prompt.js.map +0 -1
- package/cjs/dsp/registry.d.ts +0 -6
- package/cjs/dsp/registry.js +0 -19
- package/cjs/dsp/registry.js.map +0 -1
- package/cjs/dsp/router.d.ts +0 -25
- package/cjs/dsp/router.js +0 -75
- package/cjs/dsp/router.js.map +0 -1
- package/cjs/dsp/sig.d.ts +0 -38
- package/cjs/dsp/sig.js +0 -205
- package/cjs/dsp/sig.js.map +0 -1
- package/cjs/dsp/stopwords.d.ts +0 -1
- package/cjs/dsp/stopwords.js +0 -1167
- package/cjs/dsp/stopwords.js.map +0 -1
- package/cjs/dsp/strutil.d.ts +0 -11
- package/cjs/dsp/strutil.js +0 -63
- package/cjs/dsp/strutil.js.map +0 -1
- package/cjs/dsp/util.d.ts +0 -10
- package/cjs/dsp/util.js +0 -169
- package/cjs/dsp/util.js.map +0 -1
- package/cjs/dsp/validate.d.ts +0 -17
- package/cjs/dsp/validate.js +0 -30
- package/cjs/dsp/validate.js.map +0 -1
- package/cjs/funcs/code.d.ts +0 -16
- package/cjs/funcs/code.js +0 -86
- package/cjs/funcs/code.js.map +0 -1
- package/cjs/funcs/docker.d.ts +0 -101
- package/cjs/funcs/docker.js +0 -217
- package/cjs/funcs/docker.js.map +0 -1
- package/cjs/funcs/embed.d.ts +0 -17
- package/cjs/funcs/embed.js +0 -42
- package/cjs/funcs/embed.js.map +0 -1
- package/cjs/funcs/index.d.ts +0 -3
- package/cjs/funcs/index.js +0 -20
- package/cjs/funcs/index.js.map +0 -1
- package/cjs/index.d.ts +0 -9
- package/cjs/index.js +0 -34
- package/cjs/index.js.map +0 -1
- package/cjs/mem/index.d.ts +0 -2
- package/cjs/mem/index.js +0 -19
- package/cjs/mem/index.js.map +0 -1
- package/cjs/mem/memory.d.ts +0 -15
- package/cjs/mem/memory.js +0 -78
- package/cjs/mem/memory.js.map +0 -1
- package/cjs/mem/types.d.ts +0 -14
- package/cjs/mem/types.js +0 -3
- package/cjs/mem/types.js.map +0 -1
- package/cjs/prompts/agent.d.ts +0 -37
- package/cjs/prompts/agent.js +0 -128
- package/cjs/prompts/agent.js.map +0 -1
- package/cjs/prompts/cot.d.ts +0 -8
- package/cjs/prompts/cot.js +0 -21
- package/cjs/prompts/cot.js.map +0 -1
- package/cjs/prompts/index.d.ts +0 -3
- package/cjs/prompts/index.js +0 -20
- package/cjs/prompts/index.js.map +0 -1
- package/cjs/prompts/rag.d.ts +0 -23
- package/cjs/prompts/rag.js +0 -33
- package/cjs/prompts/rag.js.map +0 -1
- package/cjs/trace/index.d.ts +0 -171
- package/cjs/trace/index.js +0 -70
- package/cjs/trace/index.js.map +0 -1
- package/cjs/util/apicall.d.ts +0 -18
- package/cjs/util/apicall.js +0 -58
- package/cjs/util/apicall.js.map +0 -1
- package/cjs/util/log.d.ts +0 -14
- package/cjs/util/log.js +0 -35
- package/cjs/util/log.js.map +0 -1
- package/cjs/util/other.d.ts +0 -1
- package/cjs/util/other.js +0 -8
- package/cjs/util/other.js.map +0 -1
- package/cjs/util/rate-limit.d.ts +0 -24
- package/cjs/util/rate-limit.js +0 -53
- package/cjs/util/rate-limit.js.map +0 -1
- package/cjs/util/sse.d.ts +0 -12
- package/cjs/util/sse.js +0 -97
- package/cjs/util/sse.js.map +0 -1
- package/cjs/util/stream.d.ts +0 -9
- package/cjs/util/stream.js +0 -33
- package/cjs/util/stream.js.map +0 -1
- package/cjs/util/transform.d.ts +0 -4
- package/cjs/util/transform.js +0 -33
- package/cjs/util/transform.js.map +0 -1
- package/db/base.d.ts +0 -23
- package/db/base.js +0 -87
- package/db/base.js.map +0 -1
- package/db/cloudflare.d.ts +0 -21
- package/db/cloudflare.js +0 -98
- package/db/cloudflare.js.map +0 -1
- package/db/index.d.ts +0 -6
- package/db/index.js +0 -7
- package/db/index.js.map +0 -1
- package/db/memory.d.ts +0 -21
- package/db/memory.js +0 -99
- package/db/memory.js.map +0 -1
- package/db/pinecone.d.ts +0 -21
- package/db/pinecone.js +0 -71
- package/db/pinecone.js.map +0 -1
- package/db/types.d.ts +0 -35
- package/db/types.js +0 -3
- package/db/types.js.map +0 -1
- package/db/weaviate.d.ts +0 -21
- package/db/weaviate.js +0 -127
- package/db/weaviate.js.map +0 -1
- package/db/wrap.d.ts +0 -13
- package/db/wrap.js +0 -35
- package/db/wrap.js.map +0 -1
- package/docs/index.d.ts +0 -4
- package/docs/index.js +0 -5
- package/docs/index.js.map +0 -1
- package/docs/manager.d.ts +0 -45
- package/docs/manager.js +0 -162
- package/docs/manager.js.map +0 -1
- package/docs/reranker.d.ts +0 -7
- package/docs/reranker.js +0 -26
- package/docs/reranker.js.map +0 -1
- package/docs/rewriter.d.ts +0 -4
- package/docs/rewriter.js +0 -9
- package/docs/rewriter.js.map +0 -1
- package/docs/tika.d.ts +0 -18
- package/docs/tika.js +0 -46
- package/docs/tika.js.map +0 -1
- package/dsp/asserts.d.ts +0 -32
- package/dsp/asserts.js +0 -91
- package/dsp/asserts.js.map +0 -1
- package/dsp/datetime.d.ts +0 -4
- package/dsp/datetime.js +0 -63
- package/dsp/datetime.js.map +0 -1
- package/dsp/eval.d.ts +0 -43
- package/dsp/eval.js +0 -125
- package/dsp/eval.js.map +0 -1
- package/dsp/evaluate.d.ts +0 -15
- package/dsp/evaluate.js +0 -34
- package/dsp/evaluate.js.map +0 -1
- package/dsp/extract.d.ts +0 -9
- package/dsp/extract.js +0 -159
- package/dsp/extract.js.map +0 -1
- package/dsp/functions.d.ts +0 -23
- package/dsp/functions.js +0 -111
- package/dsp/functions.js.map +0 -1
- package/dsp/generate.d.ts +0 -58
- package/dsp/generate.js +0 -251
- package/dsp/generate.js.map +0 -1
- package/dsp/index.d.ts +0 -15
- package/dsp/index.js +0 -11
- package/dsp/index.js.map +0 -1
- package/dsp/jsonschema.d.ts +0 -2
- package/dsp/jsonschema.js +0 -97
- package/dsp/jsonschema.js.map +0 -1
- package/dsp/loader.d.ts +0 -30
- package/dsp/loader.js +0 -81
- package/dsp/loader.js.map +0 -1
- package/dsp/modelinfo.d.ts +0 -8
- package/dsp/modelinfo.js +0 -32
- package/dsp/modelinfo.js.map +0 -1
- package/dsp/optimize.d.ts +0 -30
- package/dsp/optimize.js +0 -97
- package/dsp/optimize.js.map +0 -1
- package/dsp/parser.d.ts +0 -40
- package/dsp/parser.js +0 -166
- package/dsp/parser.js.map +0 -1
- package/dsp/program.d.ts +0 -104
- package/dsp/program.js +0 -193
- package/dsp/program.js.map +0 -1
- package/dsp/prompt.d.ts +0 -48
- package/dsp/prompt.js +0 -376
- package/dsp/prompt.js.map +0 -1
- package/dsp/registry.d.ts +0 -6
- package/dsp/registry.js +0 -15
- package/dsp/registry.js.map +0 -1
- package/dsp/router.d.ts +0 -25
- package/dsp/router.js +0 -70
- package/dsp/router.js.map +0 -1
- package/dsp/sig.d.ts +0 -38
- package/dsp/sig.js +0 -201
- package/dsp/sig.js.map +0 -1
- package/dsp/stopwords.d.ts +0 -1
- package/dsp/stopwords.js +0 -1164
- package/dsp/stopwords.js.map +0 -1
- package/dsp/strutil.d.ts +0 -11
- package/dsp/strutil.js +0 -60
- package/dsp/strutil.js.map +0 -1
- package/dsp/util.d.ts +0 -10
- package/dsp/util.js +0 -162
- package/dsp/util.js.map +0 -1
- package/dsp/validate.d.ts +0 -17
- package/dsp/validate.js +0 -26
- package/dsp/validate.js.map +0 -1
- package/funcs/code.d.ts +0 -16
- package/funcs/code.js +0 -59
- package/funcs/code.js.map +0 -1
- package/funcs/docker.d.ts +0 -101
- package/funcs/docker.js +0 -213
- package/funcs/docker.js.map +0 -1
- package/funcs/embed.d.ts +0 -17
- package/funcs/embed.js +0 -38
- package/funcs/embed.js.map +0 -1
- package/funcs/index.d.ts +0 -3
- package/funcs/index.js +0 -4
- package/funcs/index.js.map +0 -1
- package/index.d.ts +0 -9
- package/index.js +0 -16
- package/index.js.map +0 -1
- package/mem/index.d.ts +0 -2
- package/mem/index.js +0 -3
- package/mem/index.js.map +0 -1
- package/mem/memory.d.ts +0 -15
- package/mem/memory.js +0 -74
- package/mem/memory.js.map +0 -1
- package/mem/types.d.ts +0 -14
- package/mem/types.js +0 -2
- package/mem/types.js.map +0 -1
- package/prompts/agent.d.ts +0 -37
- package/prompts/agent.js +0 -125
- package/prompts/agent.js.map +0 -1
- package/prompts/cot.d.ts +0 -8
- package/prompts/cot.js +0 -17
- package/prompts/cot.js.map +0 -1
- package/prompts/index.d.ts +0 -3
- package/prompts/index.js +0 -4
- package/prompts/index.js.map +0 -1
- package/prompts/rag.d.ts +0 -23
- package/prompts/rag.js +0 -30
- package/prompts/rag.js.map +0 -1
- package/trace/index.d.ts +0 -171
- package/trace/index.js +0 -67
- package/trace/index.js.map +0 -1
- package/util/apicall.d.ts +0 -18
- package/util/apicall.js +0 -51
- package/util/apicall.js.map +0 -1
- package/util/log.d.ts +0 -14
- package/util/log.js +0 -31
- package/util/log.js.map +0 -1
- package/util/other.d.ts +0 -1
- package/util/other.js +0 -5
- package/util/other.js.map +0 -1
- package/util/rate-limit.d.ts +0 -24
- package/util/rate-limit.js +0 -49
- package/util/rate-limit.js.map +0 -1
- package/util/sse.d.ts +0 -12
- package/util/sse.js +0 -93
- package/util/sse.js.map +0 -1
- package/util/stream.d.ts +0 -9
- package/util/stream.js +0 -29
- package/util/stream.js.map +0 -1
- package/util/transform.d.ts +0 -4
- package/util/transform.js +0 -29
- package/util/transform.js.map +0 -1
package/cjs/dsp/loader.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AxHFDataLoader = void 0;
|
|
4
|
-
class AxHFDataLoader {
|
|
5
|
-
rows = [];
|
|
6
|
-
baseUrl;
|
|
7
|
-
dataset;
|
|
8
|
-
split;
|
|
9
|
-
config;
|
|
10
|
-
options;
|
|
11
|
-
constructor({ dataset, split, config, options }) {
|
|
12
|
-
this.baseUrl = 'https://datasets-server.huggingface.co/rows';
|
|
13
|
-
this.dataset = dataset;
|
|
14
|
-
this.split = split;
|
|
15
|
-
this.config = config;
|
|
16
|
-
this.options = options;
|
|
17
|
-
}
|
|
18
|
-
async fetchDataFromAPI(url) {
|
|
19
|
-
try {
|
|
20
|
-
const response = await fetch(url);
|
|
21
|
-
if (!response.ok) {
|
|
22
|
-
throw new Error(`Error fetching data: ${response.statusText}`);
|
|
23
|
-
}
|
|
24
|
-
const data = (await response.json());
|
|
25
|
-
if (!data?.rows) {
|
|
26
|
-
throw new Error('Invalid data format');
|
|
27
|
-
}
|
|
28
|
-
return data.rows;
|
|
29
|
-
}
|
|
30
|
-
catch (error) {
|
|
31
|
-
console.error('Error fetching data from API:', error);
|
|
32
|
-
throw error;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
// https://datasets-server.huggingface.co/rows?dataset=hotpot_qa&config=distractor&split=train&offset=0&length=100
|
|
36
|
-
async loadData() {
|
|
37
|
-
const offset = this.options?.offset ?? 0;
|
|
38
|
-
const length = this.options?.length ?? 100;
|
|
39
|
-
const ds = encodeURIComponent(this.dataset);
|
|
40
|
-
const url = `${this.baseUrl}?dataset=${ds}&config=${this.config}&split=${this.split}&offset=${offset}&length=${length}`;
|
|
41
|
-
console.log('Downloading data from API.');
|
|
42
|
-
this.rows = (await this.fetchDataFromAPI(url));
|
|
43
|
-
return this.rows;
|
|
44
|
-
}
|
|
45
|
-
// eslint-disable-next-line functional/prefer-immutable-types
|
|
46
|
-
setData(rows) {
|
|
47
|
-
this.rows = rows;
|
|
48
|
-
}
|
|
49
|
-
getData() {
|
|
50
|
-
return this.rows;
|
|
51
|
-
}
|
|
52
|
-
async getRows({ count, fields, renameMap }) {
|
|
53
|
-
if (this.rows.length === 0) {
|
|
54
|
-
throw new Error('No data loaded, call loadData or setData first.');
|
|
55
|
-
}
|
|
56
|
-
const dataRows = this.rows.slice(0, count);
|
|
57
|
-
return dataRows
|
|
58
|
-
.map((item) => {
|
|
59
|
-
const result = {};
|
|
60
|
-
fields.forEach((field) => {
|
|
61
|
-
const keys = field.split('.');
|
|
62
|
-
// Initial value should match the type of the rows, and be indexable by string
|
|
63
|
-
let value = item.row;
|
|
64
|
-
for (const key of keys) {
|
|
65
|
-
// Use type assertion to tell TypeScript that value will always be an object that can be indexed with string keys
|
|
66
|
-
if (Object.prototype.hasOwnProperty.call(value, key)) {
|
|
67
|
-
value = value[key];
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
if (!value) {
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
const resultFieldName = renameMap && field in renameMap ? renameMap[field] : field;
|
|
74
|
-
if (!resultFieldName) {
|
|
75
|
-
throw new Error(`Invalid field name: ${field}`);
|
|
76
|
-
}
|
|
77
|
-
result[resultFieldName] = value;
|
|
78
|
-
});
|
|
79
|
-
return result;
|
|
80
|
-
})
|
|
81
|
-
.filter((v) => Object.keys(v).length !== 0);
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
exports.AxHFDataLoader = AxHFDataLoader;
|
|
85
|
-
//# sourceMappingURL=loader.js.map
|
package/cjs/dsp/loader.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"loader.js","sourceRoot":"","sources":["../../../dsp/loader.ts"],"names":[],"mappings":";;;AAIA,MAAa,cAAc;IACjB,IAAI,GAAgB,EAAE,CAAC;IACvB,OAAO,CAAS;IAEh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,CAAC;wBACD,KAAK,GAAI,KAAiC,CAAC,GAAG,CAAC,CAAC;oBAClD,CAAC;gBACH,CAAC;gBACD,IAAI,CAAC,KAAK,EAAE,CAAC;oBACX,OAAO;gBACT,CAAC;gBACD,MAAM,eAAe,GACnB,SAAS,IAAI,KAAK,IAAI,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;gBAC7D,IAAI,CAAC,eAAe,EAAE,CAAC;oBACrB,MAAM,IAAI,KAAK,CAAC,uBAAuB,KAAK,EAAE,CAAC,CAAC;gBAClD,CAAC;gBACD,MAAM,CAAC,eAAe,CAAC,GAAG,KAAqB,CAAC;YAClD,CAAC,CAAC,CAAC;YAEH,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC;aACD,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,KAAK,CAAC,CAAQ,CAAC;IACvD,CAAC;CACF;AAnHD,wCAmHC"}
|
package/cjs/dsp/modelinfo.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { AxModelInfo } from '../ai/types.js';
|
|
2
|
-
interface GetModelInfoParams {
|
|
3
|
-
model: string;
|
|
4
|
-
modelInfo: readonly AxModelInfo[];
|
|
5
|
-
modelMap?: Record<string, string>;
|
|
6
|
-
}
|
|
7
|
-
export declare function axGetModelInfo({ model, modelInfo, modelMap }: Readonly<GetModelInfoParams>): Readonly<AxModelInfo>;
|
|
8
|
-
export {};
|
package/cjs/dsp/modelinfo.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.axGetModelInfo = axGetModelInfo;
|
|
4
|
-
function axGetModelInfo({ model, modelInfo, modelMap = {} }) {
|
|
5
|
-
// First check if there's a mapping for this model
|
|
6
|
-
const mappedModel = modelMap?.[model] ?? model;
|
|
7
|
-
// Try exact match first
|
|
8
|
-
const exactMatch = modelInfo.find((v) => v.name === model);
|
|
9
|
-
if (exactMatch)
|
|
10
|
-
return exactMatch;
|
|
11
|
-
// Handle normalization if no exact match
|
|
12
|
-
const normalizedName = mappedModel
|
|
13
|
-
// Remove vendor prefixes
|
|
14
|
-
.replace(/^(anthropic\.|openai\.)/, '')
|
|
15
|
-
// Remove various postfixes one by one, stopping after first match
|
|
16
|
-
.replace(/-latest$/, '')
|
|
17
|
-
.replace(/-\d{8}$/, '') // YYYYMMDD
|
|
18
|
-
.replace(/-v\d+:\d+$/, '') // v2:0
|
|
19
|
-
.replace(/@\d{8}$/, '') // @YYYYMMDD
|
|
20
|
-
.replace(/-\d{2,}(-[a-zA-Z0-9-]+)?$/, '') // XX or XXXXX-something
|
|
21
|
-
.replace(/-v\d+@\d{8}$/, '') // vX@YYYYMMDD
|
|
22
|
-
.replace(/-v\d+$/, ''); // Remove standalone version number
|
|
23
|
-
// Try to find a match with the normalized name
|
|
24
|
-
const normalizedMatch = modelInfo.find((v) => v.name === normalizedName);
|
|
25
|
-
if (normalizedMatch)
|
|
26
|
-
return normalizedMatch;
|
|
27
|
-
// Return default if no match found
|
|
28
|
-
return {
|
|
29
|
-
name: model,
|
|
30
|
-
currency: 'usd',
|
|
31
|
-
promptTokenCostPer1M: 0,
|
|
32
|
-
completionTokenCostPer1M: 0
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
//# sourceMappingURL=modelinfo.js.map
|
package/cjs/dsp/modelinfo.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"modelinfo.js","sourceRoot":"","sources":["../../../dsp/modelinfo.ts"],"names":[],"mappings":";;AAQA,wCAoCC;AApCD,SAAgB,cAAc,CAAC,EAC7B,KAAK,EACL,SAAS,EACT,QAAQ,GAAG,EAAE,EACgB;IAC7B,kDAAkD;IAClD,MAAM,WAAW,GAAG,QAAQ,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC;IAE/C,wBAAwB;IACxB,MAAM,UAAU,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,KAAK,CAAC,CAAC;IAC3D,IAAI,UAAU;QAAE,OAAO,UAAU,CAAC;IAElC,yCAAyC;IACzC,MAAM,cAAc,GAAG,WAAW;QAChC,yBAAyB;SACxB,OAAO,CAAC,yBAAyB,EAAE,EAAE,CAAC;QACvC,kEAAkE;SACjE,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC;SACvB,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,WAAW;SAClC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC,OAAO;SACjC,OAAO,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,YAAY;SACnC,OAAO,CAAC,2BAA2B,EAAE,EAAE,CAAC,CAAC,wBAAwB;SACjE,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC,CAAC,cAAc;SAC1C,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,mCAAmC;IAE7D,+CAA+C;IAC/C,MAAM,eAAe,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,cAAc,CAAC,CAAC;IACzE,IAAI,eAAe;QAAE,OAAO,eAAe,CAAC;IAE5C,mCAAmC;IACnC,OAAO;QACL,IAAI,EAAE,KAAK;QACX,QAAQ,EAAE,KAAK;QACf,oBAAoB,EAAE,CAAC;QACvB,wBAAwB,EAAE,CAAC;KAC5B,CAAC;AACJ,CAAC"}
|
package/cjs/dsp/optimize.d.ts
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import type { AxAIService } from '../ai/types.js';
|
|
2
|
-
import type { AxFieldValue, AxGenIn, AxGenOut, AxProgram, AxProgramDemos } from './program.js';
|
|
3
|
-
export type AxExample = Record<string, AxFieldValue>;
|
|
4
|
-
export type AxMetricFn = <T extends AxGenOut = AxGenOut>(arg0: Readonly<{
|
|
5
|
-
prediction: T;
|
|
6
|
-
example: AxExample;
|
|
7
|
-
}>) => boolean;
|
|
8
|
-
export type AxMetricFnArgs = Parameters<AxMetricFn>[0];
|
|
9
|
-
export type AxOptimizerArgs<IN extends AxGenIn, OUT extends AxGenOut> = {
|
|
10
|
-
ai: AxAIService;
|
|
11
|
-
program: Readonly<AxProgram<IN, OUT>>;
|
|
12
|
-
examples: Readonly<AxExample[]>;
|
|
13
|
-
options?: {
|
|
14
|
-
maxRounds?: number;
|
|
15
|
-
maxExamples?: number;
|
|
16
|
-
maxDemos?: number;
|
|
17
|
-
};
|
|
18
|
-
};
|
|
19
|
-
export declare class AxBootstrapFewShot<IN extends AxGenIn = AxGenIn, OUT extends AxGenOut = AxGenOut> {
|
|
20
|
-
private ai;
|
|
21
|
-
private program;
|
|
22
|
-
private examples;
|
|
23
|
-
private maxRounds;
|
|
24
|
-
private maxDemos;
|
|
25
|
-
private maxExamples;
|
|
26
|
-
private traces;
|
|
27
|
-
constructor({ ai, program, examples, options }: Readonly<AxOptimizerArgs<IN, OUT>>);
|
|
28
|
-
private compileRound;
|
|
29
|
-
compile(metricFn: AxMetricFn, options?: Readonly<AxOptimizerArgs<IN, OUT>['options']>): Promise<AxProgramDemos[]>;
|
|
30
|
-
}
|
package/cjs/dsp/optimize.js
DELETED
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AxBootstrapFewShot = void 0;
|
|
4
|
-
const util_js_1 = require("./util.js");
|
|
5
|
-
class AxBootstrapFewShot {
|
|
6
|
-
ai;
|
|
7
|
-
program;
|
|
8
|
-
examples;
|
|
9
|
-
maxRounds;
|
|
10
|
-
maxDemos;
|
|
11
|
-
maxExamples;
|
|
12
|
-
traces = [];
|
|
13
|
-
constructor({ ai, program, examples = [], options }) {
|
|
14
|
-
if (examples.length == 0) {
|
|
15
|
-
throw new Error('No examples found');
|
|
16
|
-
}
|
|
17
|
-
this.maxRounds = options?.maxRounds ?? 3;
|
|
18
|
-
this.maxDemos = options?.maxDemos ?? 4;
|
|
19
|
-
this.maxExamples = options?.maxExamples ?? 16;
|
|
20
|
-
this.ai = ai;
|
|
21
|
-
this.program = program;
|
|
22
|
-
this.examples = examples;
|
|
23
|
-
}
|
|
24
|
-
async compileRound(roundIndex, metricFn, options) {
|
|
25
|
-
const st = new Date().getTime();
|
|
26
|
-
const maxDemos = options?.maxDemos ?? this.maxDemos;
|
|
27
|
-
const aiOpt = { modelConfig: { temperature: 0.7 } };
|
|
28
|
-
const examples = randomSample(this.examples, this.maxExamples);
|
|
29
|
-
for (let i = 0; i < examples.length; i++) {
|
|
30
|
-
if (i > 0) {
|
|
31
|
-
aiOpt.modelConfig.temperature = 0.7 + 0.001 * i;
|
|
32
|
-
}
|
|
33
|
-
const ex = examples[i];
|
|
34
|
-
if (!ex) {
|
|
35
|
-
throw new Error('Invalid example');
|
|
36
|
-
}
|
|
37
|
-
const exList = [...examples.slice(0, i), ...examples.slice(i + 1)];
|
|
38
|
-
this.program.setExamples(exList);
|
|
39
|
-
const res = await this.program.forward(this.ai, ex, aiOpt);
|
|
40
|
-
const success = metricFn({ prediction: res, example: ex });
|
|
41
|
-
if (success) {
|
|
42
|
-
this.traces = [...this.traces, ...this.program.getTraces()];
|
|
43
|
-
}
|
|
44
|
-
const current = i + examples.length * roundIndex;
|
|
45
|
-
const total = examples.length * this.maxRounds;
|
|
46
|
-
const et = new Date().getTime() - st;
|
|
47
|
-
(0, util_js_1.updateProgressBar)(current, total, this.traces.length, et, 30, 'Tuning Prompt');
|
|
48
|
-
if (this.traces.length > maxDemos) {
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
async compile(metricFn, options) {
|
|
54
|
-
const maxRounds = options?.maxRounds ?? this.maxRounds;
|
|
55
|
-
this.traces = [];
|
|
56
|
-
for (let i = 0; i < maxRounds; i++) {
|
|
57
|
-
await this.compileRound(i, metricFn, options);
|
|
58
|
-
}
|
|
59
|
-
if (this.traces.length === 0) {
|
|
60
|
-
throw new Error('No demonstrations found. Either provider more examples or improve the existing ones.');
|
|
61
|
-
}
|
|
62
|
-
const demos = groupTracesByKeys(this.traces);
|
|
63
|
-
return demos;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
exports.AxBootstrapFewShot = AxBootstrapFewShot;
|
|
67
|
-
function groupTracesByKeys(programTraces) {
|
|
68
|
-
const groupedTraces = new Map();
|
|
69
|
-
// Group all traces by their keys
|
|
70
|
-
for (const programTrace of programTraces) {
|
|
71
|
-
if (groupedTraces.has(programTrace.programId)) {
|
|
72
|
-
groupedTraces.get(programTrace.programId).push(programTrace.trace);
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
groupedTraces.set(programTrace.programId, [programTrace.trace]);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
// Convert the Map into an array of ProgramDemos
|
|
79
|
-
const programDemosArray = [];
|
|
80
|
-
groupedTraces.forEach((traces, programId) => {
|
|
81
|
-
programDemosArray.push({ traces, programId });
|
|
82
|
-
});
|
|
83
|
-
return programDemosArray;
|
|
84
|
-
}
|
|
85
|
-
const randomSample = (array, n) => {
|
|
86
|
-
// Clone the array to avoid modifying the original array
|
|
87
|
-
const clonedArray = [...array];
|
|
88
|
-
// Shuffle the cloned array
|
|
89
|
-
for (let i = clonedArray.length - 1; i > 0; i--) {
|
|
90
|
-
const j = Math.floor(Math.random() * (i + 1));
|
|
91
|
-
const caI = clonedArray[i];
|
|
92
|
-
const caJ = clonedArray[j];
|
|
93
|
-
if (!caI || !caJ) {
|
|
94
|
-
throw new Error('Invalid array elements');
|
|
95
|
-
}
|
|
96
|
-
[clonedArray[i], clonedArray[j]] = [caJ, caI];
|
|
97
|
-
}
|
|
98
|
-
// Return the first `n` items of the shuffled array
|
|
99
|
-
return clonedArray.slice(0, n);
|
|
100
|
-
};
|
|
101
|
-
//# sourceMappingURL=optimize.js.map
|
package/cjs/dsp/optimize.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"optimize.js","sourceRoot":"","sources":["../../../dsp/optimize.ts"],"names":[],"mappings":";;;AAUA,uCAA8C;AAiB9C,MAAa,kBAAkB;IAIrB,EAAE,CAAc;IAChB,OAAO,CAA+B;IACtC,QAAQ,CAAwB;IAChC,SAAS,CAAS;IAClB,QAAQ,CAAS;IACjB,WAAW,CAAS;IACpB,MAAM,GAAqB,EAAE,CAAC;IAEtC,YAAY,EACV,EAAE,EACF,OAAO,EACP,QAAQ,GAAG,EAAE,EACb,OAAO,EAC4B;QACnC,IAAI,QAAQ,CAAC,MAAM,IAAI,CAAC,EAAE,CAAC;YACzB,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QACvC,CAAC;QACD,IAAI,CAAC,SAAS,GAAG,OAAO,EAAE,SAAS,IAAI,CAAC,CAAC;QACzC,IAAI,CAAC,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,CAAC,CAAC;QACvC,IAAI,CAAC,WAAW,GAAG,OAAO,EAAE,WAAW,IAAI,EAAE,CAAC;QAE9C,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC;QACb,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAEO,KAAK,CAAC,YAAY,CACxB,UAAkB,EAClB,QAAoB,EACpB,OAAuD;QAEvD,MAAM,EAAE,GAAG,IAAI,IAAI,EAAE,CAAC,OAAO,EAAE,CAAC;QAChC,MAAM,QAAQ,GAAG,OAAO,EAAE,QAAQ,IAAI,IAAI,CAAC,QAAQ,CAAC;QACpD,MAAM,KAAK,GAAG,EAAE,WAAW,EAAE,EAAE,WAAW,EAAE,GAAG,EAAE,EAAE,CAAC;QACpD,MAAM,QA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}
|
package/cjs/dsp/parser.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export type ParsedSignature = {
|
|
2
|
-
desc: any;
|
|
3
|
-
inputs: InputParsedFieldList;
|
|
4
|
-
outputs: OutputParsedFieldList;
|
|
5
|
-
};
|
|
6
|
-
export type InputParsedFieldList = InputParsedField[];
|
|
7
|
-
export type OutputParsedFieldList = OutputParsedField[];
|
|
8
|
-
export type InputParsedField = {
|
|
9
|
-
name: ParsedIdentifier;
|
|
10
|
-
desc: any;
|
|
11
|
-
type: NonNullable<{
|
|
12
|
-
name: TypeNotClass;
|
|
13
|
-
isArray: boolean;
|
|
14
|
-
} | null> | undefined;
|
|
15
|
-
isOptional: boolean;
|
|
16
|
-
};
|
|
17
|
-
export type OutputParsedField = ClassField | NonClassField;
|
|
18
|
-
export type ClassField = {
|
|
19
|
-
name: ParsedIdentifier;
|
|
20
|
-
type: {
|
|
21
|
-
name: "class";
|
|
22
|
-
isArray: boolean;
|
|
23
|
-
classes: string[];
|
|
24
|
-
};
|
|
25
|
-
isOptional: boolean;
|
|
26
|
-
};
|
|
27
|
-
export type NonClassField = {
|
|
28
|
-
name: ParsedIdentifier;
|
|
29
|
-
desc: any;
|
|
30
|
-
type: NonNullable<{
|
|
31
|
-
name: any;
|
|
32
|
-
isArray: boolean;
|
|
33
|
-
} | null> | undefined;
|
|
34
|
-
isOptional: boolean;
|
|
35
|
-
};
|
|
36
|
-
export type TypeNotClass = "string" | "number" | "boolean" | "json" | "image" | "audio" | "datetime" | "date";
|
|
37
|
-
export type Type = TypeNotClass | "class";
|
|
38
|
-
export type ParsedIdentifier = string;
|
|
39
|
-
export type ParsedString = string;
|
|
40
|
-
export declare function parseSignature(input: string): ParsedSignature;
|
package/cjs/dsp/parser.js
DELETED
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseSignature = parseSignature;
|
|
4
|
-
class SignatureParser {
|
|
5
|
-
input;
|
|
6
|
-
position;
|
|
7
|
-
constructor(input) {
|
|
8
|
-
this.input = input;
|
|
9
|
-
this.position = 0;
|
|
10
|
-
}
|
|
11
|
-
parse() {
|
|
12
|
-
this.skipWhitespace();
|
|
13
|
-
const optionalDesc = this.parseParsedString();
|
|
14
|
-
this.skipWhitespace();
|
|
15
|
-
const inputs = this.parseInputParsedFieldList();
|
|
16
|
-
this.skipWhitespace();
|
|
17
|
-
this.expect('->');
|
|
18
|
-
this.skipWhitespace();
|
|
19
|
-
const outputs = this.parseOutputParsedFieldList();
|
|
20
|
-
return {
|
|
21
|
-
desc: optionalDesc?.trim(),
|
|
22
|
-
inputs,
|
|
23
|
-
outputs,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
parseInputParsedFieldList() {
|
|
27
|
-
const fields = [];
|
|
28
|
-
fields.push(this.parseInputParsedField());
|
|
29
|
-
while (this.match(',')) {
|
|
30
|
-
this.skipWhitespace();
|
|
31
|
-
fields.push(this.parseInputParsedField());
|
|
32
|
-
}
|
|
33
|
-
return fields;
|
|
34
|
-
}
|
|
35
|
-
parseOutputParsedFieldList() {
|
|
36
|
-
const fields = [];
|
|
37
|
-
fields.push(this.parseOutputParsedField());
|
|
38
|
-
while (this.match(',')) {
|
|
39
|
-
this.skipWhitespace();
|
|
40
|
-
fields.push(this.parseOutputParsedField());
|
|
41
|
-
}
|
|
42
|
-
return fields;
|
|
43
|
-
}
|
|
44
|
-
parseInputParsedField() {
|
|
45
|
-
this.skipWhitespace();
|
|
46
|
-
const name = this.parseParsedIdentifier();
|
|
47
|
-
const isOptional = this.match('?');
|
|
48
|
-
let type;
|
|
49
|
-
let desc;
|
|
50
|
-
if (this.match(':')) {
|
|
51
|
-
this.skipWhitespace();
|
|
52
|
-
const typeName = this.parseTypeNotClass();
|
|
53
|
-
const isArray = this.match('[]');
|
|
54
|
-
type = { name: typeName, isArray };
|
|
55
|
-
}
|
|
56
|
-
this.skipWhitespace();
|
|
57
|
-
desc = this.parseParsedString();
|
|
58
|
-
return {
|
|
59
|
-
name,
|
|
60
|
-
desc: desc?.trim(),
|
|
61
|
-
type,
|
|
62
|
-
isOptional,
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
parseOutputParsedField() {
|
|
66
|
-
this.skipWhitespace();
|
|
67
|
-
const name = this.parseParsedIdentifier();
|
|
68
|
-
const isOptional = this.match('?');
|
|
69
|
-
this.skipWhitespace();
|
|
70
|
-
if (this.match(':')) {
|
|
71
|
-
this.skipWhitespace();
|
|
72
|
-
if (this.match('class')) {
|
|
73
|
-
const isArray = this.match('[]');
|
|
74
|
-
this.skipWhitespace();
|
|
75
|
-
const desc = this.parseParsedString();
|
|
76
|
-
if (!desc) {
|
|
77
|
-
throw new Error("Expected description containing class names after type 'class'");
|
|
78
|
-
}
|
|
79
|
-
const classNames = desc.split(',').map(s => s.trim());
|
|
80
|
-
return {
|
|
81
|
-
name,
|
|
82
|
-
type: { name: 'class', isArray, classes: classNames },
|
|
83
|
-
isOptional,
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
const typeName = this.parseTypeNotClass();
|
|
88
|
-
const isArray = this.match('[]');
|
|
89
|
-
this.skipWhitespace();
|
|
90
|
-
const desc = this.parseParsedString();
|
|
91
|
-
return {
|
|
92
|
-
name,
|
|
93
|
-
desc: desc?.trim(),
|
|
94
|
-
type: { name: typeName, isArray },
|
|
95
|
-
isOptional,
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
else {
|
|
100
|
-
this.skipWhitespace();
|
|
101
|
-
const desc = this.parseParsedString();
|
|
102
|
-
return {
|
|
103
|
-
name,
|
|
104
|
-
desc: desc?.trim(),
|
|
105
|
-
type: undefined,
|
|
106
|
-
isOptional,
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
parseTypeNotClass() {
|
|
111
|
-
const types = ["string", "number", "boolean", "json", "image", "audio", "datetime", "date"];
|
|
112
|
-
for (const type of types) {
|
|
113
|
-
if (this.match(type)) {
|
|
114
|
-
return type;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
throw new Error(`Expected one of ${types.join(', ')}`);
|
|
118
|
-
}
|
|
119
|
-
parseParsedIdentifier() {
|
|
120
|
-
const match = /^[a-zA-Z_][a-zA-Z_0-9]*/.exec(this.input.slice(this.position));
|
|
121
|
-
if (match) {
|
|
122
|
-
this.position += match[0].length;
|
|
123
|
-
return match[0];
|
|
124
|
-
}
|
|
125
|
-
throw new Error('Expected identifier');
|
|
126
|
-
}
|
|
127
|
-
parseParsedString() {
|
|
128
|
-
if (this.match("'")) {
|
|
129
|
-
const endQuote = this.input.indexOf("'", this.position);
|
|
130
|
-
if (endQuote === -1)
|
|
131
|
-
throw new Error("Unterminated string");
|
|
132
|
-
const content = this.input.slice(this.position, endQuote);
|
|
133
|
-
this.position = endQuote + 1;
|
|
134
|
-
return content;
|
|
135
|
-
}
|
|
136
|
-
else if (this.match('"')) {
|
|
137
|
-
const endQuote = this.input.indexOf('"', this.position);
|
|
138
|
-
if (endQuote === -1)
|
|
139
|
-
throw new Error("Unterminated string");
|
|
140
|
-
const content = this.input.slice(this.position, endQuote);
|
|
141
|
-
this.position = endQuote + 1;
|
|
142
|
-
return content;
|
|
143
|
-
}
|
|
144
|
-
return undefined;
|
|
145
|
-
}
|
|
146
|
-
skipWhitespace() {
|
|
147
|
-
const match = /^[ \t\r\n]+/.exec(this.input.slice(this.position));
|
|
148
|
-
if (match) {
|
|
149
|
-
this.position += match[0].length;
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
match(str) {
|
|
153
|
-
if (this.input.startsWith(str, this.position)) {
|
|
154
|
-
this.position += str.length;
|
|
155
|
-
return true;
|
|
156
|
-
}
|
|
157
|
-
return false;
|
|
158
|
-
}
|
|
159
|
-
expect(str) {
|
|
160
|
-
if (!this.match(str)) {
|
|
161
|
-
throw new Error(`Expected "${str}"`);
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
function parseSignature(input) {
|
|
166
|
-
const parser = new SignatureParser(input);
|
|
167
|
-
return parser.parse();
|
|
168
|
-
}
|
|
169
|
-
//# sourceMappingURL=parser.js.map
|
package/cjs/dsp/parser.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../../dsp/parser.ts"],"names":[],"mappings":";;AA6NA,wCAGC;AArLD,MAAM,eAAe;IACX,KAAK,CAAS;IACd,QAAQ,CAAS;IAEzB,YAAY,KAAa;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;IACpB,CAAC;IAED,KAAK;QACH,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,MAAM,YAAY,GAAG,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC9C,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,MAAM,MAAM,GAAG,IAAI,CAAC,yBAAyB,EAAE,CAAC;QAChD,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAClB,IAAI,CAAC,cAAc,EAAE,CAAC;QACtB,MAAM,OAAO,GAAG,IAAI,CAAC,0BAA0B,EAAE,CAAC;QAElD,OAAO;YACL,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE;YAC1B,MAAM;YACN,OAAO;SACR,CAAC;IACJ,CAAC;IAEO,yBAAyB;QAC/B,MAAM,MAAM,GAAuB,EAAE,CAAC;QACtC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,CAAC,CAAC;QAE1C,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YACvB,IAAI,CAAC,cAAc,EAAE,CAAC;YACtB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE,CA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C;IAEO,MAAM,CAAC,GAAW;QACxB,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;YACrB,MAAM,IAAI,KAAK,CAAC,aAAa,GAAG,GAAG,CAAC,CAAC;QACvC,CAAC;IACH,CAAC;CACF;AAED,SAAgB,cAAc,CAAC,KAAa;IAC1C,MAAM,MAAM,GAAG,IAAI,eAAe,CAAC,KAAK,CAAC,CAAC;IAC1C,OAAO,MAAM,CAAC,KAAK,EAAE,CAAC;AACxB,CAAC"}
|
package/cjs/dsp/program.d.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import type { AxAIService, AxChatRequest, AxChatResponse, AxFunction, AxModelConfig, AxRateLimiterFunction } from '../ai/types.js';
|
|
2
|
-
import type { AxAIMemory } from '../mem/types.js';
|
|
3
|
-
import type { AxTracer } from '../trace/index.js';
|
|
4
|
-
import { AxSignature } from './sig.js';
|
|
5
|
-
export type AxFieldValue = string | string[] | number | boolean | object | null | undefined | {
|
|
6
|
-
mimeType: string;
|
|
7
|
-
data: string;
|
|
8
|
-
} | {
|
|
9
|
-
mimeType: string;
|
|
10
|
-
data: string;
|
|
11
|
-
}[] | {
|
|
12
|
-
format?: 'wav';
|
|
13
|
-
data: string;
|
|
14
|
-
} | {
|
|
15
|
-
format?: 'wav';
|
|
16
|
-
data: string;
|
|
17
|
-
}[];
|
|
18
|
-
export type AxGenIn = {
|
|
19
|
-
[key: symbol]: AxFieldValue;
|
|
20
|
-
};
|
|
21
|
-
export type AxGenOut = Record<string, AxFieldValue>;
|
|
22
|
-
export type AxProgramTrace = {
|
|
23
|
-
trace: Record<string, AxFieldValue>;
|
|
24
|
-
programId: string;
|
|
25
|
-
};
|
|
26
|
-
export type AxProgramDemos = {
|
|
27
|
-
traces: Record<string, AxFieldValue>[];
|
|
28
|
-
programId: string;
|
|
29
|
-
};
|
|
30
|
-
export type AxProgramExamples = AxProgramDemos | AxProgramDemos['traces'];
|
|
31
|
-
export type AxProgramForwardOptions = {
|
|
32
|
-
maxCompletions?: number;
|
|
33
|
-
maxRetries?: number;
|
|
34
|
-
maxSteps?: number;
|
|
35
|
-
mem?: AxAIMemory;
|
|
36
|
-
ai?: AxAIService;
|
|
37
|
-
modelConfig?: AxModelConfig;
|
|
38
|
-
model?: string;
|
|
39
|
-
sessionId?: string;
|
|
40
|
-
traceId?: string | undefined;
|
|
41
|
-
tracer?: AxTracer;
|
|
42
|
-
rateLimiter?: AxRateLimiterFunction;
|
|
43
|
-
stream?: boolean;
|
|
44
|
-
debug?: boolean;
|
|
45
|
-
functions?: AxFunction[];
|
|
46
|
-
functionCall?: AxChatRequest['functionCall'];
|
|
47
|
-
stopFunction?: string;
|
|
48
|
-
};
|
|
49
|
-
export interface AxTunable {
|
|
50
|
-
setExamples: (examples: Readonly<AxProgramExamples>) => void;
|
|
51
|
-
setId: (id: string) => void;
|
|
52
|
-
setParentId: (parentId: string) => void;
|
|
53
|
-
getTraces: () => AxProgramTrace[];
|
|
54
|
-
setDemos: (demos: readonly AxProgramDemos[]) => void;
|
|
55
|
-
}
|
|
56
|
-
export interface AxUsable {
|
|
57
|
-
getUsage: () => AxProgramUsage[];
|
|
58
|
-
resetUsage: () => void;
|
|
59
|
-
}
|
|
60
|
-
export type AxProgramUsage = AxChatResponse['modelUsage'] & {
|
|
61
|
-
ai: string;
|
|
62
|
-
model: string;
|
|
63
|
-
};
|
|
64
|
-
export interface AxProgramWithSignatureOptions {
|
|
65
|
-
description?: string;
|
|
66
|
-
}
|
|
67
|
-
export declare class AxProgramWithSignature<IN extends AxGenIn, OUT extends AxGenOut> implements AxTunable, AxUsable {
|
|
68
|
-
protected signature: AxSignature;
|
|
69
|
-
protected sigHash: string;
|
|
70
|
-
protected examples?: Record<string, AxFieldValue>[];
|
|
71
|
-
protected demos?: Record<string, AxFieldValue>[];
|
|
72
|
-
protected trace?: Record<string, AxFieldValue>;
|
|
73
|
-
protected usage: AxProgramUsage[];
|
|
74
|
-
private key;
|
|
75
|
-
private children;
|
|
76
|
-
constructor(signature: Readonly<AxSignature | string>, options?: Readonly<AxProgramWithSignatureOptions>);
|
|
77
|
-
getSignature(): AxSignature;
|
|
78
|
-
register(prog: Readonly<AxTunable & AxUsable>): void;
|
|
79
|
-
forward(_ai: Readonly<AxAIService>, _values: IN, _options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
|
|
80
|
-
setId(id: string): void;
|
|
81
|
-
setParentId(parentId: string): void;
|
|
82
|
-
setExamples(examples: Readonly<AxProgramExamples>): void;
|
|
83
|
-
private _setExamples;
|
|
84
|
-
getTraces(): AxProgramTrace[];
|
|
85
|
-
getUsage(): AxProgramUsage[];
|
|
86
|
-
resetUsage(): void;
|
|
87
|
-
setDemos(demos: readonly AxProgramDemos[]): void;
|
|
88
|
-
}
|
|
89
|
-
export declare class AxProgram<IN extends AxGenIn, OUT extends AxGenOut> implements AxTunable, AxUsable {
|
|
90
|
-
protected trace?: Record<string, AxFieldValue>;
|
|
91
|
-
protected usage: AxProgramUsage[];
|
|
92
|
-
private key;
|
|
93
|
-
private children;
|
|
94
|
-
constructor();
|
|
95
|
-
register(prog: Readonly<AxTunable & AxUsable>): void;
|
|
96
|
-
forward(_ai: Readonly<AxAIService>, _values: IN, _options?: Readonly<AxProgramForwardOptions>): Promise<OUT>;
|
|
97
|
-
setId(id: string): void;
|
|
98
|
-
setParentId(parentId: string): void;
|
|
99
|
-
setExamples(examples: Readonly<AxProgramExamples>): void;
|
|
100
|
-
getTraces(): AxProgramTrace[];
|
|
101
|
-
getUsage(): AxProgramUsage[];
|
|
102
|
-
resetUsage(): void;
|
|
103
|
-
setDemos(demos: readonly AxProgramDemos[]): void;
|
|
104
|
-
}
|