@ax-llm/ax 9.0.21 → 9.0.22
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/ai/anthropic/api.d.ts +19 -0
- package/ai/anthropic/api.js +326 -0
- package/ai/anthropic/api.js.map +1 -0
- package/ai/anthropic/index.d.ts +2 -0
- package/ai/anthropic/index.js +3 -0
- package/ai/anthropic/index.js.map +1 -0
- package/ai/anthropic/info.d.ts +2 -0
- package/ai/anthropic/info.js +40 -0
- package/ai/anthropic/info.js.map +1 -0
- package/ai/anthropic/types.d.ts +171 -0
- package/ai/anthropic/types.js +10 -0
- package/ai/anthropic/types.js.map +1 -0
- package/ai/azure-openai/api.d.ts +19 -0
- package/ai/azure-openai/api.js +30 -0
- package/ai/azure-openai/api.js.map +1 -0
- package/ai/azure-openai/index.d.ts +1 -0
- package/ai/azure-openai/index.js +2 -0
- package/ai/azure-openai/index.js.map +1 -0
- package/ai/balance.d.ts +23 -0
- package/ai/balance.js +87 -0
- package/ai/balance.js.map +1 -0
- package/ai/base.d.ts +55 -0
- package/ai/base.js +343 -0
- package/ai/base.js.map +1 -0
- package/ai/cohere/api.d.ts +22 -0
- package/ai/cohere/api.js +264 -0
- package/ai/cohere/api.js.map +1 -0
- package/ai/cohere/index.d.ts +2 -0
- package/ai/cohere/index.js +3 -0
- package/ai/cohere/index.js.map +1 -0
- package/ai/cohere/info.d.ts +2 -0
- package/ai/cohere/info.js +52 -0
- package/ai/cohere/info.js.map +1 -0
- package/ai/cohere/types.d.ts +102 -0
- package/ai/cohere/types.js +23 -0
- package/ai/cohere/types.js.map +1 -0
- package/ai/deepseek/api.d.ts +16 -0
- package/ai/deepseek/api.js +32 -0
- package/ai/deepseek/api.js.map +1 -0
- package/ai/deepseek/index.d.ts +2 -0
- package/ai/deepseek/index.js +3 -0
- package/ai/deepseek/index.js.map +1 -0
- package/ai/deepseek/info.d.ts +2 -0
- package/ai/deepseek/info.js +16 -0
- package/ai/deepseek/info.js.map +1 -0
- package/ai/deepseek/types.d.ts +8 -0
- package/ai/deepseek/types.js +10 -0
- package/ai/deepseek/types.js.map +1 -0
- package/ai/google-gemini/api.d.ts +36 -0
- package/ai/google-gemini/api.js +299 -0
- package/ai/google-gemini/api.js.map +1 -0
- package/ai/google-gemini/index.d.ts +2 -0
- package/ai/google-gemini/index.js +3 -0
- package/ai/google-gemini/index.js.map +1 -0
- package/ai/google-gemini/info.d.ts +6 -0
- package/ai/google-gemini/info.js +29 -0
- package/ai/google-gemini/info.js.map +1 -0
- package/ai/google-gemini/types.d.ts +146 -0
- package/ai/google-gemini/types.js +27 -0
- package/ai/google-gemini/types.js.map +1 -0
- package/ai/groq/api.d.ts +18 -0
- package/ai/groq/api.js +52 -0
- package/ai/groq/api.js.map +1 -0
- package/ai/groq/index.d.ts +1 -0
- package/ai/groq/index.js +2 -0
- package/ai/groq/index.js.map +1 -0
- package/ai/groq/types.d.ts +6 -0
- package/ai/groq/types.js +8 -0
- package/ai/groq/types.js.map +1 -0
- package/ai/huggingface/api.d.ts +19 -0
- package/ai/huggingface/api.js +115 -0
- package/ai/huggingface/api.js.map +1 -0
- package/ai/huggingface/index.d.ts +2 -0
- package/ai/huggingface/index.js +3 -0
- package/ai/huggingface/index.js.map +1 -0
- package/ai/huggingface/info.d.ts +6 -0
- package/ai/huggingface/info.js +6 -0
- package/ai/huggingface/info.js.map +1 -0
- package/ai/huggingface/types.d.ts +34 -0
- package/ai/huggingface/types.js +5 -0
- package/ai/huggingface/types.js.map +1 -0
- package/ai/index.d.ts +16 -0
- package/ai/index.js +16 -0
- package/ai/index.js.map +1 -0
- package/ai/mistral/api.d.ts +16 -0
- package/ai/mistral/api.js +32 -0
- package/ai/mistral/api.js.map +1 -0
- package/ai/mistral/index.d.ts +2 -0
- package/ai/mistral/index.js +3 -0
- package/ai/mistral/index.js.map +1 -0
- package/ai/mistral/info.d.ts +2 -0
- package/ai/mistral/info.js +34 -0
- package/ai/mistral/info.js.map +1 -0
- package/ai/mistral/types.d.ts +10 -0
- package/ai/mistral/types.js +13 -0
- package/ai/mistral/types.js.map +1 -0
- package/ai/ollama/api.d.ts +22 -0
- package/ai/ollama/api.js +32 -0
- package/ai/ollama/api.js.map +1 -0
- package/ai/ollama/index.d.ts +1 -0
- package/ai/ollama/index.js +2 -0
- package/ai/ollama/index.js.map +1 -0
- package/ai/openai/api.d.ts +29 -0
- package/ai/openai/api.js +283 -0
- package/ai/openai/api.js.map +1 -0
- package/ai/openai/index.d.ts +2 -0
- package/ai/openai/index.js +3 -0
- package/ai/openai/index.js.map +1 -0
- package/ai/openai/info.d.ts +6 -0
- package/ai/openai/info.js +50 -0
- package/ai/openai/info.js.map +1 -0
- package/ai/openai/types.d.ts +165 -0
- package/ai/openai/types.js +18 -0
- package/ai/openai/types.js.map +1 -0
- package/ai/together/api.d.ts +15 -0
- package/ai/together/api.js +28 -0
- package/ai/together/api.js.map +1 -0
- package/ai/together/index.d.ts +1 -0
- package/ai/together/index.js +2 -0
- package/ai/together/index.js.map +1 -0
- package/ai/together/info.d.ts +2 -0
- package/ai/together/info.js +2 -0
- package/ai/together/info.js.map +1 -0
- package/ai/types.d.ts +159 -0
- package/ai/types.js +2 -0
- package/ai/types.js.map +1 -0
- package/ai/util.d.ts +12 -0
- package/ai/util.js +63 -0
- package/ai/util.js.map +1 -0
- package/ai/wrap.d.ts +47 -0
- package/ai/wrap.js +95 -0
- package/ai/wrap.js.map +1 -0
- package/cjs/ai/anthropic/api.d.ts +19 -0
- package/cjs/ai/anthropic/api.js +331 -0
- package/cjs/ai/anthropic/api.js.map +1 -0
- package/cjs/ai/anthropic/index.d.ts +2 -0
- package/cjs/ai/anthropic/index.js +19 -0
- package/cjs/ai/anthropic/index.js.map +1 -0
- package/cjs/ai/anthropic/info.d.ts +2 -0
- package/cjs/ai/anthropic/info.js +43 -0
- package/cjs/ai/anthropic/info.js.map +1 -0
- package/cjs/ai/anthropic/types.d.ts +171 -0
- package/cjs/ai/anthropic/types.js +13 -0
- package/cjs/ai/anthropic/types.js.map +1 -0
- package/cjs/ai/azure-openai/api.d.ts +19 -0
- package/cjs/ai/azure-openai/api.js +34 -0
- package/cjs/ai/azure-openai/api.js.map +1 -0
- package/cjs/ai/azure-openai/index.d.ts +1 -0
- package/cjs/ai/azure-openai/index.js +18 -0
- package/cjs/ai/azure-openai/index.js.map +1 -0
- package/cjs/ai/balance.d.ts +23 -0
- package/cjs/ai/balance.js +91 -0
- package/cjs/ai/balance.js.map +1 -0
- package/cjs/ai/base.d.ts +55 -0
- package/cjs/ai/base.js +349 -0
- package/cjs/ai/base.js.map +1 -0
- package/cjs/ai/cohere/api.d.ts +22 -0
- package/cjs/ai/cohere/api.js +270 -0
- package/cjs/ai/cohere/api.js.map +1 -0
- package/cjs/ai/cohere/index.d.ts +2 -0
- package/cjs/ai/cohere/index.js +19 -0
- package/cjs/ai/cohere/index.js.map +1 -0
- package/cjs/ai/cohere/info.d.ts +2 -0
- package/cjs/ai/cohere/info.js +55 -0
- package/cjs/ai/cohere/info.js.map +1 -0
- package/cjs/ai/cohere/types.d.ts +102 -0
- package/cjs/ai/cohere/types.js +26 -0
- package/cjs/ai/cohere/types.js.map +1 -0
- package/cjs/ai/deepseek/api.d.ts +16 -0
- package/cjs/ai/deepseek/api.js +38 -0
- package/cjs/ai/deepseek/api.js.map +1 -0
- package/cjs/ai/deepseek/index.d.ts +2 -0
- package/cjs/ai/deepseek/index.js +19 -0
- package/cjs/ai/deepseek/index.js.map +1 -0
- package/cjs/ai/deepseek/info.d.ts +2 -0
- package/cjs/ai/deepseek/info.js +19 -0
- package/cjs/ai/deepseek/info.js.map +1 -0
- package/cjs/ai/deepseek/types.d.ts +8 -0
- package/cjs/ai/deepseek/types.js +13 -0
- package/cjs/ai/deepseek/types.js.map +1 -0
- package/cjs/ai/google-gemini/api.d.ts +36 -0
- package/cjs/ai/google-gemini/api.js +305 -0
- package/cjs/ai/google-gemini/api.js.map +1 -0
- package/cjs/ai/google-gemini/index.d.ts +2 -0
- package/cjs/ai/google-gemini/index.js +19 -0
- package/cjs/ai/google-gemini/index.js.map +1 -0
- package/cjs/ai/google-gemini/info.d.ts +6 -0
- package/cjs/ai/google-gemini/info.js +32 -0
- package/cjs/ai/google-gemini/info.js.map +1 -0
- package/cjs/ai/google-gemini/types.d.ts +146 -0
- package/cjs/ai/google-gemini/types.js +30 -0
- package/cjs/ai/google-gemini/types.js.map +1 -0
- package/cjs/ai/groq/api.d.ts +18 -0
- package/cjs/ai/groq/api.js +56 -0
- package/cjs/ai/groq/api.js.map +1 -0
- package/cjs/ai/groq/index.d.ts +1 -0
- package/cjs/ai/groq/index.js +18 -0
- package/cjs/ai/groq/index.js.map +1 -0
- package/cjs/ai/groq/types.d.ts +6 -0
- package/cjs/ai/groq/types.js +11 -0
- package/cjs/ai/groq/types.js.map +1 -0
- package/cjs/ai/huggingface/api.d.ts +19 -0
- package/cjs/ai/huggingface/api.js +121 -0
- package/cjs/ai/huggingface/api.js.map +1 -0
- package/cjs/ai/huggingface/index.d.ts +2 -0
- package/cjs/ai/huggingface/index.js +19 -0
- package/cjs/ai/huggingface/index.js.map +1 -0
- package/cjs/ai/huggingface/info.d.ts +6 -0
- package/cjs/ai/huggingface/info.js +9 -0
- package/cjs/ai/huggingface/info.js.map +1 -0
- package/cjs/ai/huggingface/types.d.ts +34 -0
- package/cjs/ai/huggingface/types.js +8 -0
- package/cjs/ai/huggingface/types.js.map +1 -0
- package/cjs/ai/index.d.ts +16 -0
- package/cjs/ai/index.js +32 -0
- package/cjs/ai/index.js.map +1 -0
- package/cjs/ai/mistral/api.d.ts +16 -0
- package/cjs/ai/mistral/api.js +38 -0
- package/cjs/ai/mistral/api.js.map +1 -0
- package/cjs/ai/mistral/index.d.ts +2 -0
- package/cjs/ai/mistral/index.js +19 -0
- package/cjs/ai/mistral/index.js.map +1 -0
- package/cjs/ai/mistral/info.d.ts +2 -0
- package/cjs/ai/mistral/info.js +37 -0
- package/cjs/ai/mistral/info.js.map +1 -0
- package/cjs/ai/mistral/types.d.ts +10 -0
- package/cjs/ai/mistral/types.js +16 -0
- package/cjs/ai/mistral/types.js.map +1 -0
- package/cjs/ai/ollama/api.d.ts +22 -0
- package/cjs/ai/ollama/api.js +38 -0
- package/cjs/ai/ollama/api.js.map +1 -0
- package/cjs/ai/ollama/index.d.ts +1 -0
- package/cjs/ai/ollama/index.js +18 -0
- package/cjs/ai/ollama/index.js.map +1 -0
- package/cjs/ai/openai/api.d.ts +29 -0
- package/cjs/ai/openai/api.js +291 -0
- package/cjs/ai/openai/api.js.map +1 -0
- package/cjs/ai/openai/index.d.ts +2 -0
- package/cjs/ai/openai/index.js +19 -0
- package/cjs/ai/openai/index.js.map +1 -0
- package/cjs/ai/openai/info.d.ts +6 -0
- package/cjs/ai/openai/info.js +53 -0
- package/cjs/ai/openai/info.js.map +1 -0
- package/cjs/ai/openai/types.d.ts +165 -0
- package/cjs/ai/openai/types.js +21 -0
- package/cjs/ai/openai/types.js.map +1 -0
- package/cjs/ai/together/api.d.ts +15 -0
- package/cjs/ai/together/api.js +33 -0
- package/cjs/ai/together/api.js.map +1 -0
- package/cjs/ai/together/index.d.ts +1 -0
- package/cjs/ai/together/index.js +18 -0
- package/cjs/ai/together/index.js.map +1 -0
- package/cjs/ai/together/info.d.ts +2 -0
- package/cjs/ai/together/info.js +5 -0
- package/cjs/ai/together/info.js.map +1 -0
- package/cjs/ai/types.d.ts +159 -0
- package/cjs/ai/types.js +3 -0
- package/cjs/ai/types.js.map +1 -0
- package/cjs/ai/util.d.ts +12 -0
- package/cjs/ai/util.js +71 -0
- package/cjs/ai/util.js.map +1 -0
- package/cjs/ai/wrap.d.ts +47 -0
- package/cjs/ai/wrap.js +99 -0
- package/cjs/ai/wrap.js.map +1 -0
- package/cjs/db/base.d.ts +23 -0
- package/cjs/db/base.js +91 -0
- package/cjs/db/base.js.map +1 -0
- package/cjs/db/cloudflare.d.ts +21 -0
- package/cjs/db/cloudflare.js +102 -0
- package/cjs/db/cloudflare.js.map +1 -0
- package/cjs/db/index.d.ts +6 -0
- package/cjs/db/index.js +23 -0
- package/cjs/db/index.js.map +1 -0
- package/cjs/db/memory.d.ts +21 -0
- package/cjs/db/memory.js +103 -0
- package/cjs/db/memory.js.map +1 -0
- package/cjs/db/pinecone.d.ts +21 -0
- package/cjs/db/pinecone.js +75 -0
- package/cjs/db/pinecone.js.map +1 -0
- package/cjs/db/types.d.ts +35 -0
- package/cjs/db/types.js +4 -0
- package/cjs/db/types.js.map +1 -0
- package/cjs/db/weaviate.d.ts +21 -0
- package/cjs/db/weaviate.js +131 -0
- package/cjs/db/weaviate.js.map +1 -0
- package/cjs/db/wrap.d.ts +13 -0
- package/cjs/db/wrap.js +39 -0
- package/cjs/db/wrap.js.map +1 -0
- package/cjs/docs/index.d.ts +4 -0
- package/cjs/docs/index.js +21 -0
- package/cjs/docs/index.js.map +1 -0
- package/cjs/docs/manager.d.ts +45 -0
- package/cjs/docs/manager.js +162 -0
- package/cjs/docs/manager.js.map +1 -0
- package/cjs/docs/reranker.d.ts +7 -0
- package/cjs/docs/reranker.js +30 -0
- package/cjs/docs/reranker.js.map +1 -0
- package/cjs/docs/rewriter.d.ts +4 -0
- package/cjs/docs/rewriter.js +13 -0
- package/cjs/docs/rewriter.js.map +1 -0
- package/cjs/docs/tika.d.ts +18 -0
- package/cjs/docs/tika.js +50 -0
- package/cjs/docs/tika.js.map +1 -0
- package/cjs/dsp/asserts.d.ts +32 -0
- package/cjs/dsp/asserts.js +98 -0
- package/cjs/dsp/asserts.js.map +1 -0
- package/cjs/dsp/eval.d.ts +43 -0
- package/cjs/dsp/eval.js +128 -0
- package/cjs/dsp/eval.js.map +1 -0
- package/cjs/dsp/evaluate.d.ts +12 -0
- package/cjs/dsp/evaluate.js +36 -0
- package/cjs/dsp/evaluate.js.map +1 -0
- package/cjs/dsp/extract.d.ts +25 -0
- package/cjs/dsp/extract.js +164 -0
- package/cjs/dsp/extract.js.map +1 -0
- package/cjs/dsp/generate.d.ts +55 -0
- package/cjs/dsp/generate.js +314 -0
- package/cjs/dsp/generate.js.map +1 -0
- package/cjs/dsp/index.d.ts +15 -0
- package/cjs/dsp/index.js +27 -0
- package/cjs/dsp/index.js.map +1 -0
- package/cjs/dsp/loader.d.ts +30 -0
- package/cjs/dsp/loader.js +85 -0
- package/cjs/dsp/loader.js.map +1 -0
- package/cjs/dsp/optimize.d.ts +27 -0
- package/cjs/dsp/optimize.js +99 -0
- package/cjs/dsp/optimize.js.map +1 -0
- package/cjs/dsp/parser.d.ts +87 -0
- package/cjs/dsp/parser.js +1545 -0
- package/cjs/dsp/parser.js.map +1 -0
- package/cjs/dsp/program.d.ts +73 -0
- package/cjs/dsp/program.js +120 -0
- package/cjs/dsp/program.js.map +1 -0
- package/cjs/dsp/prompt.d.ts +48 -0
- package/cjs/dsp/prompt.js +263 -0
- package/cjs/dsp/prompt.js.map +1 -0
- package/cjs/dsp/registry.d.ts +6 -0
- package/cjs/dsp/registry.js +19 -0
- package/cjs/dsp/registry.js.map +1 -0
- package/cjs/dsp/router.d.ts +26 -0
- package/cjs/dsp/router.js +76 -0
- package/cjs/dsp/router.js.map +1 -0
- package/cjs/dsp/sig.d.ts +37 -0
- package/cjs/dsp/sig.js +197 -0
- package/cjs/dsp/sig.js.map +1 -0
- package/cjs/dsp/stopwords.d.ts +1 -0
- package/cjs/dsp/stopwords.js +1167 -0
- package/cjs/dsp/stopwords.js.map +1 -0
- package/cjs/dsp/strutil.d.ts +11 -0
- package/cjs/dsp/strutil.js +63 -0
- package/cjs/dsp/strutil.js.map +1 -0
- package/cjs/dsp/util.d.ts +5 -0
- package/cjs/dsp/util.js +82 -0
- package/cjs/dsp/util.js.map +1 -0
- package/cjs/funcs/code.d.ts +9 -0
- package/cjs/funcs/code.js +90 -0
- package/cjs/funcs/code.js.map +1 -0
- package/cjs/funcs/embed.d.ts +6 -0
- package/cjs/funcs/embed.js +33 -0
- package/cjs/funcs/embed.js.map +1 -0
- package/cjs/funcs/functions.d.ts +16 -0
- package/cjs/funcs/functions.js +62 -0
- package/cjs/funcs/functions.js.map +1 -0
- package/cjs/funcs/index.d.ts +3 -0
- package/cjs/funcs/index.js +20 -0
- package/cjs/funcs/index.js.map +1 -0
- package/cjs/funcs/jsonschema.d.ts +2 -0
- package/cjs/funcs/jsonschema.js +101 -0
- package/cjs/funcs/jsonschema.js.map +1 -0
- package/cjs/index.d.ts +9 -0
- package/cjs/index.js +34 -0
- package/cjs/index.js.map +1 -0
- package/cjs/mem/index.d.ts +2 -0
- package/cjs/mem/index.js +19 -0
- package/cjs/mem/index.js.map +1 -0
- package/cjs/mem/memory.d.ts +16 -0
- package/cjs/mem/memory.js +81 -0
- package/cjs/mem/memory.js.map +1 -0
- package/cjs/mem/types.d.ts +10 -0
- package/cjs/mem/types.js +3 -0
- package/cjs/mem/types.js.map +1 -0
- package/cjs/prompts/agent.d.ts +34 -0
- package/cjs/prompts/agent.js +110 -0
- package/cjs/prompts/agent.js.map +1 -0
- package/cjs/prompts/cot.d.ts +9 -0
- package/cjs/prompts/cot.js +21 -0
- package/cjs/prompts/cot.js.map +1 -0
- package/cjs/prompts/index.d.ts +4 -0
- package/cjs/prompts/index.js +21 -0
- package/cjs/prompts/index.js.map +1 -0
- package/cjs/prompts/rag.d.ts +23 -0
- package/cjs/prompts/rag.js +33 -0
- package/cjs/prompts/rag.js.map +1 -0
- package/cjs/prompts/react.d.ts +8 -0
- package/cjs/prompts/react.js +26 -0
- package/cjs/prompts/react.js.map +1 -0
- package/cjs/trace/index.d.ts +171 -0
- package/cjs/trace/index.js +70 -0
- package/cjs/trace/index.js.map +1 -0
- package/cjs/util/apicall.d.ts +18 -0
- package/cjs/util/apicall.js +57 -0
- package/cjs/util/apicall.js.map +1 -0
- package/cjs/util/log.d.ts +14 -0
- package/cjs/util/log.js +35 -0
- package/cjs/util/log.js.map +1 -0
- package/cjs/util/other.d.ts +1 -0
- package/cjs/util/other.js +8 -0
- package/cjs/util/other.js.map +1 -0
- package/cjs/util/rate-limit.d.ts +24 -0
- package/cjs/util/rate-limit.js +53 -0
- package/cjs/util/rate-limit.js.map +1 -0
- package/cjs/util/stream.d.ts +9 -0
- package/cjs/util/stream.js +33 -0
- package/cjs/util/stream.js.map +1 -0
- package/cjs/util/transform.d.ts +7 -0
- package/cjs/util/transform.js +64 -0
- package/cjs/util/transform.js.map +1 -0
- package/db/base.d.ts +23 -0
- package/db/base.js +87 -0
- package/db/base.js.map +1 -0
- package/db/cloudflare.d.ts +21 -0
- package/db/cloudflare.js +98 -0
- package/db/cloudflare.js.map +1 -0
- package/db/index.d.ts +6 -0
- package/db/index.js +7 -0
- package/db/index.js.map +1 -0
- package/db/memory.d.ts +21 -0
- package/db/memory.js +99 -0
- package/db/memory.js.map +1 -0
- package/db/pinecone.d.ts +21 -0
- package/db/pinecone.js +71 -0
- package/db/pinecone.js.map +1 -0
- package/db/types.d.ts +35 -0
- package/db/types.js +3 -0
- package/db/types.js.map +1 -0
- package/db/weaviate.d.ts +21 -0
- package/db/weaviate.js +127 -0
- package/db/weaviate.js.map +1 -0
- package/db/wrap.d.ts +13 -0
- package/db/wrap.js +35 -0
- package/db/wrap.js.map +1 -0
- package/docs/index.d.ts +4 -0
- package/docs/index.js +5 -0
- package/docs/index.js.map +1 -0
- package/docs/manager.d.ts +45 -0
- package/docs/manager.js +159 -0
- package/docs/manager.js.map +1 -0
- package/docs/reranker.d.ts +7 -0
- package/docs/reranker.js +26 -0
- package/docs/reranker.js.map +1 -0
- package/docs/rewriter.d.ts +4 -0
- package/docs/rewriter.js +9 -0
- package/docs/rewriter.js.map +1 -0
- package/docs/tika.d.ts +18 -0
- package/docs/tika.js +46 -0
- package/docs/tika.js.map +1 -0
- package/dsp/asserts.d.ts +32 -0
- package/dsp/asserts.js +91 -0
- package/dsp/asserts.js.map +1 -0
- package/dsp/eval.d.ts +43 -0
- package/dsp/eval.js +125 -0
- package/dsp/eval.js.map +1 -0
- package/dsp/evaluate.d.ts +12 -0
- package/dsp/evaluate.js +32 -0
- package/dsp/evaluate.js.map +1 -0
- package/dsp/extract.d.ts +25 -0
- package/dsp/extract.js +153 -0
- package/dsp/extract.js.map +1 -0
- package/dsp/generate.d.ts +55 -0
- package/dsp/generate.js +311 -0
- package/dsp/generate.js.map +1 -0
- package/dsp/index.d.ts +15 -0
- package/dsp/index.js +11 -0
- package/dsp/index.js.map +1 -0
- package/dsp/loader.d.ts +30 -0
- package/dsp/loader.js +81 -0
- package/dsp/loader.js.map +1 -0
- package/dsp/optimize.d.ts +27 -0
- package/dsp/optimize.js +95 -0
- package/dsp/optimize.js.map +1 -0
- package/dsp/parser.d.ts +87 -0
- package/dsp/parser.js +1542 -0
- package/dsp/parser.js.map +1 -0
- package/dsp/program.d.ts +73 -0
- package/dsp/program.js +116 -0
- package/dsp/program.js.map +1 -0
- package/dsp/prompt.d.ts +48 -0
- package/dsp/prompt.js +260 -0
- package/dsp/prompt.js.map +1 -0
- package/dsp/registry.d.ts +6 -0
- package/dsp/registry.js +15 -0
- package/dsp/registry.js.map +1 -0
- package/dsp/router.d.ts +26 -0
- package/dsp/router.js +71 -0
- package/dsp/router.js.map +1 -0
- package/dsp/sig.d.ts +37 -0
- package/dsp/sig.js +193 -0
- package/dsp/sig.js.map +1 -0
- package/dsp/stopwords.d.ts +1 -0
- package/dsp/stopwords.js +1164 -0
- package/dsp/stopwords.js.map +1 -0
- package/dsp/strutil.d.ts +11 -0
- package/dsp/strutil.js +60 -0
- package/dsp/strutil.js.map +1 -0
- package/dsp/util.d.ts +5 -0
- package/dsp/util.js +76 -0
- package/dsp/util.js.map +1 -0
- package/funcs/code.d.ts +9 -0
- package/funcs/code.js +63 -0
- package/funcs/code.js.map +1 -0
- package/funcs/embed.d.ts +6 -0
- package/funcs/embed.js +29 -0
- package/funcs/embed.js.map +1 -0
- package/funcs/functions.d.ts +16 -0
- package/funcs/functions.js +55 -0
- package/funcs/functions.js.map +1 -0
- package/funcs/index.d.ts +3 -0
- package/funcs/index.js +4 -0
- package/funcs/index.js.map +1 -0
- package/funcs/jsonschema.d.ts +2 -0
- package/funcs/jsonschema.js +97 -0
- package/funcs/jsonschema.js.map +1 -0
- package/index.d.ts +9 -0
- package/index.js.map +1 -0
- package/mem/index.d.ts +2 -0
- package/mem/index.js +3 -0
- package/mem/index.js.map +1 -0
- package/mem/memory.d.ts +16 -0
- package/mem/memory.js +77 -0
- package/mem/memory.js.map +1 -0
- package/mem/types.d.ts +10 -0
- package/mem/types.js +2 -0
- package/mem/types.js.map +1 -0
- package/package.json +4 -7
- package/prompts/agent.d.ts +34 -0
- package/prompts/agent.js +108 -0
- package/prompts/agent.js.map +1 -0
- package/prompts/cot.d.ts +9 -0
- package/prompts/cot.js +17 -0
- package/prompts/cot.js.map +1 -0
- package/prompts/index.d.ts +4 -0
- package/prompts/index.js +5 -0
- package/prompts/index.js.map +1 -0
- package/prompts/rag.d.ts +23 -0
- package/prompts/rag.js +30 -0
- package/prompts/rag.js.map +1 -0
- package/prompts/react.d.ts +8 -0
- package/prompts/react.js +22 -0
- package/prompts/react.js.map +1 -0
- package/trace/index.d.ts +171 -0
- package/trace/index.js +67 -0
- package/trace/index.js.map +1 -0
- package/util/apicall.d.ts +18 -0
- package/util/apicall.js +50 -0
- package/util/apicall.js.map +1 -0
- package/util/log.d.ts +14 -0
- package/util/log.js +31 -0
- package/util/log.js.map +1 -0
- package/util/other.d.ts +1 -0
- package/util/other.js +5 -0
- package/util/other.js.map +1 -0
- package/util/rate-limit.d.ts +24 -0
- package/util/rate-limit.js +49 -0
- package/util/rate-limit.js.map +1 -0
- package/util/stream.d.ts +9 -0
- package/util/stream.js +29 -0
- package/util/stream.js.map +1 -0
- package/util/transform.d.ts +7 -0
- package/util/transform.js +59 -0
- package/util/transform.js.map +1 -0
package/ai/types.d.ts
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import type { ReadableStream } from 'stream/web';
|
|
2
|
+
import type { AxTracer } from '../trace/index.js';
|
|
3
|
+
export type AxModelInfo = {
|
|
4
|
+
name: string;
|
|
5
|
+
currency?: string;
|
|
6
|
+
characterIsToken?: boolean;
|
|
7
|
+
promptTokenCostPer1M?: number;
|
|
8
|
+
completionTokenCostPer1M?: number;
|
|
9
|
+
aliases?: string[];
|
|
10
|
+
};
|
|
11
|
+
export type AxTokenUsage = {
|
|
12
|
+
promptTokens: number;
|
|
13
|
+
completionTokens: number;
|
|
14
|
+
totalTokens: number;
|
|
15
|
+
};
|
|
16
|
+
export type AxModelConfig = {
|
|
17
|
+
maxTokens?: number;
|
|
18
|
+
temperature?: number;
|
|
19
|
+
topP?: number;
|
|
20
|
+
topK?: number;
|
|
21
|
+
presencePenalty?: number;
|
|
22
|
+
frequencyPenalty?: number;
|
|
23
|
+
stopSequences?: string[];
|
|
24
|
+
endSequences?: string[];
|
|
25
|
+
stream?: boolean;
|
|
26
|
+
n?: number;
|
|
27
|
+
};
|
|
28
|
+
export type AxFunctionHandler = (args?: any, extra?: Readonly<{
|
|
29
|
+
sessionId?: string;
|
|
30
|
+
traceId?: string;
|
|
31
|
+
}>) => unknown;
|
|
32
|
+
export type AxFunctionJSONSchema = {
|
|
33
|
+
type: string;
|
|
34
|
+
properties?: Record<string, AxFunctionJSONSchema & {
|
|
35
|
+
enum?: string[];
|
|
36
|
+
description: string;
|
|
37
|
+
}>;
|
|
38
|
+
required?: string[];
|
|
39
|
+
items?: AxFunctionJSONSchema;
|
|
40
|
+
};
|
|
41
|
+
export type AxFunction = {
|
|
42
|
+
name: string;
|
|
43
|
+
description: string;
|
|
44
|
+
parameters?: AxFunctionJSONSchema;
|
|
45
|
+
func?: AxFunctionHandler;
|
|
46
|
+
};
|
|
47
|
+
export type AxChatResponseResult = {
|
|
48
|
+
content?: string;
|
|
49
|
+
name?: string;
|
|
50
|
+
id?: string;
|
|
51
|
+
functionCalls?: {
|
|
52
|
+
id: string;
|
|
53
|
+
type: 'function';
|
|
54
|
+
function: {
|
|
55
|
+
name: string;
|
|
56
|
+
params?: string | object;
|
|
57
|
+
};
|
|
58
|
+
}[];
|
|
59
|
+
finishReason?: 'stop' | 'length' | 'function_call' | 'content_filter' | 'error';
|
|
60
|
+
};
|
|
61
|
+
export type AxChatResponse = {
|
|
62
|
+
sessionId?: string;
|
|
63
|
+
remoteId?: string;
|
|
64
|
+
results: readonly AxChatResponseResult[];
|
|
65
|
+
modelUsage?: AxTokenUsage;
|
|
66
|
+
embedModelUsage?: AxTokenUsage;
|
|
67
|
+
};
|
|
68
|
+
export type AxEmbedResponse = {
|
|
69
|
+
remoteId?: string;
|
|
70
|
+
sessionId?: string;
|
|
71
|
+
embeddings: readonly (readonly number[])[];
|
|
72
|
+
modelUsage?: AxTokenUsage;
|
|
73
|
+
};
|
|
74
|
+
export type AxModelInfoWithProvider = AxModelInfo & {
|
|
75
|
+
provider: string;
|
|
76
|
+
};
|
|
77
|
+
export type AxChatRequest = {
|
|
78
|
+
chatPrompt: Readonly<{
|
|
79
|
+
role: 'system';
|
|
80
|
+
content: string;
|
|
81
|
+
} | {
|
|
82
|
+
role: 'user';
|
|
83
|
+
name?: string;
|
|
84
|
+
content: string | ({
|
|
85
|
+
type: 'text';
|
|
86
|
+
text: string;
|
|
87
|
+
} | {
|
|
88
|
+
type: 'image';
|
|
89
|
+
mimeType: string;
|
|
90
|
+
image: string;
|
|
91
|
+
details?: 'high' | 'low' | 'auto';
|
|
92
|
+
})[];
|
|
93
|
+
} | {
|
|
94
|
+
role: 'assistant';
|
|
95
|
+
content?: string;
|
|
96
|
+
name?: string;
|
|
97
|
+
functionCalls?: {
|
|
98
|
+
id: string;
|
|
99
|
+
type: 'function';
|
|
100
|
+
function: {
|
|
101
|
+
name: string;
|
|
102
|
+
params?: string | object;
|
|
103
|
+
};
|
|
104
|
+
}[];
|
|
105
|
+
} | {
|
|
106
|
+
role: 'function';
|
|
107
|
+
result: string;
|
|
108
|
+
functionId: string;
|
|
109
|
+
}>[];
|
|
110
|
+
functions?: Readonly<{
|
|
111
|
+
name: string;
|
|
112
|
+
description: string;
|
|
113
|
+
parameters?: AxFunctionJSONSchema;
|
|
114
|
+
}>[];
|
|
115
|
+
functionCall?: 'none' | 'auto' | 'required' | {
|
|
116
|
+
type: 'function';
|
|
117
|
+
function: {
|
|
118
|
+
name: string;
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
modelConfig?: Readonly<AxModelConfig>;
|
|
122
|
+
model?: string;
|
|
123
|
+
};
|
|
124
|
+
export type AxEmbedRequest = {
|
|
125
|
+
texts?: readonly string[];
|
|
126
|
+
embedModel?: string;
|
|
127
|
+
};
|
|
128
|
+
export type AxRateLimiterFunction = <T = unknown>(reqFunc: () => Promise<T | ReadableStream<T>>, info: Readonly<{
|
|
129
|
+
modelUsage?: AxTokenUsage;
|
|
130
|
+
embedModelUsage?: AxTokenUsage;
|
|
131
|
+
}>) => Promise<T | ReadableStream<T>>;
|
|
132
|
+
export type AxAIPromptConfig = {
|
|
133
|
+
stream?: boolean;
|
|
134
|
+
};
|
|
135
|
+
export type AxAIServiceOptions = {
|
|
136
|
+
debug?: boolean;
|
|
137
|
+
rateLimiter?: AxRateLimiterFunction;
|
|
138
|
+
fetch?: typeof fetch;
|
|
139
|
+
tracer?: AxTracer;
|
|
140
|
+
};
|
|
141
|
+
export type AxAIServiceActionOptions = {
|
|
142
|
+
sessionId?: string;
|
|
143
|
+
traceId?: string;
|
|
144
|
+
};
|
|
145
|
+
export interface AxAIService {
|
|
146
|
+
getName(): string;
|
|
147
|
+
getModelInfo(): Readonly<AxModelInfo & {
|
|
148
|
+
provider: string;
|
|
149
|
+
}>;
|
|
150
|
+
getEmbedModelInfo(): Readonly<AxModelInfo> | undefined;
|
|
151
|
+
getModelConfig(): Readonly<AxModelConfig>;
|
|
152
|
+
getFeatures(): {
|
|
153
|
+
functions: boolean;
|
|
154
|
+
streaming: boolean;
|
|
155
|
+
};
|
|
156
|
+
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
157
|
+
embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions & AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
|
|
158
|
+
setOptions(options: Readonly<AxAIServiceOptions>): void;
|
|
159
|
+
}
|
package/ai/types.js
ADDED
package/ai/types.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../ai/types.ts"],"names":[],"mappings":""}
|
package/ai/util.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AxChatResponseResult, AxModelInfo } from './types.js';
|
|
2
|
+
export declare const findItemByNameOrAlias: (list: readonly AxModelInfo[], name: string) => AxModelInfo | undefined;
|
|
3
|
+
export declare const uniqBy: <T>(array: readonly T[], uniqueField: (value: T) => unknown) => T[];
|
|
4
|
+
export declare const parseFunction: (value: string) => {
|
|
5
|
+
name: string;
|
|
6
|
+
args?: string;
|
|
7
|
+
} | undefined;
|
|
8
|
+
export interface mergeFunctionsState {
|
|
9
|
+
lastId?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function mergeFunctionCalls(functionCalls: NonNullable<AxChatResponseResult['functionCalls']>, functionCallDeltas: Readonly<NonNullable<AxChatResponseResult['functionCalls']>>): void;
|
|
12
|
+
export declare const hashObject: (obj: object) => string;
|
package/ai/util.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
2
|
+
import { createHash } from 'crypto';
|
|
3
|
+
export const findItemByNameOrAlias = (list, name) => {
|
|
4
|
+
for (const item of list) {
|
|
5
|
+
if (item.name === name || item.aliases?.includes(name)) {
|
|
6
|
+
return item;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
return undefined;
|
|
10
|
+
};
|
|
11
|
+
export const uniqBy = (array, uniqueField) => {
|
|
12
|
+
const uniqueValues = new Map();
|
|
13
|
+
array.forEach((value) => {
|
|
14
|
+
const field = uniqueField(value);
|
|
15
|
+
if (!uniqueValues.has(field)) {
|
|
16
|
+
uniqueValues.set(field, value);
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
return Array.from(uniqueValues.values());
|
|
20
|
+
};
|
|
21
|
+
const functionCallRe = /(\w+)\((.*)\)/s;
|
|
22
|
+
export const parseFunction = (value) => {
|
|
23
|
+
let v;
|
|
24
|
+
// extract function calls
|
|
25
|
+
if ((v = functionCallRe.exec(value)) !== null) {
|
|
26
|
+
const name = v.at(1)?.trim();
|
|
27
|
+
const args = v.at(2)?.trim();
|
|
28
|
+
if (!name || name) {
|
|
29
|
+
throw new Error(`Invalid function format: ${value}`);
|
|
30
|
+
}
|
|
31
|
+
return { name, args };
|
|
32
|
+
}
|
|
33
|
+
return;
|
|
34
|
+
};
|
|
35
|
+
export function mergeFunctionCalls(
|
|
36
|
+
// eslint-disable-next-line functional/prefer-immutable-types
|
|
37
|
+
functionCalls, functionCallDeltas) {
|
|
38
|
+
for (const _fc of functionCallDeltas) {
|
|
39
|
+
const fc = functionCalls.find((fc) => fc.id === _fc.id);
|
|
40
|
+
if (fc) {
|
|
41
|
+
if (typeof _fc.function.name == 'string' &&
|
|
42
|
+
_fc.function.name.length > 0) {
|
|
43
|
+
fc.function.name += _fc.function.name;
|
|
44
|
+
}
|
|
45
|
+
if (typeof _fc.function.params == 'string' &&
|
|
46
|
+
_fc.function.params.length > 0) {
|
|
47
|
+
fc.function.params += _fc.function.params;
|
|
48
|
+
}
|
|
49
|
+
if (typeof _fc.function.params == 'object') {
|
|
50
|
+
fc.function.params = _fc.function.params;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
functionCalls.push(_fc);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
export const hashObject = (obj) => {
|
|
59
|
+
const hash = createHash('sha256');
|
|
60
|
+
hash.update(JSON.stringify(obj));
|
|
61
|
+
return hash.digest('hex');
|
|
62
|
+
};
|
|
63
|
+
//# sourceMappingUR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MAAM,GAAG,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC;YAC3C,CAAC;QACH,CAAC;aAAM,CAAC;YACN,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,EAAE;IACxC,MAAM,IAAI,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IAClC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;IACjC,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC,CAAC"}
|
package/ai/wrap.d.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ReadableStream } from 'stream/web';
|
|
2
|
+
import { type AxAIAnthropicArgs } from './anthropic/api.js';
|
|
3
|
+
import type { AxAIAnthropicModel } from './anthropic/types.js';
|
|
4
|
+
import { type AxAIAzureOpenAIArgs } from './azure-openai/api.js';
|
|
5
|
+
import { type AxAICohereArgs } from './cohere/api.js';
|
|
6
|
+
import type { AxAICohereEmbedModel, AxAICohereModel } from './cohere/types.js';
|
|
7
|
+
import { type AxAIDeepSeekArgs } from './deepseek/api.js';
|
|
8
|
+
import type { AxAIDeepSeekModel } from './deepseek/types.js';
|
|
9
|
+
import { type AxAIGoogleGeminiArgs } from './google-gemini/api.js';
|
|
10
|
+
import type { AxAIGoogleGeminiEmbedModel, AxAIGoogleGeminiModel } from './google-gemini/types.js';
|
|
11
|
+
import { type AxAIGroqArgs } from './groq/api.js';
|
|
12
|
+
import type { AxAIGroqModel } from './groq/types.js';
|
|
13
|
+
import { type AxAIHuggingFaceArgs } from './huggingface/api.js';
|
|
14
|
+
import type { AxAIHuggingFaceModel } from './huggingface/types.js';
|
|
15
|
+
import { type AxAIMistralArgs } from './mistral/api.js';
|
|
16
|
+
import type { AxAIMistralModel } from './mistral/types.js';
|
|
17
|
+
import { type AxAIOllamaArgs } from './ollama/api.js';
|
|
18
|
+
import { type AxAIOpenAIArgs as AxAIOpenAIArgs } from './openai/api.js';
|
|
19
|
+
import type { AxAIOpenAIEmbedModel, AxAIOpenAIModel } from './openai/types.js';
|
|
20
|
+
import { type AxAITogetherArgs } from './together/api.js';
|
|
21
|
+
import type { AxAIPromptConfig, AxAIService, AxAIServiceActionOptions, AxAIServiceOptions, AxChatRequest, AxChatResponse, AxEmbedRequest, AxEmbedResponse, AxModelConfig, AxModelInfo } from './types.js';
|
|
22
|
+
export type AxAIModelMap<T> = Record<string, T>;
|
|
23
|
+
export interface AxAIOptions<TM = string, TEM = string> {
|
|
24
|
+
modelMap?: AxAIModelMap<TM>;
|
|
25
|
+
embedModelMap?: AxAIModelMap<TEM>;
|
|
26
|
+
}
|
|
27
|
+
export type AxAIArgs = (AxAIOpenAIArgs & AxAIOptions<AxAIOpenAIModel, AxAIOpenAIEmbedModel>) | (AxAIAzureOpenAIArgs & AxAIOptions<AxAIOpenAIModel, AxAIOpenAIEmbedModel>) | (AxAITogetherArgs & AxAIOptions<string, string>) | (AxAIAnthropicArgs & AxAIOptions<AxAIAnthropicModel, AxAIAnthropicModel>) | (AxAIGroqArgs & AxAIOptions<AxAIGroqModel, AxAIGroqModel>) | (AxAIGoogleGeminiArgs & AxAIOptions<AxAIGoogleGeminiModel, AxAIGoogleGeminiEmbedModel>) | (AxAICohereArgs & AxAIOptions<AxAICohereModel, AxAICohereEmbedModel>) | (AxAIHuggingFaceArgs & AxAIOptions<AxAIHuggingFaceModel, AxAIHuggingFaceModel>) | (AxAIMistralArgs & AxAIOptions<AxAIMistralModel, AxAIMistralModel>) | (AxAIDeepSeekArgs & AxAIOptions<AxAIDeepSeekModel, AxAIDeepSeekModel>) | (AxAIOllamaArgs & AxAIOptions<string, string>);
|
|
28
|
+
export type AxAIModels = AxAIOpenAIModel | AxAIAnthropicModel | AxAIGroqModel | AxAIGoogleGeminiModel | AxAICohereModel | AxAIHuggingFaceModel | AxAIMistralModel | AxAIDeepSeekModel | string;
|
|
29
|
+
export type AxAIEmbedModels = AxAIOpenAIEmbedModel | AxAIGoogleGeminiEmbedModel | AxAICohereEmbedModel | string;
|
|
30
|
+
export declare class AxAI implements AxAIService {
|
|
31
|
+
private ai;
|
|
32
|
+
private options;
|
|
33
|
+
constructor(options: Readonly<AxAIArgs>);
|
|
34
|
+
getName(): string;
|
|
35
|
+
getModelInfo(): Readonly<AxModelInfo & {
|
|
36
|
+
provider: string;
|
|
37
|
+
}>;
|
|
38
|
+
getEmbedModelInfo(): Readonly<AxModelInfo> | undefined;
|
|
39
|
+
getModelConfig(): Readonly<AxModelConfig>;
|
|
40
|
+
getFeatures(): {
|
|
41
|
+
functions: boolean;
|
|
42
|
+
streaming: boolean;
|
|
43
|
+
};
|
|
44
|
+
chat(req: Readonly<AxChatRequest>, options?: Readonly<AxAIPromptConfig & AxAIServiceActionOptions>): Promise<AxChatResponse | ReadableStream<AxChatResponse>>;
|
|
45
|
+
embed(req: Readonly<AxEmbedRequest>, options?: Readonly<AxAIServiceActionOptions & AxAIServiceActionOptions>): Promise<AxEmbedResponse>;
|
|
46
|
+
setOptions(options: Readonly<AxAIServiceOptions>): void;
|
|
47
|
+
}
|
package/ai/wrap.js
ADDED
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { AxAIAnthropic } from './anthropic/api.js';
|
|
2
|
+
import { AxAIAzureOpenAI } from './azure-openai/api.js';
|
|
3
|
+
import { AxAICohere } from './cohere/api.js';
|
|
4
|
+
import { AxAIDeepSeek } from './deepseek/api.js';
|
|
5
|
+
import { AxAIGoogleGemini } from './google-gemini/api.js';
|
|
6
|
+
import { AxAIGroq } from './groq/api.js';
|
|
7
|
+
import { AxAIHuggingFace } from './huggingface/api.js';
|
|
8
|
+
import { AxAIMistral } from './mistral/api.js';
|
|
9
|
+
import { AxAIOllama } from './ollama/api.js';
|
|
10
|
+
import { AxAIOpenAI } from './openai/api.js';
|
|
11
|
+
import { AxAITogether } from './together/api.js';
|
|
12
|
+
export class AxAI {
|
|
13
|
+
ai;
|
|
14
|
+
options;
|
|
15
|
+
constructor(options) {
|
|
16
|
+
const { modelMap, embedModelMap, ...args } = options;
|
|
17
|
+
this.options = { modelMap, embedModelMap };
|
|
18
|
+
switch (args.name) {
|
|
19
|
+
case 'openai':
|
|
20
|
+
this.ai = new AxAIOpenAI(args);
|
|
21
|
+
break;
|
|
22
|
+
case 'azure-openai':
|
|
23
|
+
this.ai = new AxAIAzureOpenAI(args);
|
|
24
|
+
break;
|
|
25
|
+
case 'huggingface':
|
|
26
|
+
this.ai = new AxAIHuggingFace(args);
|
|
27
|
+
break;
|
|
28
|
+
case 'groq':
|
|
29
|
+
this.ai = new AxAIGroq(args);
|
|
30
|
+
break;
|
|
31
|
+
case 'together':
|
|
32
|
+
this.ai = new AxAITogether(args);
|
|
33
|
+
break;
|
|
34
|
+
case 'cohere':
|
|
35
|
+
this.ai = new AxAICohere(args);
|
|
36
|
+
break;
|
|
37
|
+
case 'google-gemini':
|
|
38
|
+
this.ai = new AxAIGoogleGemini(args);
|
|
39
|
+
break;
|
|
40
|
+
case 'anthropic':
|
|
41
|
+
this.ai = new AxAIAnthropic(args);
|
|
42
|
+
break;
|
|
43
|
+
case 'mistral':
|
|
44
|
+
this.ai = new AxAIMistral(args);
|
|
45
|
+
break;
|
|
46
|
+
case 'deepseek':
|
|
47
|
+
this.ai = new AxAIDeepSeek(args);
|
|
48
|
+
break;
|
|
49
|
+
case 'ollama':
|
|
50
|
+
this.ai = new AxAIOllama(args);
|
|
51
|
+
break;
|
|
52
|
+
default:
|
|
53
|
+
throw new Error(`Unknown AI`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
getName() {
|
|
57
|
+
return this.ai.getName();
|
|
58
|
+
}
|
|
59
|
+
getModelInfo() {
|
|
60
|
+
return this.ai.getModelInfo();
|
|
61
|
+
}
|
|
62
|
+
getEmbedModelInfo() {
|
|
63
|
+
return this.ai.getEmbedModelInfo();
|
|
64
|
+
}
|
|
65
|
+
getModelConfig() {
|
|
66
|
+
return this.ai.getModelConfig();
|
|
67
|
+
}
|
|
68
|
+
getFeatures() {
|
|
69
|
+
return this.ai.getFeatures();
|
|
70
|
+
}
|
|
71
|
+
async chat(req, options) {
|
|
72
|
+
if (this.options?.modelMap && req.model) {
|
|
73
|
+
const model = this.options.modelMap[req.model];
|
|
74
|
+
if (!model || model.length === 0) {
|
|
75
|
+
throw new Error(`Model not found in model map: ${req.model}`);
|
|
76
|
+
}
|
|
77
|
+
return await this.ai.chat({ ...req, model }, options);
|
|
78
|
+
}
|
|
79
|
+
return await this.ai.chat(req, options);
|
|
80
|
+
}
|
|
81
|
+
async embed(req, options) {
|
|
82
|
+
if (this.options?.embedModelMap && req.embedModel) {
|
|
83
|
+
const embedModel = this.options.embedModelMap[req.embedModel];
|
|
84
|
+
if (!embedModel || embedModel.length === 0) {
|
|
85
|
+
throw new Error(`Model not found in embed model map: ${req.embedModel}`);
|
|
86
|
+
}
|
|
87
|
+
return await this.ai.embed({ ...req, embedModel }, options);
|
|
88
|
+
}
|
|
89
|
+
return await this.ai.embed(req, options);
|
|
90
|
+
}
|
|
91
|
+
setOptions(options) {
|
|
92
|
+
this.ai.setOptions(options);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=wrap.js.map
|
package/ai/wrap.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wrap.js","sourceRoot":"","sources":["../../ai/wrap.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAA0B,MAAM,oBAAoB,CAAC;AAE3E,OAAO,EACL,eAAe,EAEhB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,UAAU,EAAuB,MAAM,iBAAiB,CAAC;AAElE,OAAO,EAAE,YAAY,EAAyB,MAAM,mBAAmB,CAAC;AAExE,OAAO,EACL,gBAAgB,EAEjB,MAAM,wBAAwB,CAAC;AAKh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,KAAK,EAAE,CAAC,CAAC;YAChE,CAAC;YACD,OAAO,MAAM,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,EAAE,KAAK,EAAE,EAAE,OAAO,CAAC,CAAC;QACxD,CAAC;QACD,OAAO,MAAM,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IAED,KAAK,CAAC,KAAK,CACT,GAA6B,EAC7B,OAAuE;QAEvE,IAAI,IAAI,CAAC,OAAO,EAAE,aAAa,IAAI,GAAG,CAAC,UAAU,EAAE,CAAC;YAClD,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;YAC9D,IAAI,CAAC,UAAU,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC3C,MAAM,IAAI,KAAK,CACb,uCAAuC,GAAG,CAAC,UAAU,EAAE,CACxD,CAAC;YACJ,CAAC;YACD,OAAO,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,GAAG,GAAG,EAAE,UAAU,EAAE,EAAE,OAAO,CAAC,CAAC;QAC9D,CAAC;QACD,OAAO,MAAM,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC3C,CAAC;IAED,UAAU,CAAC,OAAqC;QAC9C,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;CACF"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { API } from '../../util/apicall.js';
|
|
2
|
+
import { AxBaseAI } from '../base.js';
|
|
3
|
+
import type { AxAIServiceOptions, AxChatRequest, AxChatResponse, AxModelConfig } from '../types.js';
|
|
4
|
+
import { type AxAIAnthropicChatError, type AxAIAnthropicChatRequest, type AxAIAnthropicChatResponse, type AxAIAnthropicChatResponseDelta, type AxAIAnthropicConfig } from './types.js';
|
|
5
|
+
export declare const axAIAnthropicDefaultConfig: () => AxAIAnthropicConfig;
|
|
6
|
+
export interface AxAIAnthropicArgs {
|
|
7
|
+
name: 'anthropic';
|
|
8
|
+
apiKey: string;
|
|
9
|
+
config?: Readonly<AxAIAnthropicConfig>;
|
|
10
|
+
options?: Readonly<AxAIServiceOptions>;
|
|
11
|
+
}
|
|
12
|
+
export declare class AxAIAnthropic extends AxBaseAI<AxAIAnthropicChatRequest, unknown, AxAIAnthropicChatResponse, AxAIAnthropicChatResponseDelta, unknown> {
|
|
13
|
+
private config;
|
|
14
|
+
constructor({ apiKey, config, options }: Readonly<Omit<AxAIAnthropicArgs, 'name'>>);
|
|
15
|
+
getModelConfig(): AxModelConfig;
|
|
16
|
+
generateChatReq: (req: Readonly<AxChatRequest>) => [API, AxAIAnthropicChatRequest];
|
|
17
|
+
generateChatResp: (resp: Readonly<AxAIAnthropicChatResponse | AxAIAnthropicChatError>) => AxChatResponse;
|
|
18
|
+
generateChatStreamResp: (resp: Readonly<AxAIAnthropicChatResponseDelta>, state: object) => AxChatResponse;
|
|
19
|
+
}
|