Ever wondered how to leverage the power of AI and Large Language Models (LLMs) in your projects? Look no further!
This post will introduce you to GenAIScript, a tool designed to simplify the creation of prompts and interactions with LLMs. Let’s dive in! 🌊
What is GenAIScript?
GenAIScript uses a stylized version of JavaScript to generate prompts, which are then sent to an LLM.
Scripts are stored as files (genaisrc/*.genai.mjs), executed to produce the prompt text and structured results (files, diagnostics) are extracted automatically.
Getting Started
Here’s a simple example to get you started. Create a file named poem.genai.mjs in the genaisrc folder and add the following code:
When executed, this script will generate the following prompt:
👤 User🤖 Assistant
Adding Context
GenAIScript can also use context variables, allowing you to interact with files or other data sources. Let’s see an example where we define a context variable using env.files:
Execute this script to see the generated user message and the assistant’s response. The context variable FILES will contain the list of files in the environment.
👤 User🤖 Assistant
Metadata and Script Configuration
You can add metadata to your script using the script function. This helps in organizing and configuring the script, including specifying the model and other parameters. GenAIScript supports various LLM providers, such as OpenAI, Azure OpenAI,
GitHub Models, Ollama and more.
Next Steps
Getting started guide to configure and start using GenAIScript.