Skip to content

Blog

Keeping your README Fresh and Engaging

In the world of open source, a well-maintained README file acts as the front door to your project. It’s often the first thing potential users and contributors see, and as such, it should be both informative and inviting. Today, we’re diving into the GenAIScript that helps keep the README of the GenAI project as fresh as a daisy! 🌼 Check out the actual script file for the details.

This blog post was co-authored with a script.

The Intention Behind the Script

The script we’re analyzing is a maintenance tool designed to import relevant information from documentation and samples into the README to enhance its appeal to users. It ensures that the README is not just a static file but a vibrant, updated document that accurately reflects the features and capabilities of GenAI.

Line-by-Line Explanation

Let’s walk through the script code as if we are crafting it from the ground up:

script({
description:
"Maintenance script for the README that imports information from the documentation and samples to make it more attractive to users.",
tools: ["fs"],
})

Here, we’re defining the script’s metadata, including a description of its purpose and the tools it will utilize. The fs tool indicates file system operations will be involved.

def("README", { filename: "README.md" })
def("FEATURES", { filename: "docs/src/content/docs/index.mdx" })

These lines declare two important files: the README itself and a FEATURES file that contains information to be imported into the README.

$`You are an expert open source maintainer.
...
`

In this template literal, we’re outlining the tasks for the script, including guidelines for updating the README with features, samples, and documentation links while preserving certain sections unchanged.

defFileOutput("README.md")

Finally, we specify that the output of this script will be an updated README.md file.

How to Run the Script

To execute this maintenance script, you’ll need the GenAIScript CLI. If you haven’t installed it yet, head over to the official documentation for installation instructions. Once you have the CLI ready, run the following command in your terminal:

Terminal window
genaiscript run readme-updater

This command will kick off the script and apply the enhancements to your README file, ensuring it’s up-to-date and user-friendly.

Conclusion

A meticulous README is a hallmark of a well-maintained open source project. With this GenAIScript, the GenAI project sets an excellent example of automating the upkeep of project documentation. Embrace the power of automation to keep your project’s welcome mat clean and welcoming. Happy coding! 👨‍💻👩‍💻

Unlocking the Power of Prompts - A Gentle Introduction to GenAIScript 🚀

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:

$`Write a one sentence poem.`

When executed, this script will generate the following prompt:

👤 User
Write a one sentence poem.
🤖 Assistant
Roses bloom, hearts swoon, under the silver moon.

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:

def("FILES", env.files)
$`You are an expert technical writer and proofreader.
Review the documents in FILES and report the 2 most important issues.`

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
FILES:
file="src/samples/markdown.md"
What is Markdown?
Markdown is a lightweight markup language that...
You are an expert technical writer and proofreader.
Review the documents in FILES and report the 2 most important issues.
🤖 Assistant
I reviewed the document in "src/samples/markdown.md"
and found the following two important issues:
1. **Missing Consistency in Heading Styles**: ...

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.

script({
title: "Technical proofreading",
description: "Reviews the text as a tech writer.",
model: "openai:gpt-4o",
temperature: 0.1,
})
def("FILES", env.files)
$`You are an expert technical writer and proofreader.
Review the documents in FILES and report the 2 most important issues.`

Next Steps

There you have it! A gentle introduction to GenAIScript to get you started on your prompt engineering journey. Happy scripting! 💻✨