microsoft / genaiscript

Generative AI Scripting
https://microsoft.github.io/genaiscript/
MIT License
81 stars 22 forks source link

Simple GenAIScript failing #565

Closed bzorn closed 2 days ago

bzorn commented 3 days ago

Type: Bug

Describe the issue

I have a minimal script that just has a prompt. When I execute it I get an error. The error message is below.

To Reproduce

Create a script that takes no input (just has a prompt). Run it with the "Run" button in the VS Code UI. I get an error message instead of the script running.

Expected behavior

A clear and concise description of what you expected to happen.

Environment

vscode: 1.90.2 extension: 1.42.0

Trace

## test1

<details class="genaiscript">
<summary>
⚙️ configuration
</summary>

-   model: openai:gpt-4
-   base: https://tnrllmproxy.azurewebsites.net/openai/deployments
-   type: azure
-   source: env: OPENAI_API_...

</details>

<details class="genaiscript">
<summary>
🤖 automation
</summary>

Use the command line interface [run](https://microsoft.github.io/genaiscript/reference/cli/run/) to automate this task:

```bash
npx --yes genaiscript@^1.42.0 run test1 --apply-edits --model openai:gpt-4

💾 script - temperature: 0.8
🏡 env
🧬 prompt
📓 script source ```js wrap $`Tell me a joke` ```
- import: C:\Users\zorn\OneDrive - Microsoft\AI CoArch\RobustPrompt\genaisrc\test1.genai.mjs, parent: c:\Users\zorn\.vscode\extensions\genaiscript.genaiscript-vscode-1.42.0\genaiscript.cjs - 📦 imported: c:\Users\zorn\OneDrive - Microsoft\AI CoArch\RobustPrompt\genaisrc\test1.genai.mjs - Error: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:' - Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'
❌ Errors - Error: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:' - Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:' > ```````markdown> Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:' > at throwIfUnsupportedURLScheme (node:internal/modules/esm/load:239:11) > at defaultLoad (node:internal/modules/esm/load:130:3) > at nextLoad (node:internal/modules/esm/hooks:866:28) > at load (file:///c:/Users/zorn/.vscode/extensions/genaiscript.genaiscript-vscode-1.42.0/node_modules/tsx/dist/esm/index.mjs?1719875985997:2:1768) > at nextLoad (node:internal/modules/esm/hooks:866:28) > at Hooks.load (node:internal/modules/esm/hooks:449:26) > at handleMessage (node:internal/modules/esm/worker:196:24) > at Immediate.checkForMessages (node:internal/modules/esm/worker:138:28) > at process.processImmediate (node:internal/timers:478:21) > ```````

Extension version: 1.42.0
VS Code version: Code 1.90.2 (5437499feb04f7a586f677b155b039bc2b3669eb, 2024-06-18T22:34:26.404Z)
OS version: Windows_NT x64 10.0.22631
Modes:

<details>
<summary>System Info</summary>

|Item|Value|
|---|---|
|CPUs|Intel(R) Xeon(R) Silver 4108 CPU @ 1.80GHz (32 x 1796)|
|GPU Status|2d_canvas: enabled<br>canvas_oop_rasterization: enabled_on<br>direct_rendering_display_compositor: disabled_off_ok<br>gpu_compositing: enabled<br>multiple_raster_threads: enabled_on<br>opengl: enabled_on<br>rasterization: enabled<br>raw_draw: disabled_off_ok<br>skia_graphite: disabled_off<br>video_decode: enabled<br>video_encode: enabled<br>vulkan: disabled_off<br>webgl: enabled<br>webgl2: enabled<br>webgpu: enabled|
|Load (avg)|undefined|
|Memory (System)|63.71GB (37.04GB free)|
|Process Argv|--crash-reporter-id 2058db1e-f1e8-433e-bf38-476163c306a2|
|Screen Reader|no|
|VM|0%|
</details><details>
<summary>A/B Experiments</summary>

vsliv368cf:30146710 vspor879:30202332 vspor708:30202333 vspor363:30204092 vscod805:30301674 binariesv615:30325510 vsaa593cf:30376535 py29gd2263:31024239 c4g48928:30535728 azure-dev_surveyone:30548225 a9j8j154:30646983 962ge761:30959799 pythongtdpath:30769146 welcomedialogc:30910334 pythonnoceb:30805159 asynctok:30898717 pythonregdiag2:30936856 pythonmypyd1:30879173 h48ei257:31000450 pythontbext0:30879054 accentitlementst:30995554 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 jchc7451:31067544 chatpanelc:31048052 dsvsc021:30996838 jg8ic977:31013176 pythoncenvpt:31062603 a69g1124:31058053 dvdeprecation:31068756 dwnewjupyter:31046869 2f103344:31071589 impr_priority:31082723



</details>

<!-- generated by issue reporter -->
bzorn commented 3 days ago

The default behavior of the "+" button in the GenAIScript panel is to create a .mjs file (not a .js file). This appears to cause the issue observed above. When I use the same prompt in a .js file the script executes correctly.

pelikhan commented 2 days ago
  • Error: Only URLs with a scheme in: file, data, and node are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'

Good catch. This is a windows issue with the new javascript/typescript loader.

pelikhan commented 2 days ago

fixed in 1.42.3