overai 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +248 -0
- package/dist/agent/context.d.ts +74 -0
- package/dist/agent/context.js +140 -0
- package/dist/agent/enhanced.d.ts +98 -0
- package/dist/agent/enhanced.js +293 -0
- package/dist/agent/handoff.d.ts +82 -0
- package/dist/agent/handoff.js +124 -0
- package/dist/agent/image.d.ts +57 -0
- package/dist/agent/image.js +116 -0
- package/dist/agent/index.d.ts +19 -0
- package/dist/agent/index.js +38 -0
- package/dist/agent/prompt-expander.d.ts +43 -0
- package/dist/agent/prompt-expander.js +99 -0
- package/dist/agent/proxy.d.ts +26 -0
- package/dist/agent/proxy.js +173 -0
- package/dist/agent/query-rewriter.d.ts +41 -0
- package/dist/agent/query-rewriter.js +94 -0
- package/dist/agent/research.d.ts +55 -0
- package/dist/agent/research.js +134 -0
- package/dist/agent/router.d.ts +141 -0
- package/dist/agent/router.js +209 -0
- package/dist/agent/simple.d.ts +289 -0
- package/dist/agent/simple.js +696 -0
- package/dist/agent/types.d.ts +56 -0
- package/dist/agent/types.js +165 -0
- package/dist/ai/agent-loop.d.ts +177 -0
- package/dist/ai/agent-loop.js +313 -0
- package/dist/ai/devtools.d.ts +74 -0
- package/dist/ai/devtools.js +216 -0
- package/dist/ai/embed.d.ts +71 -0
- package/dist/ai/embed.js +154 -0
- package/dist/ai/generate-image.d.ts +66 -0
- package/dist/ai/generate-image.js +138 -0
- package/dist/ai/generate-object.d.ts +132 -0
- package/dist/ai/generate-object.js +206 -0
- package/dist/ai/generate-text.d.ts +201 -0
- package/dist/ai/generate-text.js +253 -0
- package/dist/ai/index.d.ts +27 -0
- package/dist/ai/index.js +140 -0
- package/dist/ai/mcp.d.ts +181 -0
- package/dist/ai/mcp.js +234 -0
- package/dist/ai/middleware.d.ts +110 -0
- package/dist/ai/middleware.js +186 -0
- package/dist/ai/models.d.ts +67 -0
- package/dist/ai/models.js +249 -0
- package/dist/ai/multimodal.d.ts +125 -0
- package/dist/ai/multimodal.js +270 -0
- package/dist/ai/nextjs.d.ts +122 -0
- package/dist/ai/nextjs.js +218 -0
- package/dist/ai/server.d.ts +126 -0
- package/dist/ai/server.js +336 -0
- package/dist/ai/speech.d.ts +135 -0
- package/dist/ai/speech.js +296 -0
- package/dist/ai/telemetry.d.ts +162 -0
- package/dist/ai/telemetry.js +311 -0
- package/dist/ai/tool-approval.d.ts +225 -0
- package/dist/ai/tool-approval.js +407 -0
- package/dist/ai/tools.d.ts +93 -0
- package/dist/ai/tools.js +89 -0
- package/dist/ai/types.d.ts +47 -0
- package/dist/ai/types.js +5 -0
- package/dist/ai/ui-message.d.ts +218 -0
- package/dist/ai/ui-message.js +291 -0
- package/dist/auto/index.d.ts +62 -0
- package/dist/auto/index.js +163 -0
- package/dist/cache/index.d.ts +78 -0
- package/dist/cache/index.js +235 -0
- package/dist/cli/commands/agent.d.ts +30 -0
- package/dist/cli/commands/agent.js +151 -0
- package/dist/cli/commands/agents.d.ts +24 -0
- package/dist/cli/commands/agents.js +166 -0
- package/dist/cli/commands/approval.d.ts +10 -0
- package/dist/cli/commands/approval.js +253 -0
- package/dist/cli/commands/auto.d.ts +12 -0
- package/dist/cli/commands/auto.js +109 -0
- package/dist/cli/commands/autonomy.d.ts +5 -0
- package/dist/cli/commands/autonomy.js +152 -0
- package/dist/cli/commands/benchmark.d.ts +19 -0
- package/dist/cli/commands/benchmark.js +484 -0
- package/dist/cli/commands/cache.d.ts +9 -0
- package/dist/cli/commands/cache.js +143 -0
- package/dist/cli/commands/chat.d.ts +14 -0
- package/dist/cli/commands/chat.js +127 -0
- package/dist/cli/commands/checkpoints.d.ts +5 -0
- package/dist/cli/commands/checkpoints.js +236 -0
- package/dist/cli/commands/context.d.ts +11 -0
- package/dist/cli/commands/context.js +182 -0
- package/dist/cli/commands/cost.d.ts +5 -0
- package/dist/cli/commands/cost.js +146 -0
- package/dist/cli/commands/db.d.ts +9 -0
- package/dist/cli/commands/db.js +149 -0
- package/dist/cli/commands/embed.d.ts +20 -0
- package/dist/cli/commands/embed.js +375 -0
- package/dist/cli/commands/eval.d.ts +17 -0
- package/dist/cli/commands/eval.js +247 -0
- package/dist/cli/commands/external-agents.d.ts +5 -0
- package/dist/cli/commands/external-agents.js +170 -0
- package/dist/cli/commands/fast-context.d.ts +5 -0
- package/dist/cli/commands/fast-context.js +126 -0
- package/dist/cli/commands/flow.d.ts +5 -0
- package/dist/cli/commands/flow.js +141 -0
- package/dist/cli/commands/git.d.ts +5 -0
- package/dist/cli/commands/git.js +178 -0
- package/dist/cli/commands/graph-rag.d.ts +9 -0
- package/dist/cli/commands/graph-rag.js +131 -0
- package/dist/cli/commands/guardrail.d.ts +11 -0
- package/dist/cli/commands/guardrail.js +156 -0
- package/dist/cli/commands/handoff.d.ts +9 -0
- package/dist/cli/commands/handoff.js +133 -0
- package/dist/cli/commands/help.d.ts +8 -0
- package/dist/cli/commands/help.js +139 -0
- package/dist/cli/commands/image.d.ts +13 -0
- package/dist/cli/commands/image.js +192 -0
- package/dist/cli/commands/interactive.d.ts +6 -0
- package/dist/cli/commands/interactive.js +79 -0
- package/dist/cli/commands/jobs.d.ts +5 -0
- package/dist/cli/commands/jobs.js +282 -0
- package/dist/cli/commands/knowledge.d.ts +9 -0
- package/dist/cli/commands/knowledge.js +226 -0
- package/dist/cli/commands/llm.d.ts +21 -0
- package/dist/cli/commands/llm.js +748 -0
- package/dist/cli/commands/mcp.d.ts +9 -0
- package/dist/cli/commands/mcp.js +243 -0
- package/dist/cli/commands/memory.d.ts +10 -0
- package/dist/cli/commands/memory.js +198 -0
- package/dist/cli/commands/n8n.d.ts +5 -0
- package/dist/cli/commands/n8n.js +137 -0
- package/dist/cli/commands/observability.d.ts +16 -0
- package/dist/cli/commands/observability.js +335 -0
- package/dist/cli/commands/planning.d.ts +9 -0
- package/dist/cli/commands/planning.js +167 -0
- package/dist/cli/commands/prompt-expand.d.ts +11 -0
- package/dist/cli/commands/prompt-expand.js +100 -0
- package/dist/cli/commands/providers.d.ts +17 -0
- package/dist/cli/commands/providers.js +386 -0
- package/dist/cli/commands/query-rewrite.d.ts +12 -0
- package/dist/cli/commands/query-rewrite.js +102 -0
- package/dist/cli/commands/repo-map.d.ts +5 -0
- package/dist/cli/commands/repo-map.js +151 -0
- package/dist/cli/commands/reranker.d.ts +10 -0
- package/dist/cli/commands/reranker.js +144 -0
- package/dist/cli/commands/research.d.ts +12 -0
- package/dist/cli/commands/research.js +108 -0
- package/dist/cli/commands/router.d.ts +11 -0
- package/dist/cli/commands/router.js +142 -0
- package/dist/cli/commands/run.d.ts +14 -0
- package/dist/cli/commands/run.js +111 -0
- package/dist/cli/commands/sandbox.d.ts +5 -0
- package/dist/cli/commands/sandbox.js +135 -0
- package/dist/cli/commands/scheduler.d.ts +5 -0
- package/dist/cli/commands/scheduler.js +260 -0
- package/dist/cli/commands/session.d.ts +9 -0
- package/dist/cli/commands/session.js +238 -0
- package/dist/cli/commands/skills.d.ts +9 -0
- package/dist/cli/commands/skills.js +256 -0
- package/dist/cli/commands/telemetry.d.ts +9 -0
- package/dist/cli/commands/telemetry.js +146 -0
- package/dist/cli/commands/tools.d.ts +19 -0
- package/dist/cli/commands/tools.js +576 -0
- package/dist/cli/commands/vector.d.ts +10 -0
- package/dist/cli/commands/vector.js +171 -0
- package/dist/cli/commands/version.d.ts +8 -0
- package/dist/cli/commands/version.js +40 -0
- package/dist/cli/commands/voice.d.ts +10 -0
- package/dist/cli/commands/voice.js +162 -0
- package/dist/cli/commands/workflow.d.ts +13 -0
- package/dist/cli/commands/workflow.js +184 -0
- package/dist/cli/config/index.d.ts +6 -0
- package/dist/cli/config/index.js +22 -0
- package/dist/cli/config/load.d.ts +20 -0
- package/dist/cli/config/load.js +229 -0
- package/dist/cli/config/resolve.d.ts +28 -0
- package/dist/cli/config/resolve.js +70 -0
- package/dist/cli/config/schema.d.ts +15 -0
- package/dist/cli/config/schema.js +65 -0
- package/dist/cli/features/autonomy-mode.d.ts +98 -0
- package/dist/cli/features/autonomy-mode.js +266 -0
- package/dist/cli/features/background-jobs.d.ts +155 -0
- package/dist/cli/features/background-jobs.js +416 -0
- package/dist/cli/features/checkpoints.d.ts +126 -0
- package/dist/cli/features/checkpoints.js +288 -0
- package/dist/cli/features/cost-tracker.d.ts +101 -0
- package/dist/cli/features/cost-tracker.js +212 -0
- package/dist/cli/features/external-agents.d.ts +117 -0
- package/dist/cli/features/external-agents.js +296 -0
- package/dist/cli/features/fast-context.d.ts +126 -0
- package/dist/cli/features/fast-context.js +310 -0
- package/dist/cli/features/flow-display.d.ts +100 -0
- package/dist/cli/features/flow-display.js +254 -0
- package/dist/cli/features/git-integration.d.ts +138 -0
- package/dist/cli/features/git-integration.js +374 -0
- package/dist/cli/features/index.d.ts +17 -0
- package/dist/cli/features/index.js +102 -0
- package/dist/cli/features/interactive-tui.d.ts +114 -0
- package/dist/cli/features/interactive-tui.js +326 -0
- package/dist/cli/features/n8n-integration.d.ts +111 -0
- package/dist/cli/features/n8n-integration.js +299 -0
- package/dist/cli/features/repo-map.d.ts +101 -0
- package/dist/cli/features/repo-map.js +350 -0
- package/dist/cli/features/sandbox-executor.d.ts +89 -0
- package/dist/cli/features/sandbox-executor.js +314 -0
- package/dist/cli/features/scheduler.d.ts +111 -0
- package/dist/cli/features/scheduler.js +298 -0
- package/dist/cli/features/slash-commands.d.ts +77 -0
- package/dist/cli/features/slash-commands.js +316 -0
- package/dist/cli/index.d.ts +24 -0
- package/dist/cli/index.js +214 -0
- package/dist/cli/output/errors.d.ts +23 -0
- package/dist/cli/output/errors.js +36 -0
- package/dist/cli/output/json.d.ts +27 -0
- package/dist/cli/output/json.js +31 -0
- package/dist/cli/output/pretty.d.ts +13 -0
- package/dist/cli/output/pretty.js +31 -0
- package/dist/cli/runtime/env.d.ts +12 -0
- package/dist/cli/runtime/env.js +55 -0
- package/dist/cli/runtime/exit.d.ts +11 -0
- package/dist/cli/runtime/exit.js +49 -0
- package/dist/cli/runtime/index.d.ts +6 -0
- package/dist/cli/runtime/index.js +22 -0
- package/dist/cli/runtime/lazy.d.ts +18 -0
- package/dist/cli/runtime/lazy.js +85 -0
- package/dist/cli/spec/cli-spec.d.ts +87 -0
- package/dist/cli/spec/cli-spec.js +551 -0
- package/dist/cli/spec/index.d.ts +4 -0
- package/dist/cli/spec/index.js +20 -0
- package/dist/db/index.d.ts +6 -0
- package/dist/db/index.js +75 -0
- package/dist/db/types.d.ts +42 -0
- package/dist/db/types.js +2 -0
- package/dist/eval/index.d.ts +61 -0
- package/dist/eval/index.js +157 -0
- package/dist/events/index.d.ts +84 -0
- package/dist/events/index.js +153 -0
- package/dist/guardrails/index.d.ts +82 -0
- package/dist/guardrails/index.js +202 -0
- package/dist/guardrails/llm-guardrail.d.ts +46 -0
- package/dist/guardrails/llm-guardrail.js +112 -0
- package/dist/index.d.ts +92 -0
- package/dist/index.js +608 -0
- package/dist/integrations/computer-use.d.ts +182 -0
- package/dist/integrations/computer-use.js +356 -0
- package/dist/integrations/index.d.ts +7 -0
- package/dist/integrations/index.js +26 -0
- package/dist/integrations/observability/base.d.ts +123 -0
- package/dist/integrations/observability/base.js +183 -0
- package/dist/integrations/observability/index.d.ts +8 -0
- package/dist/integrations/observability/index.js +29 -0
- package/dist/integrations/observability/langfuse.d.ts +32 -0
- package/dist/integrations/observability/langfuse.js +174 -0
- package/dist/integrations/postgres.d.ts +162 -0
- package/dist/integrations/postgres.js +396 -0
- package/dist/integrations/slack.d.ts +145 -0
- package/dist/integrations/slack.js +270 -0
- package/dist/integrations/vector/base.d.ts +110 -0
- package/dist/integrations/vector/base.js +158 -0
- package/dist/integrations/vector/chroma.d.ts +25 -0
- package/dist/integrations/vector/chroma.js +143 -0
- package/dist/integrations/vector/index.d.ts +14 -0
- package/dist/integrations/vector/index.js +37 -0
- package/dist/integrations/vector/pinecone.d.ts +28 -0
- package/dist/integrations/vector/pinecone.js +172 -0
- package/dist/integrations/vector/qdrant.d.ts +25 -0
- package/dist/integrations/vector/qdrant.js +146 -0
- package/dist/integrations/vector/weaviate.d.ts +30 -0
- package/dist/integrations/vector/weaviate.js +206 -0
- package/dist/integrations/voice/base.d.ts +76 -0
- package/dist/integrations/voice/base.js +168 -0
- package/dist/integrations/voice/index.d.ts +6 -0
- package/dist/integrations/voice/index.js +26 -0
- package/dist/knowledge/chunking.d.ts +55 -0
- package/dist/knowledge/chunking.js +158 -0
- package/dist/knowledge/graph-rag.d.ts +125 -0
- package/dist/knowledge/graph-rag.js +289 -0
- package/dist/knowledge/index.d.ts +24 -0
- package/dist/knowledge/index.js +47 -0
- package/dist/knowledge/knowledge.d.ts +0 -0
- package/dist/knowledge/knowledge.js +1 -0
- package/dist/knowledge/rag.d.ts +80 -0
- package/dist/knowledge/rag.js +147 -0
- package/dist/knowledge/reranker.d.ts +86 -0
- package/dist/knowledge/reranker.js +196 -0
- package/dist/llm/backend-resolver.d.ts +77 -0
- package/dist/llm/backend-resolver.js +242 -0
- package/dist/llm/embeddings.d.ts +66 -0
- package/dist/llm/embeddings.js +294 -0
- package/dist/llm/index.d.ts +29 -0
- package/dist/llm/index.js +33 -0
- package/dist/llm/llm.d.ts +0 -0
- package/dist/llm/llm.js +1 -0
- package/dist/llm/openai.d.ts +39 -0
- package/dist/llm/openai.js +302 -0
- package/dist/llm/providers/ai-sdk/adapter.d.ts +121 -0
- package/dist/llm/providers/ai-sdk/adapter.js +399 -0
- package/dist/llm/providers/ai-sdk/backend.d.ts +49 -0
- package/dist/llm/providers/ai-sdk/backend.js +421 -0
- package/dist/llm/providers/ai-sdk/index.d.ts +69 -0
- package/dist/llm/providers/ai-sdk/index.js +200 -0
- package/dist/llm/providers/ai-sdk/middleware.d.ts +60 -0
- package/dist/llm/providers/ai-sdk/middleware.js +262 -0
- package/dist/llm/providers/ai-sdk/provider-map.d.ts +75 -0
- package/dist/llm/providers/ai-sdk/provider-map.js +258 -0
- package/dist/llm/providers/ai-sdk/types.d.ts +217 -0
- package/dist/llm/providers/ai-sdk/types.js +222 -0
- package/dist/llm/providers/anthropic.d.ts +33 -0
- package/dist/llm/providers/anthropic.js +291 -0
- package/dist/llm/providers/base.d.ts +25 -0
- package/dist/llm/providers/base.js +43 -0
- package/dist/llm/providers/google.d.ts +27 -0
- package/dist/llm/providers/google.js +275 -0
- package/dist/llm/providers/index.d.ts +107 -0
- package/dist/llm/providers/index.js +216 -0
- package/dist/llm/providers/openai.d.ts +18 -0
- package/dist/llm/providers/openai.js +203 -0
- package/dist/llm/providers/registry.d.ts +159 -0
- package/dist/llm/providers/registry.js +279 -0
- package/dist/llm/providers/types.d.ts +94 -0
- package/dist/llm/providers/types.js +5 -0
- package/dist/main.d.ts +0 -0
- package/dist/main.js +1 -0
- package/dist/memory/auto-memory.d.ts +136 -0
- package/dist/memory/auto-memory.js +301 -0
- package/dist/memory/file-memory.d.ts +88 -0
- package/dist/memory/file-memory.js +287 -0
- package/dist/memory/index.d.ts +26 -0
- package/dist/memory/index.js +41 -0
- package/dist/memory/memory.d.ts +92 -0
- package/dist/memory/memory.js +170 -0
- package/dist/observability/adapters/console.d.ts +33 -0
- package/dist/observability/adapters/console.js +71 -0
- package/dist/observability/adapters/external/arize.d.ts +20 -0
- package/dist/observability/adapters/external/arize.js +22 -0
- package/dist/observability/adapters/external/axiom.d.ts +20 -0
- package/dist/observability/adapters/external/axiom.js +22 -0
- package/dist/observability/adapters/external/braintrust.d.ts +20 -0
- package/dist/observability/adapters/external/braintrust.js +22 -0
- package/dist/observability/adapters/external/helicone.d.ts +20 -0
- package/dist/observability/adapters/external/helicone.js +22 -0
- package/dist/observability/adapters/external/laminar.d.ts +20 -0
- package/dist/observability/adapters/external/laminar.js +22 -0
- package/dist/observability/adapters/external/langfuse.d.ts +28 -0
- package/dist/observability/adapters/external/langfuse.js +186 -0
- package/dist/observability/adapters/external/langsmith.d.ts +21 -0
- package/dist/observability/adapters/external/langsmith.js +83 -0
- package/dist/observability/adapters/external/langwatch.d.ts +20 -0
- package/dist/observability/adapters/external/langwatch.js +22 -0
- package/dist/observability/adapters/external/maxim.d.ts +20 -0
- package/dist/observability/adapters/external/maxim.js +22 -0
- package/dist/observability/adapters/external/patronus.d.ts +20 -0
- package/dist/observability/adapters/external/patronus.js +22 -0
- package/dist/observability/adapters/external/scorecard.d.ts +20 -0
- package/dist/observability/adapters/external/scorecard.js +22 -0
- package/dist/observability/adapters/external/signoz.d.ts +20 -0
- package/dist/observability/adapters/external/signoz.js +22 -0
- package/dist/observability/adapters/external/traceloop.d.ts +20 -0
- package/dist/observability/adapters/external/traceloop.js +22 -0
- package/dist/observability/adapters/external/weave.d.ts +20 -0
- package/dist/observability/adapters/external/weave.js +22 -0
- package/dist/observability/adapters/index.d.ts +19 -0
- package/dist/observability/adapters/index.js +289 -0
- package/dist/observability/adapters/memory.d.ts +41 -0
- package/dist/observability/adapters/memory.js +190 -0
- package/dist/observability/adapters/noop.d.ts +25 -0
- package/dist/observability/adapters/noop.js +64 -0
- package/dist/observability/index.d.ts +47 -0
- package/dist/observability/index.js +115 -0
- package/dist/observability/types.d.ts +165 -0
- package/dist/observability/types.js +165 -0
- package/dist/planning/index.d.ts +253 -0
- package/dist/planning/index.js +475 -0
- package/dist/process/index.d.ts +25 -0
- package/dist/process/index.js +37 -0
- package/dist/process/process.d.ts +0 -0
- package/dist/process/process.js +1 -0
- package/dist/session/index.d.ts +111 -0
- package/dist/session/index.js +250 -0
- package/dist/skills/index.d.ts +70 -0
- package/dist/skills/index.js +233 -0
- package/dist/task/index.d.ts +25 -0
- package/dist/task/index.js +32 -0
- package/dist/task/task.d.ts +0 -0
- package/dist/task/task.js +1 -0
- package/dist/telemetry/index.d.ts +175 -0
- package/dist/telemetry/index.js +287 -0
- package/dist/tools/arxivTools.d.ts +32 -0
- package/dist/tools/arxivTools.js +81 -0
- package/dist/tools/base.d.ts +97 -0
- package/dist/tools/base.js +147 -0
- package/dist/tools/builtins/airweave.d.ts +32 -0
- package/dist/tools/builtins/airweave.js +119 -0
- package/dist/tools/builtins/bedrock-agentcore.d.ts +62 -0
- package/dist/tools/builtins/bedrock-agentcore.js +233 -0
- package/dist/tools/builtins/code-execution.d.ts +36 -0
- package/dist/tools/builtins/code-execution.js +136 -0
- package/dist/tools/builtins/code-mode.d.ts +54 -0
- package/dist/tools/builtins/code-mode.js +167 -0
- package/dist/tools/builtins/custom.d.ts +42 -0
- package/dist/tools/builtins/custom.js +195 -0
- package/dist/tools/builtins/exa.d.ts +53 -0
- package/dist/tools/builtins/exa.js +112 -0
- package/dist/tools/builtins/firecrawl.d.ts +56 -0
- package/dist/tools/builtins/firecrawl.js +158 -0
- package/dist/tools/builtins/index.d.ts +45 -0
- package/dist/tools/builtins/index.js +180 -0
- package/dist/tools/builtins/parallel.d.ts +30 -0
- package/dist/tools/builtins/parallel.js +113 -0
- package/dist/tools/builtins/perplexity.d.ts +32 -0
- package/dist/tools/builtins/perplexity.js +113 -0
- package/dist/tools/builtins/superagent.d.ts +66 -0
- package/dist/tools/builtins/superagent.js +187 -0
- package/dist/tools/builtins/tavily.d.ts +99 -0
- package/dist/tools/builtins/tavily.js +285 -0
- package/dist/tools/builtins/valyu.d.ts +65 -0
- package/dist/tools/builtins/valyu.js +193 -0
- package/dist/tools/decorator.d.ts +91 -0
- package/dist/tools/decorator.js +165 -0
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.js +36 -0
- package/dist/tools/mcpSse.d.ts +43 -0
- package/dist/tools/mcpSse.js +110 -0
- package/dist/tools/registry/index.d.ts +9 -0
- package/dist/tools/registry/index.js +28 -0
- package/dist/tools/registry/middleware.d.ts +43 -0
- package/dist/tools/registry/middleware.js +220 -0
- package/dist/tools/registry/registry.d.ts +92 -0
- package/dist/tools/registry/registry.js +280 -0
- package/dist/tools/registry/types.d.ts +217 -0
- package/dist/tools/registry/types.js +49 -0
- package/dist/tools/test.d.ts +0 -0
- package/dist/tools/test.js +1 -0
- package/dist/tools/tools.d.ts +74 -0
- package/dist/tools/tools.js +133 -0
- package/dist/utils/logger.d.ts +25 -0
- package/dist/utils/logger.js +149 -0
- package/dist/utils/pretty-logger.d.ts +21 -0
- package/dist/utils/pretty-logger.js +248 -0
- package/dist/workflows/index.d.ts +118 -0
- package/dist/workflows/index.js +247 -0
- package/dist/workflows/loop.d.ts +0 -0
- package/dist/workflows/loop.js +1 -0
- package/dist/workflows/yaml-parser.d.ts +48 -0
- package/dist/workflows/yaml-parser.js +304 -0
- package/package.json +119 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vector Store Integrations
|
|
3
|
+
* Provides adapters for various vector databases
|
|
4
|
+
*/
|
|
5
|
+
export * from './base';
|
|
6
|
+
export * from './pinecone';
|
|
7
|
+
export * from './weaviate';
|
|
8
|
+
export * from './qdrant';
|
|
9
|
+
export * from './chroma';
|
|
10
|
+
export { createMemoryVectorStore } from './base';
|
|
11
|
+
export { createPineconeStore } from './pinecone';
|
|
12
|
+
export { createWeaviateStore } from './weaviate';
|
|
13
|
+
export { createQdrantStore } from './qdrant';
|
|
14
|
+
export { createChromaStore } from './chroma';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Vector Store Integrations
|
|
4
|
+
* Provides adapters for various vector databases
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
18
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.createChromaStore = exports.createQdrantStore = exports.createWeaviateStore = exports.createPineconeStore = exports.createMemoryVectorStore = void 0;
|
|
22
|
+
__exportStar(require("./base"), exports);
|
|
23
|
+
__exportStar(require("./pinecone"), exports);
|
|
24
|
+
__exportStar(require("./weaviate"), exports);
|
|
25
|
+
__exportStar(require("./qdrant"), exports);
|
|
26
|
+
__exportStar(require("./chroma"), exports);
|
|
27
|
+
// Re-export factory functions for convenience
|
|
28
|
+
var base_1 = require("./base");
|
|
29
|
+
Object.defineProperty(exports, "createMemoryVectorStore", { enumerable: true, get: function () { return base_1.createMemoryVectorStore; } });
|
|
30
|
+
var pinecone_1 = require("./pinecone");
|
|
31
|
+
Object.defineProperty(exports, "createPineconeStore", { enumerable: true, get: function () { return pinecone_1.createPineconeStore; } });
|
|
32
|
+
var weaviate_1 = require("./weaviate");
|
|
33
|
+
Object.defineProperty(exports, "createWeaviateStore", { enumerable: true, get: function () { return weaviate_1.createWeaviateStore; } });
|
|
34
|
+
var qdrant_1 = require("./qdrant");
|
|
35
|
+
Object.defineProperty(exports, "createQdrantStore", { enumerable: true, get: function () { return qdrant_1.createQdrantStore; } });
|
|
36
|
+
var chroma_1 = require("./chroma");
|
|
37
|
+
Object.defineProperty(exports, "createChromaStore", { enumerable: true, get: function () { return chroma_1.createChromaStore; } });
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pinecone Vector Store Integration
|
|
3
|
+
*/
|
|
4
|
+
import { BaseVectorStore, CreateIndexParams, UpsertParams, QueryParams, DeleteParams, QueryResult, IndexStats } from './base';
|
|
5
|
+
export interface PineconeConfig {
|
|
6
|
+
apiKey: string;
|
|
7
|
+
environment?: string;
|
|
8
|
+
projectId?: string;
|
|
9
|
+
}
|
|
10
|
+
export declare class PineconeVectorStore extends BaseVectorStore {
|
|
11
|
+
private apiKey;
|
|
12
|
+
private baseUrl;
|
|
13
|
+
private indexHosts;
|
|
14
|
+
constructor(config: PineconeConfig & {
|
|
15
|
+
id?: string;
|
|
16
|
+
});
|
|
17
|
+
private request;
|
|
18
|
+
private indexRequest;
|
|
19
|
+
createIndex(params: CreateIndexParams): Promise<void>;
|
|
20
|
+
listIndexes(): Promise<string[]>;
|
|
21
|
+
describeIndex(indexName: string): Promise<IndexStats>;
|
|
22
|
+
deleteIndex(indexName: string): Promise<void>;
|
|
23
|
+
upsert(params: UpsertParams): Promise<string[]>;
|
|
24
|
+
query(params: QueryParams): Promise<QueryResult[]>;
|
|
25
|
+
delete(params: DeleteParams): Promise<void>;
|
|
26
|
+
update(indexName: string, id: string, metadata: Record<string, any>): Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
export declare function createPineconeStore(config: PineconeConfig): PineconeVectorStore;
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Pinecone Vector Store Integration
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.PineconeVectorStore = void 0;
|
|
7
|
+
exports.createPineconeStore = createPineconeStore;
|
|
8
|
+
const base_1 = require("./base");
|
|
9
|
+
class PineconeVectorStore extends base_1.BaseVectorStore {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
super({ id: config.id || 'pinecone', name: 'PineconeVectorStore' });
|
|
12
|
+
this.indexHosts = new Map();
|
|
13
|
+
this.apiKey = config.apiKey;
|
|
14
|
+
this.baseUrl = 'https://api.pinecone.io';
|
|
15
|
+
}
|
|
16
|
+
async request(path, options = {}) {
|
|
17
|
+
const response = await fetch(`${this.baseUrl}${path}`, {
|
|
18
|
+
...options,
|
|
19
|
+
headers: {
|
|
20
|
+
'Api-Key': this.apiKey,
|
|
21
|
+
'Content-Type': 'application/json',
|
|
22
|
+
...options.headers
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
if (!response.ok) {
|
|
26
|
+
const error = await response.text();
|
|
27
|
+
throw new Error(`Pinecone API error: ${response.status} - ${error}`);
|
|
28
|
+
}
|
|
29
|
+
const text = await response.text();
|
|
30
|
+
return text ? JSON.parse(text) : {};
|
|
31
|
+
}
|
|
32
|
+
async indexRequest(indexName, path, options = {}) {
|
|
33
|
+
let host = this.indexHosts.get(indexName);
|
|
34
|
+
if (!host) {
|
|
35
|
+
const info = await this.request(`/indexes/${indexName}`);
|
|
36
|
+
host = info.host;
|
|
37
|
+
this.indexHosts.set(indexName, host);
|
|
38
|
+
}
|
|
39
|
+
const response = await fetch(`https://${host}${path}`, {
|
|
40
|
+
...options,
|
|
41
|
+
headers: {
|
|
42
|
+
'Api-Key': this.apiKey,
|
|
43
|
+
'Content-Type': 'application/json',
|
|
44
|
+
...options.headers
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
if (!response.ok) {
|
|
48
|
+
const error = await response.text();
|
|
49
|
+
throw new Error(`Pinecone Index API error: ${response.status} - ${error}`);
|
|
50
|
+
}
|
|
51
|
+
const text = await response.text();
|
|
52
|
+
return text ? JSON.parse(text) : {};
|
|
53
|
+
}
|
|
54
|
+
async createIndex(params) {
|
|
55
|
+
const metricMap = {
|
|
56
|
+
cosine: 'cosine',
|
|
57
|
+
euclidean: 'euclidean',
|
|
58
|
+
dotProduct: 'dotproduct'
|
|
59
|
+
};
|
|
60
|
+
await this.request('/indexes', {
|
|
61
|
+
method: 'POST',
|
|
62
|
+
body: JSON.stringify({
|
|
63
|
+
name: params.indexName,
|
|
64
|
+
dimension: params.dimension,
|
|
65
|
+
metric: metricMap[params.metric || 'cosine'],
|
|
66
|
+
spec: {
|
|
67
|
+
serverless: {
|
|
68
|
+
cloud: 'aws',
|
|
69
|
+
region: 'us-east-1'
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
// Wait for index to be ready
|
|
75
|
+
let ready = false;
|
|
76
|
+
let attempts = 0;
|
|
77
|
+
while (!ready && attempts < 60) {
|
|
78
|
+
await new Promise(r => setTimeout(r, 2000));
|
|
79
|
+
try {
|
|
80
|
+
const info = await this.request(`/indexes/${params.indexName}`);
|
|
81
|
+
ready = info.status?.ready === true;
|
|
82
|
+
}
|
|
83
|
+
catch {
|
|
84
|
+
// Index not ready yet
|
|
85
|
+
}
|
|
86
|
+
attempts++;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async listIndexes() {
|
|
90
|
+
const response = await this.request('/indexes');
|
|
91
|
+
return (response.indexes || []).map((idx) => idx.name);
|
|
92
|
+
}
|
|
93
|
+
async describeIndex(indexName) {
|
|
94
|
+
const info = await this.request(`/indexes/${indexName}`);
|
|
95
|
+
const stats = await this.indexRequest(indexName, '/describe_index_stats', { method: 'POST', body: '{}' });
|
|
96
|
+
const metricMap = {
|
|
97
|
+
cosine: 'cosine',
|
|
98
|
+
euclidean: 'euclidean',
|
|
99
|
+
dotproduct: 'dotProduct'
|
|
100
|
+
};
|
|
101
|
+
return {
|
|
102
|
+
dimension: info.dimension,
|
|
103
|
+
count: stats.totalVectorCount || 0,
|
|
104
|
+
metric: metricMap[info.metric] || 'cosine'
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
async deleteIndex(indexName) {
|
|
108
|
+
await this.request(`/indexes/${indexName}`, { method: 'DELETE' });
|
|
109
|
+
this.indexHosts.delete(indexName);
|
|
110
|
+
}
|
|
111
|
+
async upsert(params) {
|
|
112
|
+
const vectors = params.vectors.map(v => ({
|
|
113
|
+
id: v.id,
|
|
114
|
+
values: v.vector,
|
|
115
|
+
metadata: v.metadata
|
|
116
|
+
}));
|
|
117
|
+
// Batch upsert in chunks of 100
|
|
118
|
+
const batchSize = 100;
|
|
119
|
+
const ids = [];
|
|
120
|
+
for (let i = 0; i < vectors.length; i += batchSize) {
|
|
121
|
+
const batch = vectors.slice(i, i + batchSize);
|
|
122
|
+
await this.indexRequest(params.indexName, '/vectors/upsert', {
|
|
123
|
+
method: 'POST',
|
|
124
|
+
body: JSON.stringify({ vectors: batch })
|
|
125
|
+
});
|
|
126
|
+
ids.push(...batch.map(v => v.id));
|
|
127
|
+
}
|
|
128
|
+
return ids;
|
|
129
|
+
}
|
|
130
|
+
async query(params) {
|
|
131
|
+
const response = await this.indexRequest(params.indexName, '/query', {
|
|
132
|
+
method: 'POST',
|
|
133
|
+
body: JSON.stringify({
|
|
134
|
+
vector: params.vector,
|
|
135
|
+
topK: params.topK || 10,
|
|
136
|
+
filter: params.filter,
|
|
137
|
+
includeMetadata: params.includeMetadata !== false,
|
|
138
|
+
includeValues: params.includeVectors
|
|
139
|
+
})
|
|
140
|
+
});
|
|
141
|
+
return (response.matches || []).map((match) => ({
|
|
142
|
+
id: match.id,
|
|
143
|
+
score: match.score,
|
|
144
|
+
metadata: match.metadata,
|
|
145
|
+
vector: match.values
|
|
146
|
+
}));
|
|
147
|
+
}
|
|
148
|
+
async delete(params) {
|
|
149
|
+
if (params.ids) {
|
|
150
|
+
await this.indexRequest(params.indexName, '/vectors/delete', {
|
|
151
|
+
method: 'POST',
|
|
152
|
+
body: JSON.stringify({ ids: params.ids })
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
else if (params.filter) {
|
|
156
|
+
await this.indexRequest(params.indexName, '/vectors/delete', {
|
|
157
|
+
method: 'POST',
|
|
158
|
+
body: JSON.stringify({ filter: params.filter })
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
async update(indexName, id, metadata) {
|
|
163
|
+
await this.indexRequest(indexName, '/vectors/update', {
|
|
164
|
+
method: 'POST',
|
|
165
|
+
body: JSON.stringify({ id, setMetadata: metadata })
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
exports.PineconeVectorStore = PineconeVectorStore;
|
|
170
|
+
function createPineconeStore(config) {
|
|
171
|
+
return new PineconeVectorStore(config);
|
|
172
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Qdrant Vector Store Integration
|
|
3
|
+
*/
|
|
4
|
+
import { BaseVectorStore, CreateIndexParams, UpsertParams, QueryParams, DeleteParams, QueryResult, IndexStats } from './base';
|
|
5
|
+
export interface QdrantConfig {
|
|
6
|
+
url: string;
|
|
7
|
+
apiKey?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare class QdrantVectorStore extends BaseVectorStore {
|
|
10
|
+
private url;
|
|
11
|
+
private apiKey?;
|
|
12
|
+
constructor(config: QdrantConfig & {
|
|
13
|
+
id?: string;
|
|
14
|
+
});
|
|
15
|
+
private request;
|
|
16
|
+
createIndex(params: CreateIndexParams): Promise<void>;
|
|
17
|
+
listIndexes(): Promise<string[]>;
|
|
18
|
+
describeIndex(indexName: string): Promise<IndexStats>;
|
|
19
|
+
deleteIndex(indexName: string): Promise<void>;
|
|
20
|
+
upsert(params: UpsertParams): Promise<string[]>;
|
|
21
|
+
query(params: QueryParams): Promise<QueryResult[]>;
|
|
22
|
+
delete(params: DeleteParams): Promise<void>;
|
|
23
|
+
update(indexName: string, id: string, metadata: Record<string, any>): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export declare function createQdrantStore(config: QdrantConfig): QdrantVectorStore;
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Qdrant Vector Store Integration
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.QdrantVectorStore = void 0;
|
|
7
|
+
exports.createQdrantStore = createQdrantStore;
|
|
8
|
+
const base_1 = require("./base");
|
|
9
|
+
class QdrantVectorStore extends base_1.BaseVectorStore {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
super({ id: config.id || 'qdrant', name: 'QdrantVectorStore' });
|
|
12
|
+
this.url = config.url.replace(/\/$/, '');
|
|
13
|
+
this.apiKey = config.apiKey;
|
|
14
|
+
}
|
|
15
|
+
async request(path, options = {}) {
|
|
16
|
+
const headers = {
|
|
17
|
+
'Content-Type': 'application/json'
|
|
18
|
+
};
|
|
19
|
+
if (this.apiKey) {
|
|
20
|
+
headers['api-key'] = this.apiKey;
|
|
21
|
+
}
|
|
22
|
+
const response = await fetch(`${this.url}${path}`, {
|
|
23
|
+
...options,
|
|
24
|
+
headers: { ...headers, ...options.headers }
|
|
25
|
+
});
|
|
26
|
+
if (!response.ok) {
|
|
27
|
+
const error = await response.text();
|
|
28
|
+
throw new Error(`Qdrant API error: ${response.status} - ${error}`);
|
|
29
|
+
}
|
|
30
|
+
const text = await response.text();
|
|
31
|
+
return text ? JSON.parse(text) : {};
|
|
32
|
+
}
|
|
33
|
+
async createIndex(params) {
|
|
34
|
+
const distanceMap = {
|
|
35
|
+
cosine: 'Cosine',
|
|
36
|
+
euclidean: 'Euclid',
|
|
37
|
+
dotProduct: 'Dot'
|
|
38
|
+
};
|
|
39
|
+
await this.request(`/collections/${params.indexName}`, {
|
|
40
|
+
method: 'PUT',
|
|
41
|
+
body: JSON.stringify({
|
|
42
|
+
vectors: {
|
|
43
|
+
size: params.dimension,
|
|
44
|
+
distance: distanceMap[params.metric || 'cosine']
|
|
45
|
+
}
|
|
46
|
+
})
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
async listIndexes() {
|
|
50
|
+
const response = await this.request('/collections');
|
|
51
|
+
return (response.result?.collections || []).map((c) => c.name);
|
|
52
|
+
}
|
|
53
|
+
async describeIndex(indexName) {
|
|
54
|
+
const response = await this.request(`/collections/${indexName}`);
|
|
55
|
+
const config = response.result?.config?.params?.vectors;
|
|
56
|
+
const distanceMap = {
|
|
57
|
+
'Cosine': 'cosine',
|
|
58
|
+
'Euclid': 'euclidean',
|
|
59
|
+
'Dot': 'dotProduct'
|
|
60
|
+
};
|
|
61
|
+
return {
|
|
62
|
+
dimension: config?.size || 0,
|
|
63
|
+
count: response.result?.points_count || 0,
|
|
64
|
+
metric: distanceMap[config?.distance] || 'cosine'
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
async deleteIndex(indexName) {
|
|
68
|
+
await this.request(`/collections/${indexName}`, { method: 'DELETE' });
|
|
69
|
+
}
|
|
70
|
+
async upsert(params) {
|
|
71
|
+
const points = params.vectors.map(v => ({
|
|
72
|
+
id: v.id,
|
|
73
|
+
vector: v.vector,
|
|
74
|
+
payload: {
|
|
75
|
+
...v.metadata,
|
|
76
|
+
_content: v.content
|
|
77
|
+
}
|
|
78
|
+
}));
|
|
79
|
+
await this.request(`/collections/${params.indexName}/points`, {
|
|
80
|
+
method: 'PUT',
|
|
81
|
+
body: JSON.stringify({ points })
|
|
82
|
+
});
|
|
83
|
+
return params.vectors.map(v => v.id);
|
|
84
|
+
}
|
|
85
|
+
async query(params) {
|
|
86
|
+
let filter = undefined;
|
|
87
|
+
if (params.filter) {
|
|
88
|
+
filter = {
|
|
89
|
+
must: Object.entries(params.filter).map(([key, value]) => ({
|
|
90
|
+
key,
|
|
91
|
+
match: { value }
|
|
92
|
+
}))
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
const response = await this.request(`/collections/${params.indexName}/points/search`, {
|
|
96
|
+
method: 'POST',
|
|
97
|
+
body: JSON.stringify({
|
|
98
|
+
vector: params.vector,
|
|
99
|
+
limit: params.topK || 10,
|
|
100
|
+
filter,
|
|
101
|
+
with_payload: params.includeMetadata !== false,
|
|
102
|
+
with_vector: params.includeVectors
|
|
103
|
+
})
|
|
104
|
+
});
|
|
105
|
+
return (response.result || []).map((r) => ({
|
|
106
|
+
id: r.id,
|
|
107
|
+
score: r.score,
|
|
108
|
+
metadata: r.payload ? { ...r.payload, _content: undefined } : undefined,
|
|
109
|
+
content: r.payload?._content,
|
|
110
|
+
vector: r.vector
|
|
111
|
+
}));
|
|
112
|
+
}
|
|
113
|
+
async delete(params) {
|
|
114
|
+
if (params.ids) {
|
|
115
|
+
await this.request(`/collections/${params.indexName}/points/delete`, {
|
|
116
|
+
method: 'POST',
|
|
117
|
+
body: JSON.stringify({ points: params.ids })
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
else if (params.filter) {
|
|
121
|
+
const filter = {
|
|
122
|
+
must: Object.entries(params.filter).map(([key, value]) => ({
|
|
123
|
+
key,
|
|
124
|
+
match: { value }
|
|
125
|
+
}))
|
|
126
|
+
};
|
|
127
|
+
await this.request(`/collections/${params.indexName}/points/delete`, {
|
|
128
|
+
method: 'POST',
|
|
129
|
+
body: JSON.stringify({ filter })
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
async update(indexName, id, metadata) {
|
|
134
|
+
await this.request(`/collections/${indexName}/points/payload`, {
|
|
135
|
+
method: 'POST',
|
|
136
|
+
body: JSON.stringify({
|
|
137
|
+
points: [id],
|
|
138
|
+
payload: metadata
|
|
139
|
+
})
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
exports.QdrantVectorStore = QdrantVectorStore;
|
|
144
|
+
function createQdrantStore(config) {
|
|
145
|
+
return new QdrantVectorStore(config);
|
|
146
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Weaviate Vector Store Integration
|
|
3
|
+
*/
|
|
4
|
+
import { BaseVectorStore, CreateIndexParams, UpsertParams, QueryParams, DeleteParams, QueryResult, IndexStats } from './base';
|
|
5
|
+
export interface WeaviateConfig {
|
|
6
|
+
host: string;
|
|
7
|
+
apiKey?: string;
|
|
8
|
+
scheme?: 'http' | 'https';
|
|
9
|
+
}
|
|
10
|
+
export declare class WeaviateVectorStore extends BaseVectorStore {
|
|
11
|
+
private host;
|
|
12
|
+
private apiKey?;
|
|
13
|
+
private scheme;
|
|
14
|
+
constructor(config: WeaviateConfig & {
|
|
15
|
+
id?: string;
|
|
16
|
+
});
|
|
17
|
+
private get baseUrl();
|
|
18
|
+
private request;
|
|
19
|
+
private graphql;
|
|
20
|
+
private toClassName;
|
|
21
|
+
createIndex(params: CreateIndexParams): Promise<void>;
|
|
22
|
+
listIndexes(): Promise<string[]>;
|
|
23
|
+
describeIndex(indexName: string): Promise<IndexStats>;
|
|
24
|
+
deleteIndex(indexName: string): Promise<void>;
|
|
25
|
+
upsert(params: UpsertParams): Promise<string[]>;
|
|
26
|
+
query(params: QueryParams): Promise<QueryResult[]>;
|
|
27
|
+
delete(params: DeleteParams): Promise<void>;
|
|
28
|
+
update(indexName: string, id: string, metadata: Record<string, any>): Promise<void>;
|
|
29
|
+
}
|
|
30
|
+
export declare function createWeaviateStore(config: WeaviateConfig): WeaviateVectorStore;
|
|
@@ -0,0 +1,206 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Weaviate Vector Store Integration
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.WeaviateVectorStore = void 0;
|
|
7
|
+
exports.createWeaviateStore = createWeaviateStore;
|
|
8
|
+
const base_1 = require("./base");
|
|
9
|
+
class WeaviateVectorStore extends base_1.BaseVectorStore {
|
|
10
|
+
constructor(config) {
|
|
11
|
+
super({ id: config.id || 'weaviate', name: 'WeaviateVectorStore' });
|
|
12
|
+
this.host = config.host;
|
|
13
|
+
this.apiKey = config.apiKey;
|
|
14
|
+
this.scheme = config.scheme || 'https';
|
|
15
|
+
}
|
|
16
|
+
get baseUrl() {
|
|
17
|
+
return `${this.scheme}://${this.host}`;
|
|
18
|
+
}
|
|
19
|
+
async request(path, options = {}) {
|
|
20
|
+
const headers = {
|
|
21
|
+
'Content-Type': 'application/json'
|
|
22
|
+
};
|
|
23
|
+
if (this.apiKey) {
|
|
24
|
+
headers['Authorization'] = `Bearer ${this.apiKey}`;
|
|
25
|
+
}
|
|
26
|
+
const response = await fetch(`${this.baseUrl}${path}`, {
|
|
27
|
+
...options,
|
|
28
|
+
headers: { ...headers, ...options.headers }
|
|
29
|
+
});
|
|
30
|
+
if (!response.ok) {
|
|
31
|
+
const error = await response.text();
|
|
32
|
+
throw new Error(`Weaviate API error: ${response.status} - ${error}`);
|
|
33
|
+
}
|
|
34
|
+
const text = await response.text();
|
|
35
|
+
return text ? JSON.parse(text) : {};
|
|
36
|
+
}
|
|
37
|
+
async graphql(query, variables) {
|
|
38
|
+
const response = await this.request('/v1/graphql', {
|
|
39
|
+
method: 'POST',
|
|
40
|
+
body: JSON.stringify({ query, variables })
|
|
41
|
+
});
|
|
42
|
+
return response;
|
|
43
|
+
}
|
|
44
|
+
toClassName(indexName) {
|
|
45
|
+
// Weaviate class names must start with uppercase
|
|
46
|
+
return indexName.charAt(0).toUpperCase() + indexName.slice(1);
|
|
47
|
+
}
|
|
48
|
+
async createIndex(params) {
|
|
49
|
+
const className = this.toClassName(params.indexName);
|
|
50
|
+
const vectorIndexConfig = {
|
|
51
|
+
distance: params.metric === 'euclidean' ? 'l2-squared' :
|
|
52
|
+
params.metric === 'dotProduct' ? 'dot' : 'cosine'
|
|
53
|
+
};
|
|
54
|
+
await this.request('/v1/schema', {
|
|
55
|
+
method: 'POST',
|
|
56
|
+
body: JSON.stringify({
|
|
57
|
+
class: className,
|
|
58
|
+
vectorIndexConfig,
|
|
59
|
+
properties: [
|
|
60
|
+
{
|
|
61
|
+
name: 'content',
|
|
62
|
+
dataType: ['text']
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'metadata',
|
|
66
|
+
dataType: ['object']
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
})
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
async listIndexes() {
|
|
73
|
+
const response = await this.request('/v1/schema');
|
|
74
|
+
return (response.classes || []).map((c) => c.class.toLowerCase());
|
|
75
|
+
}
|
|
76
|
+
async describeIndex(indexName) {
|
|
77
|
+
const className = this.toClassName(indexName);
|
|
78
|
+
const response = await this.request(`/v1/schema/${className}`);
|
|
79
|
+
// Get count via aggregate
|
|
80
|
+
const countQuery = `{
|
|
81
|
+
Aggregate {
|
|
82
|
+
${className} {
|
|
83
|
+
meta { count }
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}`;
|
|
87
|
+
const countResponse = await this.graphql(countQuery);
|
|
88
|
+
const count = countResponse.data?.Aggregate?.[className]?.[0]?.meta?.count || 0;
|
|
89
|
+
const distanceMap = {
|
|
90
|
+
'cosine': 'cosine',
|
|
91
|
+
'l2-squared': 'euclidean',
|
|
92
|
+
'dot': 'dotProduct'
|
|
93
|
+
};
|
|
94
|
+
return {
|
|
95
|
+
dimension: response.vectorIndexConfig?.dimensions || 0,
|
|
96
|
+
count,
|
|
97
|
+
metric: distanceMap[response.vectorIndexConfig?.distance] || 'cosine'
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
async deleteIndex(indexName) {
|
|
101
|
+
const className = this.toClassName(indexName);
|
|
102
|
+
await this.request(`/v1/schema/${className}`, { method: 'DELETE' });
|
|
103
|
+
}
|
|
104
|
+
async upsert(params) {
|
|
105
|
+
const className = this.toClassName(params.indexName);
|
|
106
|
+
const ids = [];
|
|
107
|
+
// Batch upsert
|
|
108
|
+
const objects = params.vectors.map(v => ({
|
|
109
|
+
class: className,
|
|
110
|
+
id: v.id,
|
|
111
|
+
vector: v.vector,
|
|
112
|
+
properties: {
|
|
113
|
+
content: v.content || '',
|
|
114
|
+
metadata: v.metadata || {}
|
|
115
|
+
}
|
|
116
|
+
}));
|
|
117
|
+
// Batch in chunks of 100
|
|
118
|
+
const batchSize = 100;
|
|
119
|
+
for (let i = 0; i < objects.length; i += batchSize) {
|
|
120
|
+
const batch = objects.slice(i, i + batchSize);
|
|
121
|
+
await this.request('/v1/batch/objects', {
|
|
122
|
+
method: 'POST',
|
|
123
|
+
body: JSON.stringify({ objects: batch })
|
|
124
|
+
});
|
|
125
|
+
ids.push(...batch.map(o => o.id));
|
|
126
|
+
}
|
|
127
|
+
return ids;
|
|
128
|
+
}
|
|
129
|
+
async query(params) {
|
|
130
|
+
const className = this.toClassName(params.indexName);
|
|
131
|
+
const topK = params.topK || 10;
|
|
132
|
+
let whereClause = '';
|
|
133
|
+
if (params.filter) {
|
|
134
|
+
const conditions = Object.entries(params.filter).map(([key, value]) => {
|
|
135
|
+
return `{ path: ["metadata", "${key}"], operator: Equal, valueString: "${value}" }`;
|
|
136
|
+
});
|
|
137
|
+
if (conditions.length > 0) {
|
|
138
|
+
whereClause = `where: { operator: And, operands: [${conditions.join(', ')}] }`;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const query = `{
|
|
142
|
+
Get {
|
|
143
|
+
${className}(
|
|
144
|
+
nearVector: { vector: [${params.vector.join(',')}] }
|
|
145
|
+
limit: ${topK}
|
|
146
|
+
${whereClause}
|
|
147
|
+
) {
|
|
148
|
+
_additional {
|
|
149
|
+
id
|
|
150
|
+
distance
|
|
151
|
+
${params.includeVectors ? 'vector' : ''}
|
|
152
|
+
}
|
|
153
|
+
content
|
|
154
|
+
metadata
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
}`;
|
|
158
|
+
const response = await this.graphql(query);
|
|
159
|
+
const results = response.data?.Get?.[className] || [];
|
|
160
|
+
return results.map((r) => ({
|
|
161
|
+
id: r._additional.id,
|
|
162
|
+
score: 1 - (r._additional.distance || 0), // Convert distance to similarity
|
|
163
|
+
metadata: r.metadata,
|
|
164
|
+
content: r.content,
|
|
165
|
+
vector: r._additional.vector
|
|
166
|
+
}));
|
|
167
|
+
}
|
|
168
|
+
async delete(params) {
|
|
169
|
+
const className = this.toClassName(params.indexName);
|
|
170
|
+
if (params.ids) {
|
|
171
|
+
for (const id of params.ids) {
|
|
172
|
+
await this.request(`/v1/objects/${className}/${id}`, { method: 'DELETE' });
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
else if (params.filter) {
|
|
176
|
+
// Delete by filter using batch delete
|
|
177
|
+
const conditions = Object.entries(params.filter).map(([key, value]) => ({
|
|
178
|
+
path: ['metadata', key],
|
|
179
|
+
operator: 'Equal',
|
|
180
|
+
valueString: String(value)
|
|
181
|
+
}));
|
|
182
|
+
await this.request('/v1/batch/objects', {
|
|
183
|
+
method: 'DELETE',
|
|
184
|
+
body: JSON.stringify({
|
|
185
|
+
match: {
|
|
186
|
+
class: className,
|
|
187
|
+
where: { operator: 'And', operands: conditions }
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
async update(indexName, id, metadata) {
|
|
194
|
+
const className = this.toClassName(indexName);
|
|
195
|
+
await this.request(`/v1/objects/${className}/${id}`, {
|
|
196
|
+
method: 'PATCH',
|
|
197
|
+
body: JSON.stringify({
|
|
198
|
+
properties: { metadata }
|
|
199
|
+
})
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
exports.WeaviateVectorStore = WeaviateVectorStore;
|
|
204
|
+
function createWeaviateStore(config) {
|
|
205
|
+
return new WeaviateVectorStore(config);
|
|
206
|
+
}
|