Skip to content

Commit

Permalink
removing batch cli command, removing gpspecs
Browse files Browse the repository at this point in the history
  • Loading branch information
pelikhan committed Jun 25, 2024
1 parent e9268d4 commit 4ddb91c
Show file tree
Hide file tree
Showing 13 changed files with 59 additions and 552 deletions.
28 changes: 14 additions & 14 deletions docs/src/content/docs/case-studies/image-alt-text.mdx
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
---
title: Image Alt Text
sidebar:
order: 10
order: 10
description: Learn how to automatically generate descriptive alt text for images using OpenAI Vision model to enhance accessibility and SEO.
keywords: alt text automation, image accessibility, SEO optimization, OpenAI Vision, Astro integration
---
import { Image } from 'astro:assets';
import { Code } from '@astrojs/starlight/components';

import { Image } from "astro:assets"
import { Code } from "@astrojs/starlight/components"
import scriptSrc from "../../../../genaisrc/image-alt-text.genai.js?raw"
import src from '../../../assets/debugger.png';
import src from "../../../assets/debugger.png"
import alt from "../../../assets/debugger.png.txt?raw"

It is a best practice to provide an `alt` attribute for images.
This attribute is used to describe the image to users who are unable to see it.
It is a best practice to provide an `alt` attribute for images.
This attribute is used to describe the image to users who are unable to see it.
It is also used by search engines to understand the content of the image.

```html "alt"
Expand All @@ -30,7 +31,7 @@ However, this task can be tedious and developer are often tempted to skip it, or
To solve this issue, we created a script that uses the OpenAI Vision model to analyze the documentation
images and generate a description alt text.

To start, we assume that the script is run on a single image file
To start, we assume that the script is run on a single image file
and we use [defImage](/genaiscript/reference/scripts/images) to add it to the prompt context.

```js title="image-alt-text.genai.js"
Expand All @@ -55,18 +56,16 @@ The GenAIScript documentation uses Astro, which allows to author pages in [MDX](
The code below shows how the generate alt text, stored in a separate text file, is injected in the final HTML.

```mdx

import { Image } from 'astro:assets';
import src from '../../../assets/debugger.png';
import { Image } from "astro:assets"
import src from "../../../assets/debugger.png"
import alt from "../../../assets/debugger.png.txt?raw"

<Image src={src} alt={alt}/>

<Image src={src} alt={alt} />
```

The `debugger.png` image shows the screenshot of a debugging session and the generate alt text file contents.

<Image src={src} alt={alt}/>
<Image src={src} alt={alt} />

<Code code={alt} wrap={true} lang="txt" title="debugger.png.txt" />

Expand All @@ -76,7 +75,8 @@ Using the [batch](/genaiscript/reference/cli/batch) command, we can apply the sc
in a single command.

```sh
npx --yes genaiscript batch image-alt-text assets/**.png --apply-edits
for file in assets/**.png; do
npx --yes genaiscript run image-alt-text "$file" --apply-edits
```
To avoid regenerating the alt text, we also detect if a file exists in the script and cancel accordingly.
Expand Down
8 changes: 4 additions & 4 deletions docs/src/content/docs/case-studies/seo-frontmatter.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ to merge the new front matter with the existing front matter.
## Batching over all files

Once the script has been tuned on a few files, you can automate using
the [CLI](/genaiscript/reference/cli). The CLI has a **batch** mode that applies a LLM generation
on each file and a **--apply-edits** flag to apply the changes to the file.
the [CLI](/genaiscript/reference/cli). The CLI has a **--apply-edits** flag to apply the changes to the file.

```bash
genaiscript batch frontmatter src/**/*.md --apply-edits
```sh
for file in src/**/*.md; do
npx --yes genaiscript run frontmatter "$file" --apply-edits
```
You can run this command in your CI/CD pipeline to keep your SEO front matter up to date.
Expand Down
6 changes: 0 additions & 6 deletions docs/src/content/docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@ keywords: AI, script generation, performance, best practices, limitations
- **Can I use GenAIScript in IDEs other than VS Code?**
Currently, GenAIScript is integrated with VS Code, but it can be written in any IDE. The VS Code extension, however, provides additional support for creating and debugging scripts.

- **What is a GPSpec and how do I create one?**
A GPSpec is an optional markdown file that provides context for a GenAIScript. You can create one by writing a markdown document that lists arguments or includes more complex documentation.

- **What are foundation models and LLMs in the context of GenAIScript?**
Foundation models and LLMs (Large Language Models) are AI models that GenAIScript can interact with to perform tasks like generating text or processing information.

Expand Down Expand Up @@ -60,9 +57,6 @@ keywords: AI, script generation, performance, best practices, limitations
- **How can I use GenAIScript to automate document translation?**
One of our case studies illustrates the use of GenAIScript for translating document fragments between languages: [Translation Case Study](/genaiscript/case-studies/documentation-translations)

- **Is it possible to generate executable code from natural language specifications using GenAIScript?**
Yes, you can use a GPSpec to define the task and a GenAIScript to translate the spec into code in a particular programming language.

- **Can I use GenAIScript to summarize documents or create dialogues from monologues?**
Yes, LLMs are good at summarizing and can be used within GenAIScript to summarize documents or convert monologues into dialogues.

Expand Down
101 changes: 0 additions & 101 deletions docs/src/content/docs/reference/cli/batch.mdx

This file was deleted.

5 changes: 0 additions & 5 deletions docs/src/content/docs/reference/transparency-note.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,6 @@ for the LLM call, allows arbitrary JavaScript code execution, packages
the prompt input for the LLM, calls the LLM, and unpacks that LLM output
based on the directions given in the prompt.

**GPSpec** An optional markdown file(s) used to establish the calling
context for the GenAIScript. A GPSpec can be as simple as a list of
arguments and as complex as a collection of markdown documents in a
repository.

**GPVM**: A runtime system that given a GenAIScript and an optional
GPSpec, executes the GenAIScript, which involves integrating the context
into a prompt, calling the specified LLM, and extracting content from
Expand Down
Loading

0 comments on commit 4ddb91c

Please sign in to comment.