microsoft / genaiscript

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

Env.files empty when invoked with right click on file in VS Code Explorer #521

Closed bzorn closed 3 weeks ago

bzorn commented 3 weeks ago

Type: Bug

Describe the issue

Env.files is empty when it should contain the file that I right-clicked on.

To Reproduce

Right click on file in VS Code explorer. "Run GenAIScript..." Select a script that uses env.files. The script fails to run and env.files is empty.

Expected behavior

The script should run with env.files bound to the file I right-clicked on.

Environment

vscode: 1.90.0 extension: 1.37.0

Request

## summarize

<details id="๐Ÿค–-automation" class="genaiscript">
<summary>
๐Ÿค– automation
</summary>

This operation can be automated using the command line interface using the `run` command:

```bash
npx --yes genaiscript@^1.37.0 run summarize "explanation.md" --apply-edits --model openai:gpt-3.5-turbo

๐Ÿงช testing - [promptfoo](https://www.promptfoo.dev/) configuration ```yaml description: summarize all files prompts: - summarize providers: - id: provider.mjs label: openai:gpt-3.5-turbo config: model: openai:gpt-3.5-turbo tests: - vars: files: src/rag/markdown.md assert: - type: icontains value: markdown transform: output.text - type: factuality value: Markdown is a text-based syntax to generate documents transform: output.text ``` - run the test command ```sh npx --yes genaiscript test summarize ```
๐Ÿ’พ script - temperature: 0.2
๐Ÿก env
๐Ÿงฌ prompt
๐Ÿ““ script source ```js script({ title: "summarize all files", model: "openai:gpt-3.5-turbo", files: "src/rag/markdown.md", tests: [ { files: "src/rag/markdown.md", facts: ["Markdown is a text-based syntax to generate documents"], keywords: "markdown", }, ], }) def("FILE", env.files) $` Summarize each FILE with one paragraph. - Do not wrap results in code section. - Use less than 20 words. ` ```
> [!NOTE] > def FILE files empty

Extension version: 1.37.0
VS Code version: Code 1.90.0 (89de5a8d4d6205e5b11647eb6a74844ca23d2573, 2024-06-04T19:33:54.889Z)
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 (31.31GB 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 pythonidxpt:30866567 pythonnoceb:30805159 asynctok:30898717 pythontestfixt:30902429 pythonregdiag2:30936856 pythonmypyd1:30879173 pythoncet0:30885854 h48ei257:31000450 pythontbext0:30879054 accentitlementst:30995554 dsvsc016:30899300 dsvsc017:30899301 dsvsc018:30899302 cppperfnew:31000557 dsvsc020:30976470 pythonait:31006305 showvideoc:31016891 chatpanelc:31048052 dsvsc021:30996838 jg8ic977:31013176 pythoncenvpt:31049070 a69g1124:31046351 dvdeprecationcf:31052040 pythonprc:31047982 dwnewjupyter:31046869 26j00206:31048877



</details>

<!-- generated by issue reporter -->