@galaxyproject/jupyterlite 0.0.17 → 0.0.19
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 +4 -3
- package/static/dist/_output/build/schemas/all_federated.json +1 -1
- package/static/dist/_output/extensions/@jupyterlite/ai/install.json +5 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/package.json +252 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/schemas/@jupyterlite/ai/settings-model.json +194 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/116.010504c67cccbe983101.js +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/155.33f38a7e48ddbeb5bb6e.js +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/180.96635ff74c0413e0c580.js +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/19.a1bb726875fe6561330e.js +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/306.17ff80cd7d3702012f98.js +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/313.e439dd0f4960f6e7585f.js +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/324.77487b82034275866b8c.js +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/340.e42ea25ea5b1b374a682.js +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/374.d7b4dcf29eb3d2ebfd70.js +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/472.05d097796e83ea9a22b4.js +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/529.600d1aebb2de2d73fecb.js +2 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/529.600d1aebb2de2d73fecb.js.LICENSE.txt +8 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/537.eb8d9ccd76231e36d75f.js +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/593.284fd5d2b50defc573f3.js +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/665.564d208c226b2753e13b.js +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/669.0094374ba6e3143702f7.js +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/692.911f4d7dca73b3737833.js +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/694.e439dd0f4960f6e7585f.js +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/709.7578153f9eed366ee430.js +2 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/709.7578153f9eed366ee430.js.LICENSE.txt +19 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/728.d7c2cb9a2f7fdd846b35.js +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/764.312b4b53ed50be5bf3f8.js +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/798.dca29a3fc3b23c555f6b.js +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/88.898492ebc5b41a4607c6.js +2 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/88.898492ebc5b41a4607c6.js.LICENSE.txt +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/885.1670a5138e0a13def795.js +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/918.e91fcd78edba173284a4.js +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/92.55c2fe71a33184c2e66d.js +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/952.003f03c751075980ac7f.js +183 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/remoteEntry.2f103c13fd640ab93eb9.js +1 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/style.js +4 -0
- package/static/dist/_output/extensions/@jupyterlite/ai/static/third-party-licenses.json +352 -0
- package/static/dist/_output/extensions/jl-galaxy/extension.js +1 -1
- package/static/dist/_output/extensions/jupyter-secrets-manager/install.json +5 -0
- package/static/dist/_output/extensions/jupyter-secrets-manager/package.json +207 -0
- package/static/dist/_output/extensions/jupyter-secrets-manager/schemas/jupyter-secrets-manager/manager.json +14 -0
- package/static/dist/_output/extensions/jupyter-secrets-manager/static/728.69cdb8043c4eb7a36084.js +1 -0
- package/static/dist/_output/extensions/jupyter-secrets-manager/static/810.7ac328ef761c19894484.js +1 -0
- package/static/dist/_output/extensions/jupyter-secrets-manager/static/remoteEntry.6610dc2c9e0921c7f94a.js +1 -0
- package/static/dist/_output/extensions/jupyter-secrets-manager/static/style.js +4 -0
- package/static/dist/_output/extensions/jupyter-secrets-manager/static/third-party-licenses.json +16 -0
- package/static/dist/_output/extensions/jupyterlab-cell-input-footer-extension/install.json +5 -0
- package/static/dist/_output/extensions/jupyterlab-cell-input-footer-extension/package.json +90 -0
- package/static/dist/_output/extensions/jupyterlab-cell-input-footer-extension/static/374.f7ab05aeba5c1aa173c9.js +1 -0
- package/static/dist/_output/extensions/jupyterlab-cell-input-footer-extension/static/432.7cb3263d05824765a0d2.js +1 -0
- package/static/dist/_output/extensions/jupyterlab-cell-input-footer-extension/static/509.9384daafd8fb72a4ff3a.js +1 -0
- package/static/dist/_output/extensions/jupyterlab-cell-input-footer-extension/static/993.f7ab05aeba5c1aa173c9.js +1 -0
- package/static/dist/_output/extensions/jupyterlab-cell-input-footer-extension/static/remoteEntry.f80ac7a8e97b08d2a2fd.js +1 -0
- package/static/dist/_output/extensions/jupyterlab-cell-input-footer-extension/static/style.js +4 -0
- package/static/dist/_output/extensions/jupyterlab-cell-input-footer-extension/static/third-party-licenses.json +22 -0
- package/static/dist/_output/extensions/jupyterlab-diff/install.json +5 -0
- package/static/dist/_output/extensions/jupyterlab-diff/package.json +224 -0
- package/static/dist/_output/extensions/jupyterlab-diff/static/299.07069b808cb23f84a242.js +1 -0
- package/static/dist/_output/extensions/jupyterlab-diff/static/379.2e2a6add1111d74422d2.js +1 -0
- package/static/dist/_output/extensions/jupyterlab-diff/static/383.dbd292b18614d410ed4b.js +1 -0
- package/static/dist/_output/extensions/jupyterlab-diff/static/499.e9c141febe62f251e965.js +1 -0
- package/static/dist/_output/extensions/jupyterlab-diff/static/680.07069b808cb23f84a242.js +1 -0
- package/static/dist/_output/extensions/jupyterlab-diff/static/728.559a28b17e14994cba46.js +1 -0
- package/static/dist/_output/extensions/jupyterlab-diff/static/747.e3256716cc1134700a59.js +1 -0
- package/static/dist/_output/extensions/jupyterlab-diff/static/879.749253139a5186f32109.js +1 -0
- package/static/dist/_output/extensions/jupyterlab-diff/static/remoteEntry.4830528fbe7c3ca55989.js +1 -0
- package/static/dist/_output/extensions/jupyterlab-diff/static/style.js +4 -0
- package/static/dist/_output/extensions/jupyterlab-diff/static/third-party-licenses.json +94 -0
- package/static/dist/_output/extensions/jupyterlab-eventlistener-extension/install.json +5 -0
- package/static/dist/_output/extensions/jupyterlab-eventlistener-extension/package.json +90 -0
- package/static/dist/_output/extensions/jupyterlab-eventlistener-extension/static/432.57100b29bc9fea211a0e.js +1 -0
- package/static/dist/_output/extensions/jupyterlab-eventlistener-extension/static/509.d1cc43983763b6a85f45.js +1 -0
- package/static/dist/_output/extensions/jupyterlab-eventlistener-extension/static/666.84cadfe40c86b502f11d.js +1 -0
- package/static/dist/_output/extensions/jupyterlab-eventlistener-extension/static/remoteEntry.5577376b289c1f9e2dc2.js +1 -0
- package/static/dist/_output/extensions/jupyterlab-eventlistener-extension/static/style.js +4 -0
- package/static/dist/_output/extensions/jupyterlab-eventlistener-extension/static/third-party-licenses.json +22 -0
- package/static/dist/_output/jupyter-lite.json +43 -20
- package/static/dist/_output/pypi/attrs-25.4.0-py3-none-any.whl +0 -0
- package/static/dist/_output/pypi/gxy-0.0.0-py3-none-any.whl +0 -0
- package/static/dist/_output/pypi/jupyter_core-5.9.1-py3-none-any.whl +0 -0
- package/static/dist/_output/pypi/narwhals-2.13.0-py3-none-any.whl +0 -0
- package/static/dist/_output/pypi/{platformdirs-4.4.0-py3-none-any.whl → platformdirs-4.5.1-py3-none-any.whl} +0 -0
- package/static/dist/_output/pypi/referencing-0.37.0-py3-none-any.whl +0 -0
- package/static/dist/index.js +2 -2
- package/static/dist/_output/pypi/attrs-25.3.0-py3-none-any.whl +0 -0
- package/static/dist/_output/pypi/jupyter_core-5.8.1-py3-none-any.whl +0 -0
- package/static/dist/_output/pypi/narwhals-2.6.0-py3-none-any.whl +0 -0
- package/static/dist/_output/pypi/referencing-0.36.2-py3-none-any.whl +0 -0
package/package.json
CHANGED
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@galaxyproject/jupyterlite",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.19",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"files": [
|
|
6
6
|
"static"
|
|
7
7
|
],
|
|
8
8
|
"scripts": {
|
|
9
|
-
"build": "webpack && npm run build:jupyter && npm run build:gxy && npm run build:extension && npm run build:patch && npm run build:index",
|
|
9
|
+
"build": "webpack && npm run build:jupyter && npm run build:gxy && npm run build:extension && npm run build:patch && npm run build:index && npm run build:public",
|
|
10
10
|
"build:extension": "node install-extension.js",
|
|
11
11
|
"build:gxy": "cd gxy && python -m build --wheel",
|
|
12
12
|
"build:index": "cpx src/index.js static/dist",
|
|
13
|
-
"build:jupyter": "jupyter lite build --output-dir static/dist/_output
|
|
13
|
+
"build:jupyter": "jupyter lite build --output-dir static/dist/_output",
|
|
14
14
|
"build:patch": "node patch-config.js",
|
|
15
|
+
"build:public": "cp public/* static",
|
|
15
16
|
"dev": "jupyter lite serve --output-dir static/dist/_output --config static/dist/_output/jupyter-lite.json",
|
|
16
17
|
"prettier": "prettier --write 'package.json' '*.js' '*.ts' 'src/*.js' 'src/*.ts'",
|
|
17
18
|
"test": "npx playwright test"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
[]
|
|
1
|
+
[{"id": "jupyter-secrets-manager:manager", "raw": "{}", "schema": {"title": "Secrets manager", "description": "The secrets manager settings", "type": "object", "properties": {"ShowSecretFields": {"type": "boolean", "title": "Show secret fields", "description": "Whether to show the secret fields in the UI or not", "default": false}}, "additionalProperties": false}, "settings": {}, "version": "0.4.1"}, {"id": "@jupyterlite/ai:settings-model", "raw": "{}", "schema": {"jupyter.lab.shortcuts": [], "title": "JupyterLite AI Settings", "description": "Configuration for JupyterLite AI extension providers, models, and behavior", "type": "object", "properties": {"useSecretsManager": {"type": "boolean", "title": "Use secrets manager", "description": "Whether to use or not the secrets manager. If not, secrets will be stored in plain text in settings", "default": true}, "providers": {"title": "AI Providers", "description": "List of configured AI providers", "type": "array", "items": {"type": "object", "properties": {"id": {"type": "string"}, "name": {"type": "string"}, "provider": {"type": "string", "description": "Provider identifier"}, "model": {"type": "string"}, "apiKey": {"type": "string"}, "baseURL": {"type": "string"}, "headers": {"type": "object", "additionalProperties": {"type": "string"}}, "parameters": {"type": "object", "description": "Provider-specific parameters", "properties": {"temperature": {"type": "number", "description": "Temperature (0.0 = deterministic, 2.0 = very creative)", "minimum": 0, "maximum": 2, "default": 0.7}, "maxTokens": {"type": "number", "description": "Maximum tokens for chat responses", "minimum": 1}, "maxTurns": {"type": "number", "description": "Maximum number of tool execution turns", "minimum": 1, "maximum": 100, "default": 25}, "supportsFillInMiddle": {"type": "boolean", "description": "Whether the model supports fill-in-middle completion"}, "useFilterText": {"type": "boolean", "description": "Whether to use filter text for completions"}}}, "customSettings": {"type": "object", "additionalProperties": true}}, "required": ["id", "name", "provider", "model"], "additionalProperties": true}, "default": []}, "defaultProvider": {"title": "Default Chat Provider", "description": "ID of the default provider to use for chat", "type": "string", "default": ""}, "activeCompleterProvider": {"title": "Active Completion Provider", "description": "ID of the provider to use for completions (if different from chat)", "type": "string"}, "useSameProviderForChatAndCompleter": {"title": "Use Same Provider", "description": "Use the same provider for both chat and completions", "type": "boolean", "default": true}, "mcpServers": {"title": "MCP Servers", "description": "Model Context Protocol servers configuration", "type": "array", "items": {"type": "object", "properties": {"id": {"type": "string"}, "name": {"type": "string"}, "url": {"type": "string"}, "enabled": {"type": "boolean"}}, "required": ["id", "name", "url", "enabled"], "additionalProperties": true}, "default": []}, "contextAwareness": {"title": "Context Awareness", "description": "Enable context-aware responses", "type": "boolean", "default": true}, "codeExecution": {"title": "Code Execution", "description": "Enable code execution capabilities", "type": "boolean", "default": false}, "toolsEnabled": {"title": "Tools Enabled", "description": "Allow AI to use tools like notebook operations and file management", "type": "boolean", "default": true}, "sendWithShiftEnter": {"title": "Send with Shift+Enter", "description": "Use Shift+Enter to send messages (Enter creates new line)", "type": "boolean", "default": false}, "showTokenUsage": {"title": "Show Token Usage", "description": "Display token usage information in the chat toolbar", "type": "boolean", "default": false}, "commandsRequiringApproval": {"title": "Commands Requiring Approval", "description": "List of commands that require user approval before AI can execute them", "type": "array", "items": {"type": "string"}, "default": ["notebook:restart-run-all", "notebook:run-cell", "notebook:run-cell-and-select-next", "notebook:run-cell-and-insert-below", "notebook:run-all-cells", "notebook:run-all-above", "notebook:run-all-below", "console:execute", "console:execute-forced", "fileeditor:run-code", "kernelmenu:run", "kernelmenu:restart-and-run-all", "runmenu:run-all"]}, "systemPrompt": {"title": "System Prompt", "description": "Instructions that define how the AI should behave and respond", "type": "string", "default": "You are Jupyternaut, an AI coding assistant built specifically for the JupyterLab environment.\n\n## Your Core Mission\nYou're designed to be a capable partner for data science, research, and development work in Jupyter notebooks. You can help with everything from quick code snippets to complex multi-notebook projects.\n\n## Your Capabilities\n**\ud83d\udcc1 File & Project Management:**\n- Create, read, edit, and organize Python files and notebooks\n- Manage project structure and navigate file systems\n- Help with version control and project organization\n\n**\ud83d\udcca Notebook Operations:**\n- Create new notebooks and manage existing ones\n- Add, edit, delete, and run cells (both code and markdown)\n- Help with notebook structure and organization\n- Retrieve and analyze cell outputs and execution results\n\n**\ud83e\udde0 Coding & Development:**\n- Write, debug, and optimize Python code\n- Explain complex algorithms and data structures\n- Help with data analysis, visualization, and machine learning\n- Support for scientific computing libraries (numpy, pandas, matplotlib, etc.)\n- Code reviews and best practices recommendations\n\n**\ud83d\udca1 Adaptive Assistance:**\n- Understand context from your current work environment\n- Provide suggestions tailored to your specific use case\n- Help with both quick fixes and long-term project planning\n\n## How I Work\nI can actively interact with your JupyterLab environment using specialized tools. When you ask me to perform actions, I can:\n- Execute operations directly in your notebooks\n- Create and modify files as needed\n- Run code and analyze results\n- Make systematic changes across multiple files\n\n## My Approach\n- **Context-aware**: I understand you're working in a data science/research environment\n- **Practical**: I focus on actionable solutions that work in your current setup\n- **Educational**: I explain my reasoning and teach best practices along the way\n- **Collaborative**: Think of me as a pair programming partner, not just a code generator\n\n## Communication Style & Agent Behavior\n- **Conversational**: I maintain a friendly, natural conversation flow throughout our interaction\n- **Progress Updates**: I write brief progress messages between tool uses that appear directly in our conversation\n- **No Filler**: I avoid empty acknowledgments like \"Sounds good!\" or \"Okay, I will...\" - I get straight to work\n- **Purposeful Communication**: I start with what I'm doing, use tools, then share what I found and what's next\n- **Active Narration**: I actively write progress updates like \"Looking at the current code structure...\" or \"Found the issue in the notebook...\" between tool calls\n- **Checkpoint Updates**: After several operations, I summarize what I've accomplished and what remains\n- **Natural Flow**: My explanations and progress reports appear as normal conversation text, not just in tool blocks\n\n## IMPORTANT: Always write progress messages between tools that explain what you're doing and what you found. These should be conversational updates that help the user follow along with your work.\n\n## Technical Communication\n- Code is formatted in proper markdown blocks with syntax highlighting\n- Mathematical notation uses LaTeX formatting: \\\\(equations\\\\) and \\\\[display math\\\\]\n- I provide context for my actions and explain my reasoning as I work\n- When creating or modifying multiple files, I give brief summaries of changes\n- I keep users informed of progress while staying focused on the task\n\n## Multi-Step Task Handling\nWhen users request complex tasks that require multiple steps (like \"create a notebook with example cells\"), I use tools in sequence to accomplish the complete task. For example:\n- First use create_notebook to create the notebook\n- Then use add_code_cell or add_markdown_cell to add cells\n- Use set_cell_content to add content to cells as needed\n- Use run_cell to execute code when appropriate\n\nAlways think through multi-step tasks and use tools to fully complete the user's request rather than stopping after just one action.\n\nReady to help you build something great! What are you working on?"}, "completionSystemPrompt": {"title": "Completion System Prompt", "description": "Instructions that define how the AI should generate code completions", "type": "string", "default": "You are an AI code completion assistant. Complete the given code fragment with appropriate code.\nRules:\n- Return only the completion text, no explanations or comments\n- Do not include code block markers (``` or similar)\n- Make completions contextually relevant to the surrounding code and notebook context\n- Follow the language-specific conventions and style guidelines for the detected programming language\n- Keep completions concise but functional\n- Do not repeat the existing code that comes before the cursor\n- Use variables, imports, functions, and other definitions from previous notebook cells when relevant"}, "showCellDiff": {"title": "Show Cell Diff", "description": "Show diff view when AI modifies cell content", "type": "boolean", "default": true}, "showFileDiff": {"title": "Show File Diff", "description": "Show diff view when AI modifies file content", "type": "boolean", "default": true}, "diffDisplayMode": {"title": "Diff Display Mode", "description": "How to display cell diffs (split or unified view)", "type": "string", "enum": ["split", "unified"], "default": "split"}}, "additionalProperties": false}, "settings": {}, "version": "0.9.1"}]
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@jupyterlite/ai",
|
|
3
|
+
"version": "0.9.1",
|
|
4
|
+
"description": "AI code completions and chat for JupyterLite",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"jupyter",
|
|
7
|
+
"jupyterlab",
|
|
8
|
+
"jupyterlab-extension"
|
|
9
|
+
],
|
|
10
|
+
"homepage": "https://github.com/jupyterlite/ai",
|
|
11
|
+
"bugs": {
|
|
12
|
+
"url": "https://github.com/jupyterlite/ai/issues"
|
|
13
|
+
},
|
|
14
|
+
"license": "BSD-3-Clause",
|
|
15
|
+
"author": "JupyterLite Contributors",
|
|
16
|
+
"files": [
|
|
17
|
+
"lib/**/*.{d.ts,eot,gif,html,jpg,js,js.map,json,png,svg,woff2,ttf,md}",
|
|
18
|
+
"style/**/*.{css,js,eot,gif,html,jpg,json,png,svg,woff2,ttf}",
|
|
19
|
+
"src/**/*.{ts,tsx}",
|
|
20
|
+
"schema/*.json"
|
|
21
|
+
],
|
|
22
|
+
"main": "lib/index.js",
|
|
23
|
+
"types": "lib/index.d.ts",
|
|
24
|
+
"style": "style/index.css",
|
|
25
|
+
"repository": {
|
|
26
|
+
"type": "git",
|
|
27
|
+
"url": "https://github.com/jupyterlite/ai.git"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"build": "jlpm build:lib && jlpm build:labextension:dev",
|
|
31
|
+
"build:dev": "jlpm build:lib && jlpm build:labextension:dev",
|
|
32
|
+
"build:prod": "jlpm clean && jlpm build:lib:prod && jlpm build:labextension",
|
|
33
|
+
"build:labextension": "jupyter labextension build .",
|
|
34
|
+
"build:labextension:dev": "jupyter labextension build --development True .",
|
|
35
|
+
"build:lib": "tsc --sourceMap",
|
|
36
|
+
"build:lib:prod": "tsc",
|
|
37
|
+
"clean": "jlpm clean:lib",
|
|
38
|
+
"clean:lib": "rimraf lib tsconfig.tsbuildinfo",
|
|
39
|
+
"clean:lintcache": "rimraf .eslintcache .stylelintcache",
|
|
40
|
+
"clean:labextension": "rimraf jupyterlite_ai/labextension jupyterlite_ai/_version.py",
|
|
41
|
+
"clean:all": "jlpm clean:lib && jlpm clean:labextension && jlpm clean:lintcache",
|
|
42
|
+
"eslint": "jlpm eslint:check --fix",
|
|
43
|
+
"eslint:check": "eslint . --cache --ext .ts,.tsx",
|
|
44
|
+
"install:extension": "jlpm build",
|
|
45
|
+
"lint": "jlpm stylelint && jlpm prettier && jlpm eslint",
|
|
46
|
+
"lint:check": "jlpm stylelint:check && jlpm prettier:check && jlpm eslint:check",
|
|
47
|
+
"prettier": "jlpm prettier:base --write --list-different",
|
|
48
|
+
"prettier:base": "prettier \"**/*{.ts,.tsx,.js,.jsx,.css,.json,.md}\"",
|
|
49
|
+
"prettier:check": "jlpm prettier:base --check",
|
|
50
|
+
"stylelint": "jlpm stylelint:check --fix",
|
|
51
|
+
"stylelint:check": "stylelint --cache \"style/**/*.css\"",
|
|
52
|
+
"watch": "run-p watch:src watch:labextension",
|
|
53
|
+
"watch:src": "tsc -w --sourceMap",
|
|
54
|
+
"watch:labextension": "jupyter labextension watch ."
|
|
55
|
+
},
|
|
56
|
+
"dependencies": {
|
|
57
|
+
"@ai-sdk/anthropic": "^2.0.30",
|
|
58
|
+
"@ai-sdk/google": "^2.0.19",
|
|
59
|
+
"@ai-sdk/mistral": "^2.0.17",
|
|
60
|
+
"@ai-sdk/openai": "^2.0.44",
|
|
61
|
+
"@ai-sdk/openai-compatible": "^1.0.26",
|
|
62
|
+
"@jupyter/chat": "^0.18.2",
|
|
63
|
+
"@jupyterlab/application": "^4.0.0",
|
|
64
|
+
"@jupyterlab/apputils": "^4.5.6",
|
|
65
|
+
"@jupyterlab/cells": "^4.4.6",
|
|
66
|
+
"@jupyterlab/completer": "^4.0.0",
|
|
67
|
+
"@jupyterlab/coreutils": "^6.4.6",
|
|
68
|
+
"@jupyterlab/docmanager": "^4.4.6",
|
|
69
|
+
"@jupyterlab/docregistry": "^4.4.6",
|
|
70
|
+
"@jupyterlab/fileeditor": "^4.4.6",
|
|
71
|
+
"@jupyterlab/notebook": "^4.4.6",
|
|
72
|
+
"@jupyterlab/rendermime": "^4.4.6",
|
|
73
|
+
"@jupyterlab/services": "^7.4.6",
|
|
74
|
+
"@jupyterlab/settingregistry": "^4.0.0",
|
|
75
|
+
"@jupyterlab/statusbar": "^4.4.6",
|
|
76
|
+
"@jupyterlab/ui-components": "^4.4.6",
|
|
77
|
+
"@lumino/commands": "^2.3.2",
|
|
78
|
+
"@lumino/coreutils": "^2.2.1",
|
|
79
|
+
"@lumino/disposable": "^2.1.4",
|
|
80
|
+
"@lumino/messaging": "^2.0.3",
|
|
81
|
+
"@lumino/polling": "^2.1.4",
|
|
82
|
+
"@lumino/signaling": "^2.1.4",
|
|
83
|
+
"@lumino/widgets": "^2.7.1",
|
|
84
|
+
"@modelcontextprotocol/sdk": "^1.19.1",
|
|
85
|
+
"@mui/icons-material": "^7",
|
|
86
|
+
"@mui/material": "^7",
|
|
87
|
+
"@openai/agents": "^0.1.9",
|
|
88
|
+
"@openai/agents-extensions": "^0.1.5",
|
|
89
|
+
"ai": "^5.0.60",
|
|
90
|
+
"jupyter-secrets-manager": "^0.4.0",
|
|
91
|
+
"zod": "^3.25.76"
|
|
92
|
+
},
|
|
93
|
+
"devDependencies": {
|
|
94
|
+
"@jupyterlab/builder": "^4.0.0",
|
|
95
|
+
"@jupyterlab/testutils": "^4.0.0",
|
|
96
|
+
"@types/json-schema": "^7.0.11",
|
|
97
|
+
"@types/node": "^24.3.0",
|
|
98
|
+
"@types/react": "^18.0.26",
|
|
99
|
+
"@types/react-addons-linked-state-mixin": "^0.14.22",
|
|
100
|
+
"@typescript-eslint/eslint-plugin": "^6.1.0",
|
|
101
|
+
"@typescript-eslint/parser": "^6.1.0",
|
|
102
|
+
"css-loader": "^6.7.1",
|
|
103
|
+
"eslint": "^8.36.0",
|
|
104
|
+
"eslint-config-prettier": "^8.8.0",
|
|
105
|
+
"eslint-plugin-prettier": "^5.0.0",
|
|
106
|
+
"npm-run-all2": "^7.0.1",
|
|
107
|
+
"prettier": "^3.0.0",
|
|
108
|
+
"rimraf": "^5.0.1",
|
|
109
|
+
"source-map-loader": "^1.0.2",
|
|
110
|
+
"style-loader": "^3.3.1",
|
|
111
|
+
"stylelint": "^15.10.1",
|
|
112
|
+
"stylelint-config-recommended": "^13.0.0",
|
|
113
|
+
"stylelint-config-standard": "^34.0.0",
|
|
114
|
+
"stylelint-csstree-validator": "^3.0.0",
|
|
115
|
+
"stylelint-prettier": "^4.0.0",
|
|
116
|
+
"typescript": "~5.8.0",
|
|
117
|
+
"yjs": "^13.5.0"
|
|
118
|
+
},
|
|
119
|
+
"sideEffects": [
|
|
120
|
+
"style/*.css",
|
|
121
|
+
"style/index.js"
|
|
122
|
+
],
|
|
123
|
+
"styleModule": "style/index.js",
|
|
124
|
+
"publishConfig": {
|
|
125
|
+
"access": "public"
|
|
126
|
+
},
|
|
127
|
+
"jupyterlab": {
|
|
128
|
+
"extension": true,
|
|
129
|
+
"outputDir": "jupyterlite_ai/labextension",
|
|
130
|
+
"schemaDir": "schema",
|
|
131
|
+
"_build": {
|
|
132
|
+
"load": "static/remoteEntry.2f103c13fd640ab93eb9.js",
|
|
133
|
+
"extension": "./extension",
|
|
134
|
+
"style": "./style"
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"eslintIgnore": [
|
|
138
|
+
"node_modules",
|
|
139
|
+
"dist",
|
|
140
|
+
"coverage",
|
|
141
|
+
"**/*.d.ts",
|
|
142
|
+
"tests",
|
|
143
|
+
"**/__tests__",
|
|
144
|
+
"ui-tests",
|
|
145
|
+
".venv",
|
|
146
|
+
"webpack.config.js"
|
|
147
|
+
],
|
|
148
|
+
"eslintConfig": {
|
|
149
|
+
"extends": [
|
|
150
|
+
"eslint:recommended",
|
|
151
|
+
"plugin:@typescript-eslint/eslint-recommended",
|
|
152
|
+
"plugin:@typescript-eslint/recommended",
|
|
153
|
+
"plugin:prettier/recommended"
|
|
154
|
+
],
|
|
155
|
+
"parser": "@typescript-eslint/parser",
|
|
156
|
+
"parserOptions": {
|
|
157
|
+
"project": "tsconfig.json",
|
|
158
|
+
"sourceType": "module"
|
|
159
|
+
},
|
|
160
|
+
"plugins": [
|
|
161
|
+
"@typescript-eslint"
|
|
162
|
+
],
|
|
163
|
+
"rules": {
|
|
164
|
+
"@typescript-eslint/naming-convention": [
|
|
165
|
+
"error",
|
|
166
|
+
{
|
|
167
|
+
"selector": "interface",
|
|
168
|
+
"format": [
|
|
169
|
+
"PascalCase"
|
|
170
|
+
],
|
|
171
|
+
"custom": {
|
|
172
|
+
"regex": "^I[A-Z]",
|
|
173
|
+
"match": true
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
],
|
|
177
|
+
"@typescript-eslint/no-unused-vars": [
|
|
178
|
+
"warn",
|
|
179
|
+
{
|
|
180
|
+
"args": "none"
|
|
181
|
+
}
|
|
182
|
+
],
|
|
183
|
+
"@typescript-eslint/no-explicit-any": "off",
|
|
184
|
+
"@typescript-eslint/no-namespace": "off",
|
|
185
|
+
"@typescript-eslint/no-use-before-define": "off",
|
|
186
|
+
"@typescript-eslint/quotes": [
|
|
187
|
+
"error",
|
|
188
|
+
"single",
|
|
189
|
+
{
|
|
190
|
+
"avoidEscape": true,
|
|
191
|
+
"allowTemplateLiterals": false
|
|
192
|
+
}
|
|
193
|
+
],
|
|
194
|
+
"curly": [
|
|
195
|
+
"error",
|
|
196
|
+
"all"
|
|
197
|
+
],
|
|
198
|
+
"eqeqeq": "error",
|
|
199
|
+
"prefer-arrow-callback": "error",
|
|
200
|
+
"no-restricted-imports": [
|
|
201
|
+
"error",
|
|
202
|
+
{
|
|
203
|
+
"paths": [
|
|
204
|
+
{
|
|
205
|
+
"name": "@mui/icons-material",
|
|
206
|
+
"message": "Please import icons using path imports, e.g. `import AddIcon from '@mui/icons-material/Add'`"
|
|
207
|
+
}
|
|
208
|
+
],
|
|
209
|
+
"patterns": [
|
|
210
|
+
{
|
|
211
|
+
"group": [
|
|
212
|
+
"@mui/*/*/*"
|
|
213
|
+
],
|
|
214
|
+
"message": "3rd level imports in mui are considered private"
|
|
215
|
+
}
|
|
216
|
+
]
|
|
217
|
+
}
|
|
218
|
+
]
|
|
219
|
+
}
|
|
220
|
+
},
|
|
221
|
+
"prettier": {
|
|
222
|
+
"singleQuote": true,
|
|
223
|
+
"trailingComma": "none",
|
|
224
|
+
"arrowParens": "avoid",
|
|
225
|
+
"endOfLine": "auto",
|
|
226
|
+
"overrides": [
|
|
227
|
+
{
|
|
228
|
+
"files": "package.json",
|
|
229
|
+
"options": {
|
|
230
|
+
"tabWidth": 4
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
]
|
|
234
|
+
},
|
|
235
|
+
"stylelint": {
|
|
236
|
+
"extends": [
|
|
237
|
+
"stylelint-config-recommended",
|
|
238
|
+
"stylelint-config-standard",
|
|
239
|
+
"stylelint-prettier/recommended"
|
|
240
|
+
],
|
|
241
|
+
"plugins": [
|
|
242
|
+
"stylelint-csstree-validator"
|
|
243
|
+
],
|
|
244
|
+
"rules": {
|
|
245
|
+
"csstree/validator": true,
|
|
246
|
+
"property-no-vendor-prefix": null,
|
|
247
|
+
"selector-class-pattern": "^([a-z][A-z\\d]*)(-[A-z\\d]+)*$|^Mui[A-Z]",
|
|
248
|
+
"selector-no-vendor-prefix": null,
|
|
249
|
+
"value-no-vendor-prefix": null
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
package/static/dist/_output/extensions/@jupyterlite/ai/schemas/@jupyterlite/ai/settings-model.json
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
{
|
|
2
|
+
"jupyter.lab.shortcuts": [],
|
|
3
|
+
"title": "JupyterLite AI Settings",
|
|
4
|
+
"description": "Configuration for JupyterLite AI extension providers, models, and behavior",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"useSecretsManager": {
|
|
8
|
+
"type": "boolean",
|
|
9
|
+
"title": "Use secrets manager",
|
|
10
|
+
"description": "Whether to use or not the secrets manager. If not, secrets will be stored in plain text in settings",
|
|
11
|
+
"default": true
|
|
12
|
+
},
|
|
13
|
+
"providers": {
|
|
14
|
+
"title": "AI Providers",
|
|
15
|
+
"description": "List of configured AI providers",
|
|
16
|
+
"type": "array",
|
|
17
|
+
"items": {
|
|
18
|
+
"type": "object",
|
|
19
|
+
"properties": {
|
|
20
|
+
"id": { "type": "string" },
|
|
21
|
+
"name": { "type": "string" },
|
|
22
|
+
"provider": {
|
|
23
|
+
"type": "string",
|
|
24
|
+
"description": "Provider identifier"
|
|
25
|
+
},
|
|
26
|
+
"model": { "type": "string" },
|
|
27
|
+
"apiKey": { "type": "string" },
|
|
28
|
+
"baseURL": { "type": "string" },
|
|
29
|
+
"headers": {
|
|
30
|
+
"type": "object",
|
|
31
|
+
"additionalProperties": { "type": "string" }
|
|
32
|
+
},
|
|
33
|
+
"parameters": {
|
|
34
|
+
"type": "object",
|
|
35
|
+
"description": "Provider-specific parameters",
|
|
36
|
+
"properties": {
|
|
37
|
+
"temperature": {
|
|
38
|
+
"type": "number",
|
|
39
|
+
"description": "Temperature (0.0 = deterministic, 2.0 = very creative)",
|
|
40
|
+
"minimum": 0,
|
|
41
|
+
"maximum": 2,
|
|
42
|
+
"default": 0.7
|
|
43
|
+
},
|
|
44
|
+
"maxTokens": {
|
|
45
|
+
"type": "number",
|
|
46
|
+
"description": "Maximum tokens for chat responses",
|
|
47
|
+
"minimum": 1
|
|
48
|
+
},
|
|
49
|
+
"maxTurns": {
|
|
50
|
+
"type": "number",
|
|
51
|
+
"description": "Maximum number of tool execution turns",
|
|
52
|
+
"minimum": 1,
|
|
53
|
+
"maximum": 100,
|
|
54
|
+
"default": 25
|
|
55
|
+
},
|
|
56
|
+
"supportsFillInMiddle": {
|
|
57
|
+
"type": "boolean",
|
|
58
|
+
"description": "Whether the model supports fill-in-middle completion"
|
|
59
|
+
},
|
|
60
|
+
"useFilterText": {
|
|
61
|
+
"type": "boolean",
|
|
62
|
+
"description": "Whether to use filter text for completions"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"customSettings": {
|
|
67
|
+
"type": "object",
|
|
68
|
+
"additionalProperties": true
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"required": ["id", "name", "provider", "model"],
|
|
72
|
+
"additionalProperties": true
|
|
73
|
+
},
|
|
74
|
+
"default": []
|
|
75
|
+
},
|
|
76
|
+
"defaultProvider": {
|
|
77
|
+
"title": "Default Chat Provider",
|
|
78
|
+
"description": "ID of the default provider to use for chat",
|
|
79
|
+
"type": "string",
|
|
80
|
+
"default": ""
|
|
81
|
+
},
|
|
82
|
+
"activeCompleterProvider": {
|
|
83
|
+
"title": "Active Completion Provider",
|
|
84
|
+
"description": "ID of the provider to use for completions (if different from chat)",
|
|
85
|
+
"type": "string"
|
|
86
|
+
},
|
|
87
|
+
"useSameProviderForChatAndCompleter": {
|
|
88
|
+
"title": "Use Same Provider",
|
|
89
|
+
"description": "Use the same provider for both chat and completions",
|
|
90
|
+
"type": "boolean",
|
|
91
|
+
"default": true
|
|
92
|
+
},
|
|
93
|
+
"mcpServers": {
|
|
94
|
+
"title": "MCP Servers",
|
|
95
|
+
"description": "Model Context Protocol servers configuration",
|
|
96
|
+
"type": "array",
|
|
97
|
+
"items": {
|
|
98
|
+
"type": "object",
|
|
99
|
+
"properties": {
|
|
100
|
+
"id": { "type": "string" },
|
|
101
|
+
"name": { "type": "string" },
|
|
102
|
+
"url": { "type": "string" },
|
|
103
|
+
"enabled": { "type": "boolean" }
|
|
104
|
+
},
|
|
105
|
+
"required": ["id", "name", "url", "enabled"],
|
|
106
|
+
"additionalProperties": true
|
|
107
|
+
},
|
|
108
|
+
"default": []
|
|
109
|
+
},
|
|
110
|
+
"contextAwareness": {
|
|
111
|
+
"title": "Context Awareness",
|
|
112
|
+
"description": "Enable context-aware responses",
|
|
113
|
+
"type": "boolean",
|
|
114
|
+
"default": true
|
|
115
|
+
},
|
|
116
|
+
"codeExecution": {
|
|
117
|
+
"title": "Code Execution",
|
|
118
|
+
"description": "Enable code execution capabilities",
|
|
119
|
+
"type": "boolean",
|
|
120
|
+
"default": false
|
|
121
|
+
},
|
|
122
|
+
"toolsEnabled": {
|
|
123
|
+
"title": "Tools Enabled",
|
|
124
|
+
"description": "Allow AI to use tools like notebook operations and file management",
|
|
125
|
+
"type": "boolean",
|
|
126
|
+
"default": true
|
|
127
|
+
},
|
|
128
|
+
"sendWithShiftEnter": {
|
|
129
|
+
"title": "Send with Shift+Enter",
|
|
130
|
+
"description": "Use Shift+Enter to send messages (Enter creates new line)",
|
|
131
|
+
"type": "boolean",
|
|
132
|
+
"default": false
|
|
133
|
+
},
|
|
134
|
+
"showTokenUsage": {
|
|
135
|
+
"title": "Show Token Usage",
|
|
136
|
+
"description": "Display token usage information in the chat toolbar",
|
|
137
|
+
"type": "boolean",
|
|
138
|
+
"default": false
|
|
139
|
+
},
|
|
140
|
+
"commandsRequiringApproval": {
|
|
141
|
+
"title": "Commands Requiring Approval",
|
|
142
|
+
"description": "List of commands that require user approval before AI can execute them",
|
|
143
|
+
"type": "array",
|
|
144
|
+
"items": { "type": "string" },
|
|
145
|
+
"default": [
|
|
146
|
+
"notebook:restart-run-all",
|
|
147
|
+
"notebook:run-cell",
|
|
148
|
+
"notebook:run-cell-and-select-next",
|
|
149
|
+
"notebook:run-cell-and-insert-below",
|
|
150
|
+
"notebook:run-all-cells",
|
|
151
|
+
"notebook:run-all-above",
|
|
152
|
+
"notebook:run-all-below",
|
|
153
|
+
"console:execute",
|
|
154
|
+
"console:execute-forced",
|
|
155
|
+
"fileeditor:run-code",
|
|
156
|
+
"kernelmenu:run",
|
|
157
|
+
"kernelmenu:restart-and-run-all",
|
|
158
|
+
"runmenu:run-all"
|
|
159
|
+
]
|
|
160
|
+
},
|
|
161
|
+
"systemPrompt": {
|
|
162
|
+
"title": "System Prompt",
|
|
163
|
+
"description": "Instructions that define how the AI should behave and respond",
|
|
164
|
+
"type": "string",
|
|
165
|
+
"default": "You are Jupyternaut, an AI coding assistant built specifically for the JupyterLab environment.\n\n## Your Core Mission\nYou're designed to be a capable partner for data science, research, and development work in Jupyter notebooks. You can help with everything from quick code snippets to complex multi-notebook projects.\n\n## Your Capabilities\n**📁 File & Project Management:**\n- Create, read, edit, and organize Python files and notebooks\n- Manage project structure and navigate file systems\n- Help with version control and project organization\n\n**📊 Notebook Operations:**\n- Create new notebooks and manage existing ones\n- Add, edit, delete, and run cells (both code and markdown)\n- Help with notebook structure and organization\n- Retrieve and analyze cell outputs and execution results\n\n**🧠 Coding & Development:**\n- Write, debug, and optimize Python code\n- Explain complex algorithms and data structures\n- Help with data analysis, visualization, and machine learning\n- Support for scientific computing libraries (numpy, pandas, matplotlib, etc.)\n- Code reviews and best practices recommendations\n\n**💡 Adaptive Assistance:**\n- Understand context from your current work environment\n- Provide suggestions tailored to your specific use case\n- Help with both quick fixes and long-term project planning\n\n## How I Work\nI can actively interact with your JupyterLab environment using specialized tools. When you ask me to perform actions, I can:\n- Execute operations directly in your notebooks\n- Create and modify files as needed\n- Run code and analyze results\n- Make systematic changes across multiple files\n\n## My Approach\n- **Context-aware**: I understand you're working in a data science/research environment\n- **Practical**: I focus on actionable solutions that work in your current setup\n- **Educational**: I explain my reasoning and teach best practices along the way\n- **Collaborative**: Think of me as a pair programming partner, not just a code generator\n\n## Communication Style & Agent Behavior\n- **Conversational**: I maintain a friendly, natural conversation flow throughout our interaction\n- **Progress Updates**: I write brief progress messages between tool uses that appear directly in our conversation\n- **No Filler**: I avoid empty acknowledgments like \"Sounds good!\" or \"Okay, I will...\" - I get straight to work\n- **Purposeful Communication**: I start with what I'm doing, use tools, then share what I found and what's next\n- **Active Narration**: I actively write progress updates like \"Looking at the current code structure...\" or \"Found the issue in the notebook...\" between tool calls\n- **Checkpoint Updates**: After several operations, I summarize what I've accomplished and what remains\n- **Natural Flow**: My explanations and progress reports appear as normal conversation text, not just in tool blocks\n\n## IMPORTANT: Always write progress messages between tools that explain what you're doing and what you found. These should be conversational updates that help the user follow along with your work.\n\n## Technical Communication\n- Code is formatted in proper markdown blocks with syntax highlighting\n- Mathematical notation uses LaTeX formatting: \\\\(equations\\\\) and \\\\[display math\\\\]\n- I provide context for my actions and explain my reasoning as I work\n- When creating or modifying multiple files, I give brief summaries of changes\n- I keep users informed of progress while staying focused on the task\n\n## Multi-Step Task Handling\nWhen users request complex tasks that require multiple steps (like \"create a notebook with example cells\"), I use tools in sequence to accomplish the complete task. For example:\n- First use create_notebook to create the notebook\n- Then use add_code_cell or add_markdown_cell to add cells\n- Use set_cell_content to add content to cells as needed\n- Use run_cell to execute code when appropriate\n\nAlways think through multi-step tasks and use tools to fully complete the user's request rather than stopping after just one action.\n\nReady to help you build something great! What are you working on?"
|
|
166
|
+
},
|
|
167
|
+
"completionSystemPrompt": {
|
|
168
|
+
"title": "Completion System Prompt",
|
|
169
|
+
"description": "Instructions that define how the AI should generate code completions",
|
|
170
|
+
"type": "string",
|
|
171
|
+
"default": "You are an AI code completion assistant. Complete the given code fragment with appropriate code.\nRules:\n- Return only the completion text, no explanations or comments\n- Do not include code block markers (``` or similar)\n- Make completions contextually relevant to the surrounding code and notebook context\n- Follow the language-specific conventions and style guidelines for the detected programming language\n- Keep completions concise but functional\n- Do not repeat the existing code that comes before the cursor\n- Use variables, imports, functions, and other definitions from previous notebook cells when relevant"
|
|
172
|
+
},
|
|
173
|
+
"showCellDiff": {
|
|
174
|
+
"title": "Show Cell Diff",
|
|
175
|
+
"description": "Show diff view when AI modifies cell content",
|
|
176
|
+
"type": "boolean",
|
|
177
|
+
"default": true
|
|
178
|
+
},
|
|
179
|
+
"showFileDiff": {
|
|
180
|
+
"title": "Show File Diff",
|
|
181
|
+
"description": "Show diff view when AI modifies file content",
|
|
182
|
+
"type": "boolean",
|
|
183
|
+
"default": true
|
|
184
|
+
},
|
|
185
|
+
"diffDisplayMode": {
|
|
186
|
+
"title": "Diff Display Mode",
|
|
187
|
+
"description": "How to display cell diffs (split or unified view)",
|
|
188
|
+
"type": "string",
|
|
189
|
+
"enum": ["split", "unified"],
|
|
190
|
+
"default": "split"
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
"additionalProperties": false
|
|
194
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_jupyterlite_ai=self.webpackChunk_jupyterlite_ai||[]).push([[116],{116:(e,t,r)=>{r.d(t,{asSchema:()=>Ye,combineHeaders:()=>c,convertBase64ToUint8Array:()=>Me,convertToBase64:()=>He,convertUint8ArrayToBase64:()=>Ve,createBinaryResponseHandler:()=>ee,createEventSourceResponseHandler:()=>Q,createIdGenerator:()=>h,createJsonErrorResponseHandler:()=>G,createJsonResponseHandler:()=>X,createProviderDefinedToolFactory:()=>J,createProviderDefinedToolFactoryWithOutputSchema:()=>K,delay:()=>l,dynamicTool:()=>D,executeTool:()=>Fe,generateId:()=>y,getErrorMessage:()=>v,getFromApi:()=>S,getRuntimeEnvironmentUserAgent:()=>p,injectJsonInstructionIntoMessages:()=>O,isAbortError:()=>g,isParsableJson:()=>M,isUrlSupported:()=>Z,jsonSchema:()=>Ne,loadApiKey:()=>T,loadOptionalSetting:()=>$,mediaTypeToExtension:()=>j,parseJsonEventStream:()=>V,parseProviderOptions:()=>H,postFormDataToApi:()=>C,postJsonToApi:()=>F,resolve:()=>W,safeParseJSON:()=>R,safeValidateTypes:()=>B,tool:()=>U,validateTypes:()=>Y,withUserAgentSuffix:()=>m,withoutTrailingSlash:()=>ze,zodSchema:()=>Ie});var n=r(2100),a=r(1408),s=r(6190),o=r(6019),i=r(2665),u=r(5606);function c(...e){return e.reduce((e,t)=>({...e,...null!=t?t:{}}),{})}async function l(e,t){if(null==e)return Promise.resolve();const r=null==t?void 0:t.abortSignal;return new Promise((t,n)=>{if(null==r?void 0:r.aborted)return void n(d());const a=setTimeout(()=>{s(),t()},e),s=()=>{clearTimeout(a),null==r||r.removeEventListener("abort",o)},o=()=>{s(),n(d())};null==r||r.addEventListener("abort",o)})}function d(){return new DOMException("Delay was aborted","AbortError")}function f(e){return Object.fromEntries([...e.headers])}function p(e=globalThis){var t,r,n;return e.window?"runtime/browser":(null==(t=e.navigator)?void 0:t.userAgent)?`runtime/${e.navigator.userAgent.toLowerCase()}`:(null==(n=null==(r=e.process)?void 0:r.versions)?void 0:n.node)?`runtime/node.js/${e.process.version.substring(0)}`:e.EdgeRuntime?"runtime/vercel-edge":"runtime/unknown"}function m(e,...t){const r=(n=null!=e?e:{},Object.fromEntries(Object.entries(n).filter(([e,t])=>null!=t)));var n;const a=new Headers(r),s=a.get("user-agent")||"";return a.set("user-agent",[s,...t].filter(Boolean).join(" ")),Object.fromEntries(a)}var h=({prefix:e,size:t=16,alphabet:r="0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",separator:a="-"}={})=>{const s=()=>{const e=r.length,n=new Array(t);for(let a=0;a<t;a++)n[a]=r[Math.random()*e|0];return n.join("")};if(null==e)return s;if(r.includes(a))throw new n.Di({argument:"separator",message:`The separator "${a}" must not be part of the alphabet "${r}".`});return()=>`${e}${a}${s()}`},y=h();function v(e){return null==e?"unknown error":"string"==typeof e?e:e instanceof Error?e.message:JSON.stringify(e)}function g(e){return(e instanceof Error||e instanceof DOMException)&&("AbortError"===e.name||"ResponseAborted"===e.name||"TimeoutError"===e.name)}var b=["fetch failed","failed to fetch"];function w({error:e,url:t,requestBodyValues:r}){if(g(e))return e;if(e instanceof TypeError&&b.includes(e.message.toLowerCase())){const a=e.cause;if(null!=a)return new n.hL({message:`Cannot connect to API: ${a.message}`,cause:a,url:t,requestBodyValues:r,isRetryable:!0})}return e}var k="3.0.10",P=()=>globalThis.fetch,S=async({url:e,headers:t={},successfulResponseHandler:r,failedResponseHandler:a,abortSignal:s,fetch:o=P()})=>{try{const i=await o(e,{method:"GET",headers:m(t,`ai-sdk/provider-utils/${k}`,p()),signal:s}),u=f(i);if(!i.ok){let t;try{t=await a({response:i,url:e,requestBodyValues:{}})}catch(t){if(g(t)||n.hL.isInstance(t))throw t;throw new n.hL({message:"Failed to process error response",cause:t,statusCode:i.status,url:e,responseHeaders:u,requestBodyValues:{}})}throw t.value}try{return await r({response:i,url:e,requestBodyValues:{}})}catch(t){if(t instanceof Error&&(g(t)||n.hL.isInstance(t)))throw t;throw new n.hL({message:"Failed to process successful response",cause:t,statusCode:i.status,url:e,responseHeaders:u,requestBodyValues:{}})}}catch(t){throw w({error:t,url:e,requestBodyValues:{}})}},x="JSON schema:",A="You MUST answer with a JSON object that matches the JSON schema above.",_="You MUST answer with JSON.";function O({messages:e,schema:t,schemaPrefix:r,schemaSuffix:n}){var a,s;const o="system"===(null==(a=e[0])?void 0:a.role)?{...e[0]}:{role:"system",content:""};return o.content=function({prompt:e,schema:t,schemaPrefix:r=(null!=t?x:void 0),schemaSuffix:n=(null!=t?A:_)}){return[null!=e&&e.length>0?e:void 0,null!=e&&e.length>0?"":void 0,r,null!=t?JSON.stringify(t):void 0,n].filter(e=>null!=e).join("\n")}({prompt:o.content,schema:t,schemaPrefix:r,schemaSuffix:n}),[o,..."system"===(null==(s=e[0])?void 0:s.role)?e.slice(1):e]}function Z({mediaType:e,url:t,supportedUrls:r}){return t=t.toLowerCase(),e=e.toLowerCase(),Object.entries(r).map(([e,t])=>{const r=e.toLowerCase();return"*"===r||"*/*"===r?{mediaTypePrefix:"",regexes:t}:{mediaTypePrefix:r.replace(/\*/,""),regexes:t}}).filter(({mediaTypePrefix:t})=>e.startsWith(t)).flatMap(({regexes:e})=>e).some(e=>e.test(t))}function T({apiKey:e,environmentVariableName:t,apiKeyParameterName:r="apiKey",description:a}){if("string"==typeof e)return e;if(null!=e)throw new n.Kq({message:`${a} API key must be a string.`});if(void 0===u)throw new n.Kq({message:`${a} API key is missing. Pass it using the '${r}' parameter. Environment variables is not supported in this environment.`});if(null==(e=u.env[t]))throw new n.Kq({message:`${a} API key is missing. Pass it using the '${r}' parameter or the ${t} environment variable.`});if("string"!=typeof e)throw new n.Kq({message:`${a} API key must be a string. The value of the ${t} environment variable is not a string.`});return e}function $({settingValue:e,environmentVariableName:t}){return"string"==typeof e||null==e&&void 0!==u&&null!=(e=u.env[t])&&"string"==typeof e?e:void 0}function j(e){var t;const[r,n=""]=e.toLowerCase().split("/");return null!=(t={mpeg:"mp3","x-wav":"wav",opus:"ogg",mp4:"m4a","x-m4a":"m4a"}[n])?t:n}var L=/"__proto__"\s*:/,I=/"constructor"\s*:/;function E(e){const{stackTraceLimit:t}=Error;Error.stackTraceLimit=0;try{return function(e){const t=JSON.parse(e);return null===t||"object"!=typeof t||!1===L.test(e)&&!1===I.test(e)?t:function(e){let t=[e];for(;t.length;){const e=t;t=[];for(const r of e){if(Object.prototype.hasOwnProperty.call(r,"__proto__"))throw new SyntaxError("Object contains forbidden prototype property");if(Object.prototype.hasOwnProperty.call(r,"constructor")&&Object.prototype.hasOwnProperty.call(r.constructor,"prototype"))throw new SyntaxError("Object contains forbidden prototype property");for(const e in r){const n=r[e];n&&"object"==typeof n&&t.push(n)}}}return e}(t)}(e)}finally{Error.stackTraceLimit=t}}var N=Symbol.for("vercel.ai.validator");async function Y({value:e,schema:t}){const r=await B({value:e,schema:t});if(!r.success)throw n.iM.wrap({value:e,cause:r.error});return r.value}async function B({value:e,schema:t}){const r=function(e){return function(e){return"object"==typeof e&&null!==e&&N in e&&!0===e[N]&&"validate"in e}(e)?e:(t=e,r=async e=>{const r=await t["~standard"].validate(e);return null==r.issues?{success:!0,value:r.value}:{success:!1,error:new n.iM({value:e,cause:r.issues})}},{[N]:!0,validate:r});var t,r}(t);try{if(null==r.validate)return{success:!0,value:e,rawValue:e};const t=await r.validate(e);return t.success?{success:!0,value:t.value,rawValue:e}:{success:!1,error:n.iM.wrap({value:e,cause:t.error}),rawValue:e}}catch(t){return{success:!1,error:n.iM.wrap({value:e,cause:t}),rawValue:e}}}async function R({text:e,schema:t}){try{const r=E(e);return null==t?{success:!0,value:r,rawValue:r}:await B({value:r,schema:t})}catch(t){return{success:!1,error:n.u6.isInstance(t)?t:new n.u6({text:e,cause:t}),rawValue:void 0}}}function M(e){try{return E(e),!0}catch(e){return!1}}function V({stream:e,schema:t}){return e.pipeThrough(new TextDecoderStream).pipeThrough(new a.Z).pipeThrough(new TransformStream({async transform({data:e},r){"[DONE]"!==e&&r.enqueue(await R({text:e,schema:t}))}}))}async function H({provider:e,providerOptions:t,schema:r}){if(null==(null==t?void 0:t[e]))return;const a=await B({value:t[e],schema:r});if(!a.success)throw new n.Di({argument:"providerOptions",message:`invalid ${e} provider options`,cause:a.error});return a.value}var z=()=>globalThis.fetch,F=async({url:e,headers:t,body:r,failedResponseHandler:n,successfulResponseHandler:a,abortSignal:s,fetch:o})=>q({url:e,headers:{"Content-Type":"application/json",...t},body:{content:JSON.stringify(r),values:r},failedResponseHandler:n,successfulResponseHandler:a,abortSignal:s,fetch:o}),C=async({url:e,headers:t,formData:r,failedResponseHandler:n,successfulResponseHandler:a,abortSignal:s,fetch:o})=>q({url:e,headers:t,body:{content:r,values:Object.fromEntries(r.entries())},failedResponseHandler:n,successfulResponseHandler:a,abortSignal:s,fetch:o}),q=async({url:e,headers:t={},body:r,successfulResponseHandler:a,failedResponseHandler:s,abortSignal:o,fetch:i=z()})=>{try{const u=await i(e,{method:"POST",headers:m(t,`ai-sdk/provider-utils/${k}`,p()),body:r.content,signal:o}),c=f(u);if(!u.ok){let t;try{t=await s({response:u,url:e,requestBodyValues:r.values})}catch(t){if(g(t)||n.hL.isInstance(t))throw t;throw new n.hL({message:"Failed to process error response",cause:t,statusCode:u.status,url:e,responseHeaders:c,requestBodyValues:r.values})}throw t.value}try{return await a({response:u,url:e,requestBodyValues:r.values})}catch(t){if(t instanceof Error&&(g(t)||n.hL.isInstance(t)))throw t;throw new n.hL({message:"Failed to process successful response",cause:t,statusCode:u.status,url:e,responseHeaders:c,requestBodyValues:r.values})}}catch(t){throw w({error:t,url:e,requestBodyValues:r.values})}};function U(e){return e}function D(e){return{...e,type:"dynamic"}}function J({id:e,name:t,inputSchema:r}){return({execute:n,outputSchema:a,toModelOutput:s,onInputStart:o,onInputDelta:i,onInputAvailable:u,...c})=>({type:"provider-defined",id:e,name:t,args:c,inputSchema:r,outputSchema:a,execute:n,toModelOutput:s,onInputStart:o,onInputDelta:i,onInputAvailable:u})}function K({id:e,name:t,inputSchema:r,outputSchema:n}){return({execute:a,toModelOutput:s,onInputStart:o,onInputDelta:i,onInputAvailable:u,...c})=>({type:"provider-defined",id:e,name:t,args:c,inputSchema:r,outputSchema:n,execute:a,toModelOutput:s,onInputStart:o,onInputDelta:i,onInputAvailable:u})}async function W(e){return"function"==typeof e&&(e=e()),Promise.resolve(e)}var G=({errorSchema:e,errorToMessage:t,isRetryable:r})=>async({response:a,url:s,requestBodyValues:o})=>{const i=await a.text(),u=f(a);if(""===i.trim())return{responseHeaders:u,value:new n.hL({message:a.statusText,url:s,requestBodyValues:o,statusCode:a.status,responseHeaders:u,responseBody:i,isRetryable:null==r?void 0:r(a)})};try{const c=await async function({text:e,schema:t}){try{const r=E(e);return null==t?r:Y({value:r,schema:t})}catch(t){if(n.u6.isInstance(t)||n.iM.isInstance(t))throw t;throw new n.u6({text:e,cause:t})}}({text:i,schema:e});return{responseHeaders:u,value:new n.hL({message:t(c),url:s,requestBodyValues:o,statusCode:a.status,responseHeaders:u,responseBody:i,data:c,isRetryable:null==r?void 0:r(a,c)})}}catch(e){return{responseHeaders:u,value:new n.hL({message:a.statusText,url:s,requestBodyValues:o,statusCode:a.status,responseHeaders:u,responseBody:i,isRetryable:null==r?void 0:r(a)})}}},Q=e=>async({response:t})=>{const r=f(t);if(null==t.body)throw new n.Tt({});return{responseHeaders:r,value:V({stream:t.body,schema:e})}},X=e=>async({response:t,url:r,requestBodyValues:a})=>{const s=await t.text(),o=await R({text:s,schema:e}),i=f(t);if(!o.success)throw new n.hL({message:"Invalid JSON response",cause:o.error,statusCode:t.status,responseHeaders:i,responseBody:s,url:r,requestBodyValues:a});return{responseHeaders:i,value:o.value,rawValue:o.rawValue}},ee=()=>async({response:e,url:t,requestBodyValues:r})=>{const a=f(e);if(!e.body)throw new n.hL({message:"Response body is empty",url:t,requestBodyValues:r,statusCode:e.status,responseHeaders:a,responseBody:void 0});try{const t=await e.arrayBuffer();return{responseHeaders:a,value:new Uint8Array(t)}}catch(s){throw new n.hL({message:"Failed to read response as array buffer",url:t,requestBodyValues:r,statusCode:e.status,responseHeaders:a,responseBody:void 0,cause:s})}},te=(e,t)=>{let r=0;for(;r<e.length&&r<t.length&&e[r]===t[r];r++);return[(e.length-r).toString(),...t.slice(r)].join("/")},re=Symbol("Let zodToJsonSchema decide on which parser to use"),ne={name:void 0,$refStrategy:"root",basePath:["#"],effectStrategy:"input",pipeStrategy:"all",dateStrategy:"format:date-time",mapStrategy:"entries",removeAdditionalStrategy:"passthrough",allowedAdditionalProperties:!0,rejectedAdditionalProperties:!1,definitionPath:"definitions",strictUnions:!1,definitions:{},errorMessages:!1,patternStrategy:"escape",applyRegexFlags:!1,emailStrategy:"format:email",base64Strategy:"contentEncoding:base64",nameStrategy:"ref"};function ae(e,t){return Te(e.type._def,t)}function se(e,t,r){const n=null!=r?r:t.dateStrategy;if(Array.isArray(n))return{anyOf:n.map((r,n)=>se(e,t,r))};switch(n){case"string":case"format:date-time":return{type:"string",format:"date-time"};case"format:date":return{type:"string",format:"date"};case"integer":return oe(e)}}var oe=e=>{const t={type:"integer",format:"unix-time"};for(const r of e.checks)switch(r.kind){case"min":t.minimum=r.value;break;case"max":t.maximum=r.value}return t},ie=void 0,ue=/^[cC][^\s-]{8,}$/,ce=/^[0-9a-z]+$/,le=/^[0-9A-HJKMNP-TV-Z]{26}$/,de=/^(?!\.)(?!.*\.\.)([a-zA-Z0-9_'+\-\.]*)[a-zA-Z0-9_+-]@([a-zA-Z0-9][a-zA-Z0-9\-]*\.)+[a-zA-Z]{2,}$/,fe=()=>(void 0===ie&&(ie=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),ie),pe=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,me=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,he=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,ye=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,ve=/^[a-zA-Z0-9_-]{21}$/,ge=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/;function be(e,t){const r={type:"string"};if(e.checks)for(const n of e.checks)switch(n.kind){case"min":r.minLength="number"==typeof r.minLength?Math.max(r.minLength,n.value):n.value;break;case"max":r.maxLength="number"==typeof r.maxLength?Math.min(r.maxLength,n.value):n.value;break;case"email":switch(t.emailStrategy){case"format:email":Pe(r,"email",n.message,t);break;case"format:idn-email":Pe(r,"idn-email",n.message,t);break;case"pattern:zod":Se(r,de,n.message,t)}break;case"url":Pe(r,"uri",n.message,t);break;case"uuid":Pe(r,"uuid",n.message,t);break;case"regex":Se(r,n.regex,n.message,t);break;case"cuid":Se(r,ue,n.message,t);break;case"cuid2":Se(r,ce,n.message,t);break;case"startsWith":Se(r,RegExp(`^${we(n.value,t)}`),n.message,t);break;case"endsWith":Se(r,RegExp(`${we(n.value,t)}$`),n.message,t);break;case"datetime":Pe(r,"date-time",n.message,t);break;case"date":Pe(r,"date",n.message,t);break;case"time":Pe(r,"time",n.message,t);break;case"duration":Pe(r,"duration",n.message,t);break;case"length":r.minLength="number"==typeof r.minLength?Math.max(r.minLength,n.value):n.value,r.maxLength="number"==typeof r.maxLength?Math.min(r.maxLength,n.value):n.value;break;case"includes":Se(r,RegExp(we(n.value,t)),n.message,t);break;case"ip":"v6"!==n.version&&Pe(r,"ipv4",n.message,t),"v4"!==n.version&&Pe(r,"ipv6",n.message,t);break;case"base64url":Se(r,ye,n.message,t);break;case"jwt":Se(r,ge,n.message,t);break;case"cidr":"v6"!==n.version&&Se(r,pe,n.message,t),"v4"!==n.version&&Se(r,me,n.message,t);break;case"emoji":Se(r,fe(),n.message,t);break;case"ulid":Se(r,le,n.message,t);break;case"base64":switch(t.base64Strategy){case"format:binary":Pe(r,"binary",n.message,t);break;case"contentEncoding:base64":r.contentEncoding="base64";break;case"pattern:zod":Se(r,he,n.message,t)}break;case"nanoid":Se(r,ve,n.message,t)}return r}function we(e,t){return"escape"===t.patternStrategy?function(e){let t="";for(let r=0;r<e.length;r++)ke.has(e[r])||(t+="\\"),t+=e[r];return t}(e):e}var ke=new Set("ABCDEFGHIJKLMNOPQRSTUVXYZabcdefghijklmnopqrstuvxyz0123456789");function Pe(e,t,r,n){var a;e.format||(null==(a=e.anyOf)?void 0:a.some(e=>e.format))?(e.anyOf||(e.anyOf=[]),e.format&&(e.anyOf.push({format:e.format}),delete e.format),e.anyOf.push({format:t,...r&&n.errorMessages&&{errorMessage:{format:r}}})):e.format=t}function Se(e,t,r,n){var a;e.pattern||(null==(a=e.allOf)?void 0:a.some(e=>e.pattern))?(e.allOf||(e.allOf=[]),e.pattern&&(e.allOf.push({pattern:e.pattern}),delete e.pattern),e.allOf.push({pattern:xe(t,n),...r&&n.errorMessages&&{errorMessage:{pattern:r}}})):e.pattern=xe(t,n)}function xe(e,t){var r;if(!t.applyRegexFlags||!e.flags)return e.source;const n=e.flags.includes("i"),a=e.flags.includes("m"),s=e.flags.includes("s"),o=n?e.source.toLowerCase():e.source;let i="",u=!1,c=!1,l=!1;for(let e=0;e<o.length;e++)if(u)i+=o[e],u=!1;else{if(n)if(c){if(o[e].match(/[a-z]/)){l?(i+=o[e],i+=`${o[e-2]}-${o[e]}`.toUpperCase(),l=!1):"-"===o[e+1]&&(null==(r=o[e+2])?void 0:r.match(/[a-z]/))?(i+=o[e],l=!0):i+=`${o[e]}${o[e].toUpperCase()}`;continue}}else if(o[e].match(/[a-z]/)){i+=`[${o[e]}${o[e].toUpperCase()}]`;continue}if(a){if("^"===o[e]){i+="(^|(?<=[\r\n]))";continue}if("$"===o[e]){i+="($|(?=[\r\n]))";continue}}s&&"."===o[e]?i+=c?`${o[e]}\r\n`:`[${o[e]}\r\n]`:(i+=o[e],"\\"===o[e]?u=!0:c&&"]"===o[e]?c=!1:c||"["!==o[e]||(c=!0))}try{new RegExp(i)}catch(r){return console.warn(`Could not convert regex pattern at ${t.currentPath.join("/")} to a flag-independent form! Falling back to the flag-ignorant source`),e.source}return i}function Ae(e,t){var r,n,a,s,o,u;const c={type:"object",additionalProperties:null!=(r=Te(e.valueType._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]}))?r:t.allowedAdditionalProperties};if((null==(n=e.keyType)?void 0:n._def.typeName)===i.kY.ZodString&&(null==(a=e.keyType._def.checks)?void 0:a.length)){const{type:r,...n}=be(e.keyType._def,t);return{...c,propertyNames:n}}if((null==(s=e.keyType)?void 0:s._def.typeName)===i.kY.ZodEnum)return{...c,propertyNames:{enum:e.keyType._def.values}};if((null==(o=e.keyType)?void 0:o._def.typeName)===i.kY.ZodBranded&&e.keyType._def.type._def.typeName===i.kY.ZodString&&(null==(u=e.keyType._def.type._def.checks)?void 0:u.length)){const{type:r,...n}=ae(e.keyType._def,t);return{...c,propertyNames:n}}return c}var _e={ZodString:"string",ZodNumber:"number",ZodBigInt:"integer",ZodBoolean:"boolean",ZodNull:"null"};function Oe(e){try{return e.isOptional()}catch(e){return!0}}var Ze=(e,t,r)=>{switch(t){case i.kY.ZodString:return be(e,r);case i.kY.ZodNumber:return function(e){const t={type:"number"};if(!e.checks)return t;for(const r of e.checks)switch(r.kind){case"int":t.type="integer";break;case"min":r.inclusive?t.minimum=r.value:t.exclusiveMinimum=r.value;break;case"max":r.inclusive?t.maximum=r.value:t.exclusiveMaximum=r.value;break;case"multipleOf":t.multipleOf=r.value}return t}(e);case i.kY.ZodObject:return function(e,t){const r={type:"object",properties:{}},n=[],a=e.shape();for(const e in a){let s=a[e];if(void 0===s||void 0===s._def)continue;const o=Oe(s),i=Te(s._def,{...t,currentPath:[...t.currentPath,"properties",e],propertyPath:[...t.currentPath,"properties",e]});void 0!==i&&(r.properties[e]=i,o||n.push(e))}n.length&&(r.required=n);const s=function(e,t){if("ZodNever"!==e.catchall._def.typeName)return Te(e.catchall._def,{...t,currentPath:[...t.currentPath,"additionalProperties"]});switch(e.unknownKeys){case"passthrough":return t.allowedAdditionalProperties;case"strict":return t.rejectedAdditionalProperties;case"strip":return"strict"===t.removeAdditionalStrategy?t.allowedAdditionalProperties:t.rejectedAdditionalProperties}}(e,t);return void 0!==s&&(r.additionalProperties=s),r}(e,r);case i.kY.ZodBigInt:return function(e){const t={type:"integer",format:"int64"};if(!e.checks)return t;for(const r of e.checks)switch(r.kind){case"min":r.inclusive?t.minimum=r.value:t.exclusiveMinimum=r.value;break;case"max":r.inclusive?t.maximum=r.value:t.exclusiveMaximum=r.value;break;case"multipleOf":t.multipleOf=r.value}return t}(e);case i.kY.ZodBoolean:return{type:"boolean"};case i.kY.ZodDate:return se(e,r);case i.kY.ZodUndefined:return{not:{}};case i.kY.ZodNull:return{type:"null"};case i.kY.ZodArray:return function(e,t){var r,n,a;const s={type:"array"};return(null==(r=e.type)?void 0:r._def)&&(null==(a=null==(n=e.type)?void 0:n._def)?void 0:a.typeName)!==i.kY.ZodAny&&(s.items=Te(e.type._def,{...t,currentPath:[...t.currentPath,"items"]})),e.minLength&&(s.minItems=e.minLength.value),e.maxLength&&(s.maxItems=e.maxLength.value),e.exactLength&&(s.minItems=e.exactLength.value,s.maxItems=e.exactLength.value),s}(e,r);case i.kY.ZodUnion:case i.kY.ZodDiscriminatedUnion:return function(e,t){const r=e.options instanceof Map?Array.from(e.options.values()):e.options;if(r.every(e=>e._def.typeName in _e&&(!e._def.checks||!e._def.checks.length))){const e=r.reduce((e,t)=>{const r=_e[t._def.typeName];return r&&!e.includes(r)?[...e,r]:e},[]);return{type:e.length>1?e:e[0]}}if(r.every(e=>"ZodLiteral"===e._def.typeName&&!e.description)){const e=r.reduce((e,t)=>{const r=typeof t._def.value;switch(r){case"string":case"number":case"boolean":return[...e,r];case"bigint":return[...e,"integer"];case"object":if(null===t._def.value)return[...e,"null"];default:return e}},[]);if(e.length===r.length){const t=e.filter((e,t,r)=>r.indexOf(e)===t);return{type:t.length>1?t:t[0],enum:r.reduce((e,t)=>e.includes(t._def.value)?e:[...e,t._def.value],[])}}}else if(r.every(e=>"ZodEnum"===e._def.typeName))return{type:"string",enum:r.reduce((e,t)=>[...e,...t._def.values.filter(t=>!e.includes(t))],[])};return((e,t)=>{const r=(e.options instanceof Map?Array.from(e.options.values()):e.options).map((e,r)=>Te(e._def,{...t,currentPath:[...t.currentPath,"anyOf",`${r}`]})).filter(e=>!!e&&(!t.strictUnions||"object"==typeof e&&Object.keys(e).length>0));return r.length?{anyOf:r}:void 0})(e,t)}(e,r);case i.kY.ZodIntersection:return function(e,t){const r=[Te(e.left._def,{...t,currentPath:[...t.currentPath,"allOf","0"]}),Te(e.right._def,{...t,currentPath:[...t.currentPath,"allOf","1"]})].filter(e=>!!e),n=[];return r.forEach(e=>{if("type"in(t=e)&&"string"===t.type||!("allOf"in t)){let t=e;if("additionalProperties"in e&&!1===e.additionalProperties){const{additionalProperties:r,...n}=e;t=n}n.push(t)}else n.push(...e.allOf);var t}),n.length?{allOf:n}:void 0}(e,r);case i.kY.ZodTuple:return function(e,t){return e.rest?{type:"array",minItems:e.items.length,items:e.items.map((e,r)=>Te(e._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[]),additionalItems:Te(e.rest._def,{...t,currentPath:[...t.currentPath,"additionalItems"]})}:{type:"array",minItems:e.items.length,maxItems:e.items.length,items:e.items.map((e,r)=>Te(e._def,{...t,currentPath:[...t.currentPath,"items",`${r}`]})).reduce((e,t)=>void 0===t?e:[...e,t],[])}}(e,r);case i.kY.ZodRecord:return Ae(e,r);case i.kY.ZodLiteral:return function(e){const t=typeof e.value;return"bigint"!==t&&"number"!==t&&"boolean"!==t&&"string"!==t?{type:Array.isArray(e.value)?"array":"object"}:{type:"bigint"===t?"integer":t,const:e.value}}(e);case i.kY.ZodEnum:return function(e){return{type:"string",enum:Array.from(e.values)}}(e);case i.kY.ZodNativeEnum:return function(e){const t=e.values,r=Object.keys(e.values).filter(e=>"number"!=typeof t[t[e]]).map(e=>t[e]),n=Array.from(new Set(r.map(e=>typeof e)));return{type:1===n.length?"string"===n[0]?"string":"number":["string","number"],enum:r}}(e);case i.kY.ZodNullable:return function(e,t){if(["ZodString","ZodNumber","ZodBigInt","ZodBoolean","ZodNull"].includes(e.innerType._def.typeName)&&(!e.innerType._def.checks||!e.innerType._def.checks.length))return{type:[_e[e.innerType._def.typeName],"null"]};const r=Te(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","0"]});return r&&{anyOf:[r,{type:"null"}]}}(e,r);case i.kY.ZodOptional:return((e,t)=>{var r;if(t.currentPath.toString()===(null==(r=t.propertyPath)?void 0:r.toString()))return Te(e.innerType._def,t);const n=Te(e.innerType._def,{...t,currentPath:[...t.currentPath,"anyOf","1"]});return n?{anyOf:[{not:{}},n]}:{}})(e,r);case i.kY.ZodMap:return function(e,t){return"record"===t.mapStrategy?Ae(e,t):{type:"array",maxItems:125,items:{type:"array",items:[Te(e.keyType._def,{...t,currentPath:[...t.currentPath,"items","items","0"]})||{},Te(e.valueType._def,{...t,currentPath:[...t.currentPath,"items","items","1"]})||{}],minItems:2,maxItems:2}}}(e,r);case i.kY.ZodSet:return function(e,t){const r={type:"array",uniqueItems:!0,items:Te(e.valueType._def,{...t,currentPath:[...t.currentPath,"items"]})};return e.minSize&&(r.minItems=e.minSize.value),e.maxSize&&(r.maxItems=e.maxSize.value),r}(e,r);case i.kY.ZodLazy:return()=>e.getter()._def;case i.kY.ZodPromise:return function(e,t){return Te(e.type._def,t)}(e,r);case i.kY.ZodNaN:case i.kY.ZodNever:return{not:{}};case i.kY.ZodEffects:return function(e,t){return"input"===t.effectStrategy?Te(e.schema._def,t):{}}(e,r);case i.kY.ZodAny:case i.kY.ZodUnknown:return{};case i.kY.ZodDefault:return function(e,t){return{...Te(e.innerType._def,t),default:e.defaultValue()}}(e,r);case i.kY.ZodBranded:return ae(e,r);case i.kY.ZodReadonly:case i.kY.ZodCatch:return((e,t)=>Te(e.innerType._def,t))(e,r);case i.kY.ZodPipeline:return((e,t)=>{if("input"===t.pipeStrategy)return Te(e.in._def,t);if("output"===t.pipeStrategy)return Te(e.out._def,t);const r=Te(e.in._def,{...t,currentPath:[...t.currentPath,"allOf","0"]});return{allOf:[r,Te(e.out._def,{...t,currentPath:[...t.currentPath,"allOf",r?"1":"0"]})].filter(e=>void 0!==e)}})(e,r);case i.kY.ZodFunction:case i.kY.ZodVoid:case i.kY.ZodSymbol:default:return}};function Te(e,t,r=!1){var n;const a=t.seen.get(e);if(t.override){const s=null==(n=t.override)?void 0:n.call(t,e,t,a,r);if(s!==re)return s}if(a&&!r){const e=$e(a,t);if(void 0!==e)return e}const s={def:e,path:t.currentPath,jsonSchema:void 0};t.seen.set(e,s);const o=Ze(e,e.typeName,t),i="function"==typeof o?Te(o(),t):o;if(i&&je(e,t,i),t.postProcess){const r=t.postProcess(i,e,t);return s.jsonSchema=i,r}return s.jsonSchema=i,i}var $e=(e,t)=>{switch(t.$refStrategy){case"root":return{$ref:e.path.join("/")};case"relative":return{$ref:te(t.currentPath,e.path)};case"none":case"seen":return e.path.length<t.currentPath.length&&e.path.every((e,r)=>t.currentPath[r]===e)?(console.warn(`Recursive reference detected at ${t.currentPath.join("/")}! Defaulting to any`),{}):"seen"===t.$refStrategy?{}:void 0}},je=(e,t,r)=>(e.description&&(r.description=e.description),r),Le=(e,t)=>{var r;const n=(e=>{const t=(e=>"string"==typeof e?{...ne,name:e}:{...ne,...e})(e),r=void 0!==t.name?[...t.basePath,t.definitionPath,t.name]:t.basePath;return{...t,currentPath:r,propertyPath:void 0,seen:new Map(Object.entries(t.definitions).map(([e,r])=>[r._def,{def:r._def,path:[...t.basePath,t.definitionPath,e],jsonSchema:void 0}]))}})(t);let a="object"==typeof t&&t.definitions?Object.entries(t.definitions).reduce((e,[t,r])=>{var a;return{...e,[t]:null!=(a=Te(r._def,{...n,currentPath:[...n.basePath,n.definitionPath,t]},!0))?a:{}}},{}):void 0;const s="string"==typeof t?t:"title"===(null==t?void 0:t.nameStrategy)||null==t?void 0:t.name,o=null!=(r=Te(e._def,void 0===s?n:{...n,currentPath:[...n.basePath,n.definitionPath,s]},!1))?r:{},i="object"==typeof t&&void 0!==t.name&&"title"===t.nameStrategy?t.name:void 0;void 0!==i&&(o.title=i);const u=void 0===s?a?{...o,[n.definitionPath]:a}:o:{$ref:[..."relative"===n.$refStrategy?[]:n.basePath,n.definitionPath,s].join("/"),[n.definitionPath]:{...a,[s]:o}};return u.$schema="http://json-schema.org/draft-07/schema#",u};function Ie(e,t){return function(e){return"_zod"in e}(e)?function(e,t){var r;const n=null!=(r=null==t?void 0:t.useReferences)&&r;return Ne(o.b(e,{target:"draft-7",io:"output",reused:n?"ref":"inline"}),{validate:async t=>{const r=await s.bp(e,t);return r.success?{success:!0,value:r.data}:{success:!1,error:r.error}}})}(e,t):function(e,t){var r;const n=null!=(r=null==t?void 0:t.useReferences)&&r;return Ne(Le(e,{$refStrategy:n?"root":"none"}),{validate:async t=>{const r=await e.safeParseAsync(t);return r.success?{success:!0,value:r.data}:{success:!1,error:r.error}}})}(e,t)}var Ee=Symbol.for("vercel.ai.schema");function Ne(e,{validate:t}={}){return{[Ee]:!0,_type:void 0,[N]:!0,jsonSchema:e,validate:t}}function Ye(e){return null==e?Ne({properties:{},additionalProperties:!1}):"object"==typeof(t=e)&&null!==t&&Ee in t&&!0===t[Ee]&&"jsonSchema"in t&&"validate"in t?e:Ie(e);var t}var{btoa:Be,atob:Re}=globalThis;function Me(e){const t=e.replace(/-/g,"+").replace(/_/g,"/"),r=Re(t);return Uint8Array.from(r,e=>e.codePointAt(0))}function Ve(e){let t="";for(let r=0;r<e.length;r++)t+=String.fromCodePoint(e[r]);return Be(t)}function He(e){return e instanceof Uint8Array?Ve(e):e}function ze(e){return null==e?void 0:e.replace(/\/$/,"")}async function*Fe({execute:e,input:t,options:r}){const n=e(t,r);if(null!=(a=n)&&"function"==typeof a[Symbol.asyncIterator]){let e;for await(const t of n)e=t,yield{type:"preliminary",output:t};yield{type:"final",output:e}}else yield{type:"final",output:await n};var a}}}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";(self.webpackChunk_jupyterlite_ai=self.webpackChunk_jupyterlite_ai||[]).push([[155],{2155:(e,t,n)=>{n.r(t),n.d(t,{VERSION:()=>_,createMistral:()=>w,mistral:()=>I});var o=n(2100),s=n(116),a=n(6097);function i(e){const t=[];for(let n=0;n<e.length;n++){const{role:a,content:i}=e[n],l=n===e.length-1;switch(a){case"system":t.push({role:"system",content:i});break;case"user":t.push({role:"user",content:i.map(e=>{switch(e.type){case"text":return{type:"text",text:e.text};case"file":if(e.mediaType.startsWith("image/")){const t="image/*"===e.mediaType?"image/jpeg":e.mediaType;return{type:"image_url",image_url:e.data instanceof URL?e.data.toString():`data:${t};base64,${(0,s.convertToBase64)(e.data)}`}}if("application/pdf"===e.mediaType)return{type:"document_url",document_url:e.data.toString()};throw new o.b8({functionality:"Only images and PDF file parts are supported"})}})});break;case"assistant":{let e="";const n=[];for(const t of i)switch(t.type){case"text":case"reasoning":e+=t.text;break;case"tool-call":n.push({id:t.toolCallId,type:"function",function:{name:t.toolName,arguments:JSON.stringify(t.input)}});break;default:throw new Error(`Unsupported content type in assistant message: ${t.type}`)}t.push({role:"assistant",content:e,prefix:!!l||void 0,tool_calls:n.length>0?n:void 0});break}case"tool":for(const e of i){const n=e.output;let o;switch(n.type){case"text":case"error-text":o=n.value;break;case"content":case"json":case"error-json":o=JSON.stringify(n.value)}t.push({role:"tool",name:e.toolName,tool_call_id:e.toolCallId,content:o})}break;default:throw new Error(`Unsupported role: ${a}`)}}return t}function l({id:e,model:t,created:n}){return{id:null!=e?e:void 0,modelId:null!=t?t:void 0,timestamp:null!=n?new Date(1e3*n):void 0}}function r(e){switch(e){case"stop":return"stop";case"length":case"model_length":return"length";case"tool_calls":return"tool-calls";default:return"unknown"}}var u=a.Ik({safePrompt:a.zM().optional(),documentImageLimit:a.ai().optional(),documentPageLimit:a.ai().optional(),structuredOutputs:a.zM().optional(),strictJsonSchema:a.zM().optional(),parallelToolCalls:a.zM().optional()}),c=a.Ik({object:a.eu("error"),message:a.Yj(),type:a.Yj(),param:a.Yj().nullable(),code:a.Yj().nullable()}),d=(0,s.createJsonErrorResponseHandler)({errorSchema:c,errorToMessage:e=>e.message}),p=class{constructor(e,t){var n;this.specificationVersion="v2",this.supportedUrls={"application/pdf":[/^https:\/\/.*$/]},this.modelId=e,this.config=t,this.generateId=null!=(n=t.generateId)?n:s.generateId}get provider(){return this.config.provider}async getArgs({prompt:e,maxOutputTokens:t,temperature:n,topP:a,topK:l,frequencyPenalty:r,presencePenalty:c,stopSequences:d,responseFormat:p,seed:h,providerOptions:m,tools:g,toolChoice:f}){var y,k,b,v;const _=[],w=null!=(y=await(0,s.parseProviderOptions)({provider:"mistral",providerOptions:m,schema:u}))?y:{};null!=l&&_.push({type:"unsupported-setting",setting:"topK"}),null!=r&&_.push({type:"unsupported-setting",setting:"frequencyPenalty"}),null!=c&&_.push({type:"unsupported-setting",setting:"presencePenalty"}),null!=d&&_.push({type:"unsupported-setting",setting:"stopSequences"});const I=null==(k=w.structuredOutputs)||k,x=null!=(b=w.strictJsonSchema)&&b;"json"!==(null==p?void 0:p.type)||(null==p?void 0:p.schema)||(e=(0,s.injectJsonInstructionIntoMessages)({messages:e,schema:p.schema}));const j={model:this.modelId,safe_prompt:w.safePrompt,max_tokens:t,temperature:n,top_p:a,random_seed:h,response_format:"json"===(null==p?void 0:p.type)?I&&null!=(null==p?void 0:p.schema)?{type:"json_schema",json_schema:{schema:p.schema,strict:x,name:null!=(v=p.name)?v:"response",description:p.description}}:{type:"json_object"}:void 0,document_image_limit:w.documentImageLimit,document_page_limit:w.documentPageLimit,messages:i(e)},{tools:Y,toolChoice:T,toolWarnings:C}=function({tools:e,toolChoice:t}){const n=[];if(null==(e=(null==e?void 0:e.length)?e:void 0))return{tools:void 0,toolChoice:void 0,toolWarnings:n};const s=[];for(const t of e)"provider-defined"===t.type?n.push({type:"unsupported-tool",tool:t}):s.push({type:"function",function:{name:t.name,description:t.description,parameters:t.inputSchema}});if(null==t)return{tools:s,toolChoice:void 0,toolWarnings:n};const a=t.type;switch(a){case"auto":case"none":return{tools:s,toolChoice:a,toolWarnings:n};case"required":return{tools:s,toolChoice:"any",toolWarnings:n};case"tool":return{tools:s.filter(e=>e.function.name===t.toolName),toolChoice:"any",toolWarnings:n};default:{const e=a;throw new o.b8({functionality:`tool choice type: ${e}`})}}}({tools:g,toolChoice:f});return{args:{...j,tools:Y,tool_choice:T,...null!=Y&&void 0!==w.parallelToolCalls?{parallel_tool_calls:w.parallelToolCalls}:{}},warnings:[..._,...C]}}async doGenerate(e){const{args:t,warnings:n}=await this.getArgs(e),{responseHeaders:o,value:a,rawValue:i}=await(0,s.postJsonToApi)({url:`${this.config.baseURL}/chat/completions`,headers:(0,s.combineHeaders)(this.config.headers(),e.headers),body:t,failedResponseHandler:d,successfulResponseHandler:(0,s.createJsonResponseHandler)(y),abortSignal:e.abortSignal,fetch:this.config.fetch}),u=a.choices[0],c=[];if(null!=u.message.content&&Array.isArray(u.message.content))for(const e of u.message.content)if("thinking"===e.type){const t=h(e.thinking);t.length>0&&c.push({type:"reasoning",text:t})}else"text"===e.type&&e.text.length>0&&c.push({type:"text",text:e.text});else{const e=m(u.message.content);null!=e&&e.length>0&&c.push({type:"text",text:e})}if(null!=u.message.tool_calls)for(const e of u.message.tool_calls)c.push({type:"tool-call",toolCallId:e.id,toolName:e.function.name,input:e.function.arguments});return{content:c,finishReason:r(u.finish_reason),usage:{inputTokens:a.usage.prompt_tokens,outputTokens:a.usage.completion_tokens,totalTokens:a.usage.total_tokens},request:{body:t},response:{...l(a),headers:o,body:i},warnings:n}}async doStream(e){const{args:t,warnings:n}=await this.getArgs(e),o={...t,stream:!0},{responseHeaders:a,value:i}=await(0,s.postJsonToApi)({url:`${this.config.baseURL}/chat/completions`,headers:(0,s.combineHeaders)(this.config.headers(),e.headers),body:o,failedResponseHandler:d,successfulResponseHandler:(0,s.createEventSourceResponseHandler)(k),abortSignal:e.abortSignal,fetch:this.config.fetch});let u="unknown";const c={inputTokens:void 0,outputTokens:void 0,totalTokens:void 0};let p=!0,g=!1,f=null;const y=this.generateId;return{stream:i.pipeThrough(new TransformStream({start(e){e.enqueue({type:"stream-start",warnings:n})},transform(t,n){if(e.includeRawChunks&&n.enqueue({type:"raw",rawValue:t.rawValue}),!t.success)return void n.enqueue({type:"error",error:t.error});const o=t.value;p&&(p=!1,n.enqueue({type:"response-metadata",...l(o)})),null!=o.usage&&(c.inputTokens=o.usage.prompt_tokens,c.outputTokens=o.usage.completion_tokens,c.totalTokens=o.usage.total_tokens);const s=o.choices[0],a=s.delta,i=m(a.content);if(null!=a.content&&Array.isArray(a.content))for(const e of a.content)if("thinking"===e.type){const t=h(e.thinking);t.length>0&&(null==f&&(g&&(n.enqueue({type:"text-end",id:"0"}),g=!1),f=y(),n.enqueue({type:"reasoning-start",id:f})),n.enqueue({type:"reasoning-delta",id:f,delta:t}))}if(null!=i&&i.length>0&&(g||(null!=f&&(n.enqueue({type:"reasoning-end",id:f}),f=null),n.enqueue({type:"text-start",id:"0"}),g=!0),n.enqueue({type:"text-delta",id:"0",delta:i})),null!=(null==a?void 0:a.tool_calls))for(const e of a.tool_calls){const t=e.id,o=e.function.name,s=e.function.arguments;n.enqueue({type:"tool-input-start",id:t,toolName:o}),n.enqueue({type:"tool-input-delta",id:t,delta:s}),n.enqueue({type:"tool-input-end",id:t}),n.enqueue({type:"tool-call",toolCallId:t,toolName:o,input:s})}null!=s.finish_reason&&(u=r(s.finish_reason))},flush(e){null!=f&&e.enqueue({type:"reasoning-end",id:f}),g&&e.enqueue({type:"text-end",id:"0"}),e.enqueue({type:"finish",finishReason:u,usage:c})}})),request:{body:o},response:{headers:a}}}};function h(e){return e.filter(e=>"text"===e.type).map(e=>e.text).join("")}function m(e){if("string"==typeof e)return e;if(null==e)return;const t=[];for(const n of e){const{type:e}=n;switch(e){case"text":t.push(n.text);break;case"thinking":case"image_url":case"reference":break;default:throw new Error(`Unsupported type: ${e}`)}}return t.length?t.join(""):void 0}var g=a.KC([a.Yj(),a.YO(a.gM("type",[a.Ik({type:a.eu("text"),text:a.Yj()}),a.Ik({type:a.eu("image_url"),image_url:a.KC([a.Yj(),a.Ik({url:a.Yj(),detail:a.Yj().nullable()})])}),a.Ik({type:a.eu("reference"),reference_ids:a.YO(a.ai())}),a.Ik({type:a.eu("thinking"),thinking:a.YO(a.Ik({type:a.eu("text"),text:a.Yj()}))})]))]).nullish(),f=a.Ik({prompt_tokens:a.ai(),completion_tokens:a.ai(),total_tokens:a.ai()}),y=a.Ik({id:a.Yj().nullish(),created:a.ai().nullish(),model:a.Yj().nullish(),choices:a.YO(a.Ik({message:a.Ik({role:a.eu("assistant"),content:g,tool_calls:a.YO(a.Ik({id:a.Yj(),function:a.Ik({name:a.Yj(),arguments:a.Yj()})})).nullish()}),index:a.ai(),finish_reason:a.Yj().nullish()})),object:a.eu("chat.completion"),usage:f}),k=a.Ik({id:a.Yj().nullish(),created:a.ai().nullish(),model:a.Yj().nullish(),choices:a.YO(a.Ik({delta:a.Ik({role:a.k5(["assistant"]).optional(),content:g,tool_calls:a.YO(a.Ik({id:a.Yj(),function:a.Ik({name:a.Yj(),arguments:a.Yj()})})).nullish()}),finish_reason:a.Yj().nullish(),index:a.ai()})),usage:f.nullish()}),b=class{constructor(e,t){this.specificationVersion="v2",this.maxEmbeddingsPerCall=32,this.supportsParallelCalls=!1,this.modelId=e,this.config=t}get provider(){return this.config.provider}async doEmbed({values:e,abortSignal:t,headers:n}){if(e.length>this.maxEmbeddingsPerCall)throw new o.Ch({provider:this.provider,modelId:this.modelId,maxEmbeddingsPerCall:this.maxEmbeddingsPerCall,values:e});const{responseHeaders:a,value:i,rawValue:l}=await(0,s.postJsonToApi)({url:`${this.config.baseURL}/embeddings`,headers:(0,s.combineHeaders)(this.config.headers(),n),body:{model:this.modelId,input:e,encoding_format:"float"},failedResponseHandler:d,successfulResponseHandler:(0,s.createJsonResponseHandler)(v),abortSignal:t,fetch:this.config.fetch});return{embeddings:i.data.map(e=>e.embedding),usage:i.usage?{tokens:i.usage.prompt_tokens}:void 0,response:{headers:a,body:l}}}},v=a.Ik({data:a.YO(a.Ik({embedding:a.YO(a.ai())})),usage:a.Ik({prompt_tokens:a.ai()}).nullish()}),_="2.0.17";function w(e={}){var t;const n=null!=(t=(0,s.withoutTrailingSlash)(e.baseURL))?t:"https://api.mistral.ai/v1",a=()=>(0,s.withUserAgentSuffix)({Authorization:`Bearer ${(0,s.loadApiKey)({apiKey:e.apiKey,environmentVariableName:"MISTRAL_API_KEY",description:"Mistral"})}`,...e.headers},`ai-sdk/mistral/${_}`),i=t=>new p(t,{provider:"mistral.chat",baseURL:n,headers:a,fetch:e.fetch,generateId:e.generateId}),l=t=>new b(t,{provider:"mistral.embedding",baseURL:n,headers:a,fetch:e.fetch}),r=function(e){if(new.target)throw new Error("The Mistral model function cannot be called with the new keyword.");return i(e)};return r.languageModel=i,r.chat=i,r.embedding=l,r.textEmbedding=l,r.textEmbeddingModel=l,r.imageModel=e=>{throw new o.eM({modelId:e,modelType:"imageModel"})},r}var I=w()}}]);
|