> Programmatically assemble prompts for LLMs using JavaScript.
> $`Analyze ${env.files} and report errors. Use gitmojis.`
This is kinda misleading and confusing as a lead. I could literally say:
> Programmatically assemble prompts for LLMs using strings!
> ... amazing!
I like that they've provided ways to define schemas and standardized function-calling/tools, plus CLI helpers. But I find the page quite overwhelming hype-y. This could be reduced to a 30 line readme with much clearer examples. When did shipping JS libs as product-y websites become a thing?
Given that their README is openly being maintained by an LLM [0], I wouldn't be surprised if most of the site's copy is as well. It would go a long way towards explaining why it feels even more bloated and incoherent than usual.
I wonder how long it will go before it devolves into complete incoherence. It already seems incoherent so probably in a few updates it will be completely unreadable.
I'm going to be honest, I'm still confused about what I'm looking at.
I tried listening to the NotebookLLM podcast you've embedded, which makes it sound like this is primarily directed at non-programmers (people who want to "run for the hills" when they hear the name GitHub). But then your README looks more targeted at web programmers who want to write TypeScript-like code.
When I get to the rest of the README, I'm unclear what "JavaScript-ish environment" means. Does that mean this is something like AssemblyScript, a subset of TypeScript? If so, why did you decide to do a subset instead of a library?
Addendum:
As I'm going over the README again, trying desperately to make sense of it, I found this:
> This readme is maintained by the readme-updater script.
Agree. Using LLMs from code is already so easy I don't see why a developer would need something like this.
In one evening I whipped up a lib for talking to ollama, usings agents, tool use, sandboxed code execution etc. and that was doing it the hardish way, from scratch.
This seems like a decent collection of tools but anyone able to use this could already do the same things with normal JS with not a lot of effort.
This looks like a useful tool but.. please review your generated docs for utility.
"""
Be ambitious about what you want your script to do
Remember, LLMs in GenAIScript can do things that no other software has been able to do. Think outside the box in the ways that you use it. LLMs can critically review a document, write poetry, and analyze images, just as a starting point. They have built-in expertise on many different human endeavors, math, history, etc. and their knowledge can be easily extended by adding more context to the script input (see next point).
"""
This above comes under the "Best Practices" page.. why?
I work on building "AI" systems daily and a large part of it is assembling and managing large prompts.
I have no idea what this does. I think maybe if the examples included the output then it might be helpful?
$`Analyze ${env.files} and report errors. Use gitmojis.`
If we knew what env.files is and what it output it would help. Does it doing some magic that looks in the file system for the files listed as env.files, combines them and passes them to the LLM? Or does the LLM write code to get the files? Or something else.
What does "Analyze" mean? I assume because of the mention of gitmojis they are code files, but maybe that assumption is wrong and it is expecting spreadsheets and can find errors in formulas? I don't know..
This seems like it can be super useful - lot to go over but want to focus on running commands in containers. Having a clean and elegant way of executing LLM commands in a containerized environment is definitely better than running on a single VM/machine. I do wonder how something like this would run in a containerized application though - can you define the "host" to be a kubernetes control plane?
Edit: Okay, taking a deeper look - this seems to be a separate runtime on top of node - "$" seems to be global and files are defined as .genai.mjs and run through VSCode. I see that there's a way to run via CLI as well: `npx genaiscript run proofreader path/to/files*.md`, but I wonder what the rationale around these design decisions are. It seems like it's tying these files to a different runtime - can I use them directly in Node or Bun as part of an API? Something like "import {templateStr as $, def} from 'genaiscript'", then use it normally in Node?
One of the early ideas was to make the scripting syntax as lightweight as possible. Thus not requiring to install or import anythying to start writing a prompt (the project evolved). Definitely inspired from google/zx.
Going through getting started on the command line fails:
$ npx genaiscript script create proofreader
Need to install the following packages:
genaiscript@1.70.0
Ok to proceed? (y)
file /Users/me/src/learn/genaiscript/proofreader/genaisrc/proofreader.genai.mjs already exists
Error: file /Users/me/src/learn/genaiscript/proofreader/genaisrc/proofreader.genai.mjs already exists
at copyPrompt (/Users/me/.npm/_npx/3f5b5bbcce7f85b9/node_modules/genaiscript/built/genaiscript.cjs:96237:35)
at async _Command.createScript2 (/Users/me/.npm/_npx/3f5b5bbcce7f85b9/node_modules/genaiscript/built/genaiscript.cjs:96327:15)
ok Microsoft, so you are trying to make something useful out of LLMs. But now that you have one hell of a reputation to overcome, the questions are: Is this happening on device? Without sending anything to the internet? And is it going to be REALLY FUCKING CLEAR when you change that in the future? with the option of FUCK NO instead of "maybe later"?
There are absolutely zero indicators that Microsoft will ever STOP being privacy-invasive.
There's nothing about improving their ability to effectively process this data and draw actionable conclusions from it that makes them more likely to stop.
We really appreciate input helping us both explain what GenAIScript is and how to use it. Please keep it coming! We've updated the Getting Started page (https://microsoft.github.io/genaiscript/getting-started/) to help visitors understand exactly what is in our scripts and how we execute them.
Posted this because I didn't see it, just now getting back (toddler).
I started messing with this yesterday and was able to get a fully functional refactor engine (complete with code review, running tests, building TS, etc.) going in less than a day.
We were looking for a tool to bake into our developer tooling that supports things like this, and this GenAIScript project has been perfect so far. Definitely doesn't seem quite ready to embed this into customer-facing stuff, but I'm finding it tremendously helpful for LLM-powered tooling!
GenAIScript is a scripting language that integrates LLMs into the scripting process using a simplified JavaScript syntax. It allows users to create, debug, and automate LLM-based scripts.
which ruins my hope that it was a JS library I could drop into other things and work together with other JS libraries. Although I guess can implement some sort of bridge to it to allow that, why not a full js library not sure.
Seeing that human written JSON structure convert to a more human readable few shot example in the code makes this feel like a step backward. Easier for the human to write the human readable example. Yes it’s doing file access and may fulfill other programmatic tasks that aren’t just prompting, but retrieving files quickly goes to RAG or similar, and the logic gets so complex an actual programming language begins to make more sense.
At first glance, it looks like this is almost JavaScript (or TypeScript), but with imports removed / implied. (Sort of like Arduino is almost C++.)
I'm wondering if the same functionality would be available as an actual JavaScript library, or whether there is something special (other than syntactic sugar) that requires a different file type?
This seems like an equivalent to Mustache or Handlebars except for programmatically building prompts rather than HTML?
For example, I may be building a text game, and I may have to get rules, state, character specs, etc. Then I may have to load these things into a document as part of a prompt for the LLM to consume.
Simple, as others mentioned. But still nice to have something to reach for rather than building this myself.
Thanks for the input on the GenAIScript landing page and README repo file. We've updated the description and hopefully this makes it clearer what it is and why it is useful.
so it seems to me these things could totally be so useful that you might use these and never care about the AI parts, at any rate I think I have to devote next week to this, as soon as the project I am on right now is shipped.
This might be a simple question to answer but I couldn't find it from skimming these docs: what LLMs can this hook to? Do I plug an actual API key like 90% of tools? Where's the AI compute part coming from?
question - is workspace.grep using JS regex or is it using actual grep? Like on Windows part of this would be depending on the Linux for Windows tools?
For folks who would prefer a more "full bodied" experience, we offer a UI configuration based alternative approach that supports JavaScript and Groovy, including an IDE environment integration.
Given that their README is openly being maintained by an LLM [0], I wouldn't be surprised if most of the site's copy is as well. It would go a long way towards explaining why it feels even more bloated and incoherent than usual.
[0] "This readme is maintained by the readme-updater script." https://github.com/microsoft/genaiscript
I wonder how long it will go before it devolves into complete incoherence. It already seems incoherent so probably in a few updates it will be completely unreadable.
Kafka would be proud. We're gone from the dream of a semantic web to industrial grade non-sense spreading automatically.
It does seem like everything is heading in that direction.
Hi GenAIScript dev here, you'll find the readme at https://github.com/microsoft/genaiscript. Thanks for your feedback!
Thanks for dropping by!
I'm going to be honest, I'm still confused about what I'm looking at.
I tried listening to the NotebookLLM podcast you've embedded, which makes it sound like this is primarily directed at non-programmers (people who want to "run for the hills" when they hear the name GitHub). But then your README looks more targeted at web programmers who want to write TypeScript-like code.
When I get to the rest of the README, I'm unclear what "JavaScript-ish environment" means. Does that mean this is something like AssemblyScript, a subset of TypeScript? If so, why did you decide to do a subset instead of a library?
Addendum:
As I'm going over the README again, trying desperately to make sense of it, I found this:
> This readme is maintained by the readme-updater script.
At least I now understand my confusion.
Can you clarify, are you also an LLM, or are you a human dev? > This readme is maintained by the readme-updater script.
Agree. Using LLMs from code is already so easy I don't see why a developer would need something like this.
In one evening I whipped up a lib for talking to ollama, usings agents, tool use, sandboxed code execution etc. and that was doing it the hardish way, from scratch.
This seems like a decent collection of tools but anyone able to use this could already do the same things with normal JS with not a lot of effort.
This looks like a useful tool but.. please review your generated docs for utility.
""" Be ambitious about what you want your script to do
Remember, LLMs in GenAIScript can do things that no other software has been able to do. Think outside the box in the ways that you use it. LLMs can critically review a document, write poetry, and analyze images, just as a starting point. They have built-in expertise on many different human endeavors, math, history, etc. and their knowledge can be easily extended by adding more context to the script input (see next point). """
This above comes under the "Best Practices" page.. why?
Might have been generated by an LLM ironically.
This is hilarious!
I work on building "AI" systems daily and a large part of it is assembling and managing large prompts.
I have no idea what this does. I think maybe if the examples included the output then it might be helpful?
If we knew what env.files is and what it output it would help. Does it doing some magic that looks in the file system for the files listed as env.files, combines them and passes them to the LLM? Or does the LLM write code to get the files? Or something else.What does "Analyze" mean? I assume because of the mention of gitmojis they are code files, but maybe that assumption is wrong and it is expecting spreadsheets and can find errors in formulas? I don't know..
Edit: https://microsoft.github.io/genaiscript/blog/automatic-web-p... isn't perfect but a little bit more useful.
Could someone please explain what I'm looking at here? Am I the only one mystified?
I don’t think this is for humans to ever write. It’s mostly readable code for AI to generate, Lego blocks to achieve a task.
That’s my best guess.
It was probably generated with an LLM and as far as I can tell it does seem like complete nonsense.
This seems like it can be super useful - lot to go over but want to focus on running commands in containers. Having a clean and elegant way of executing LLM commands in a containerized environment is definitely better than running on a single VM/machine. I do wonder how something like this would run in a containerized application though - can you define the "host" to be a kubernetes control plane?
Note that the container link on the homepage to https://microsoft.github.io/genaiscript/referenc/scripts/con... seems to be broken.
Edit: Okay, taking a deeper look - this seems to be a separate runtime on top of node - "$" seems to be global and files are defined as .genai.mjs and run through VSCode. I see that there's a way to run via CLI as well: `npx genaiscript run proofreader path/to/files*.md`, but I wonder what the rationale around these design decisions are. It seems like it's tying these files to a different runtime - can I use them directly in Node or Bun as part of an API? Something like "import {templateStr as $, def} from 'genaiscript'", then use it normally in Node?
One of the early ideas was to make the scripting syntax as lightweight as possible. Thus not requiring to install or import anythying to start writing a prompt (the project evolved). Definitely inspired from google/zx.
Ah thanks for clarifying. I understand the focus on being a scripting syntax first after looking at google/zx & rereading the docs.
Also had some more time to look at the code, seems like the CLI is using https://github.com/microsoft/genaiscript/blob/main/packages/... to execute scripts which uses promptrunner in core https://github.com/microsoft/genaiscript/blob/main/packages/... - it looks like it's not trivial to use directly from JS or decouple the runtime? Unless that's on the roadmap somewhere to be able to call the scripts in the same process as a Node app.
Going through getting started on the command line fails:
looks like a silly bug on our side. this little helper is just supposed to create an empty file for you. what happens on ?
genaiscript@1.70.1 fixed it for me -- thanks!
I'm on macos 14.5
same
ok Microsoft, so you are trying to make something useful out of LLMs. But now that you have one hell of a reputation to overcome, the questions are: Is this happening on device? Without sending anything to the internet? And is it going to be REALLY FUCKING CLEAR when you change that in the future? with the option of FUCK NO instead of "maybe later"?
There are absolutely zero indicators that Microsoft will ever STOP being privacy-invasive.
There's nothing about improving their ability to effectively process this data and draw actionable conclusions from it that makes them more likely to stop.
GenAIScript does not collect any data/usage analytics. The LLM query is sent to the provider you configured. Hope this helps answer your question?
We really appreciate input helping us both explain what GenAIScript is and how to use it. Please keep it coming! We've updated the Getting Started page (https://microsoft.github.io/genaiscript/getting-started/) to help visitors understand exactly what is in our scripts and how we execute them.
Posted this because I didn't see it, just now getting back (toddler).
I started messing with this yesterday and was able to get a fully functional refactor engine (complete with code review, running tests, building TS, etc.) going in less than a day.
We were looking for a tool to bake into our developer tooling that supports things like this, and this GenAIScript project has been perfect so far. Definitely doesn't seem quite ready to embed this into customer-facing stuff, but I'm finding it tremendously helpful for LLM-powered tooling!
Many thanks, pelikhan, for publishing this!
I don't get it from the landing. Is this like a fake code language that a LLM can interpret? Is the syntax invented on the go? Like if I ask GPT:
"Imagine the following code belongs to a known language and execute it"?
from the getting started https://microsoft.github.io/genaiscript/getting-started/
GenAIScript is a scripting language that integrates LLMs into the scripting process using a simplified JavaScript syntax. It allows users to create, debug, and automate LLM-based scripts.
which ruins my hope that it was a JS library I could drop into other things and work together with other JS libraries. Although I guess can implement some sort of bridge to it to allow that, why not a full js library not sure.
on edit: huh, maybe available js library https://news.ycombinator.com/item?id=42002316
Seeing that human written JSON structure convert to a more human readable few shot example in the code makes this feel like a step backward. Easier for the human to write the human readable example. Yes it’s doing file access and may fulfill other programmatic tasks that aren’t just prompting, but retrieving files quickly goes to RAG or similar, and the logic gets so complex an actual programming language begins to make more sense.
At first glance, it looks like this is almost JavaScript (or TypeScript), but with imports removed / implied. (Sort of like Arduino is almost C++.)
I'm wondering if the same functionality would be available as an actual JavaScript library, or whether there is something special (other than syntactic sugar) that requires a different file type?
GenAIScript here. Yes it could be available as a library to fit but it'll require a bit of refactoring on our part.
Just throw it into o1
This seems like an equivalent to Mustache or Handlebars except for programmatically building prompts rather than HTML?
For example, I may be building a text game, and I may have to get rules, state, character specs, etc. Then I may have to load these things into a document as part of a prompt for the LLM to consume.
Simple, as others mentioned. But still nice to have something to reach for rather than building this myself.
Edit: And thanks! This is timely.
Thanks for the input on the GenAIScript landing page and README repo file. We've updated the description and hopefully this makes it clearer what it is and why it is useful.
there are lots of useful parts here doesn't seem like it is Gen.AI but some other provided tool
// automatically convert to text def("PDF", env.files, { endsWith: ".pdf" }) // or parse and process const { pages } = await parsers.PDF(env.files[0])
def("DATA", env.files, { endsWith: ".csv", // take top 100 rows sliceHead: 100, }) // or parse to JavaScript object array const rows = await parsers.CSV(env.files[0])
const { files } = await workspace.grep(/[a-z][a-z0-9]+/, { globs: "*.md" })
so it seems to me these things could totally be so useful that you might use these and never care about the AI parts, at any rate I think I have to devote next week to this, as soon as the project I am on right now is shipped.
Sorta-side note but for readability: To format code on HN, indent with 2 spaces.
This might be a simple question to answer but I couldn't find it from skimming these docs: what LLMs can this hook to? Do I plug an actual API key like 90% of tools? Where's the AI compute part coming from?
Not sure on the details, but it can at least use Ollama and OpenAI. https://microsoft.github.io/genaiscript/guides/phi3-with-oll...
question - is workspace.grep using JS regex or is it using actual grep? Like on Windows part of this would be depending on the Linux for Windows tools?
Just when the managers thought they could cut back on developers - they got their Trojan horse in to be relevant in the LLM game.
[flagged]
The only "80's" thing I see here is someone trying to start a programming language flamewar
No, that's timeless.
If you’re building a web app, how do you usually deploy? Serve an api then hit it in js/ts or django/flask or perhaps a third option?
For folks who would prefer a more "full bodied" experience, we offer a UI configuration based alternative approach that supports JavaScript and Groovy, including an IDE environment integration.
demo: https://youtu.be/XlO4KhIGd0A https://youtu.be/cs5cbxDClbM