Skip to content

Commit 5f8bfa5

Browse files
committed
✨ Improve GenAIScript runtime documentation links
Updated broken documentation links for the runtime and helpers. Renamed files and improved descriptions to ensure clarity across pages.
1 parent 6340783 commit 5f8bfa5

8 files changed

Lines changed: 43 additions & 54 deletions

File tree

docs/src/content/docs/guides/make-it-better.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description: "Ask the LLM to make your code better!"
77

88
Surprising results happen when you repeatidely ask the LLM to "make it better" (see [blog post](https://minimaxir.com/2025/01/write-better-code/)).
99

10-
In this sample, we use the `makeItBetter` function from the [GenAIScript runtime](/genaiscript/reference/scripts/runtime)
10+
In this sample, we use the `makeItBetter` function from the [GenAIScript runtime](/genaiscript/reference/runtime)
1111
to acheive exaclty that: asking the LLM to make it better for a few rounds.
1212

1313
## Code Explanation
Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,41 @@
11
---
22
title: Runtime
3+
description: GenAIScript runtime files
34
sidebar:
4-
order: 1.2
5-
description: Learn how to run GenAIScript scripts in a Node.JS environment, including configuration
5+
order: 80
6+
keywords: runtime, GenAIScript, JavaScript, TypeScript
7+
hero:
8+
image:
9+
alt: A simple, flat 2D illustration depicts an open package box with basic
10+
digital script symbols, small code blocks, and algorithm icons rising from
11+
it. Stylized arrows represent data flow around the box. The art uses five
12+
solid corporate colors in an 8-bit, geometric, pixelated style. The image
13+
is 128x128 pixels, transparent background, no text, no people, and no
14+
shading.
15+
file: ./runtime.png
616
---
717

8-
Scripts using the `.genai.mts` (or any `.genai.*` extension) are meant to be run through the [command line interfanece](/genaiscript/reference/cli).
18+
import { PackageManagers } from "starlight-package-managers";
919

10-
This page describes how to use the runtime in a Node.JS script without using the CLI.
20+
The GenAIScript runtime provides additional helpers and allows to use the runtime in any Node.JS application.
1121

12-
## Import and configuration
22+
In order to use the runtime, you will need to install GenAIScript
23+
in your project.
24+
25+
<PackageManagers pkg="genaiscript" dev />
26+
27+
## Importing the runtime
28+
29+
The runtime is available as a module. You can import it
30+
using the following code:
31+
32+
```js
33+
import { cast } from "@genaiscript/runtime";
34+
```
35+
36+
## Initialization
37+
38+
If you are using GenAIScript without the CLI or Visual Studio Code extension, you need to initialize the runtime before using any global types or functions.
1339

1440
```js
1541
import { initialize } from "@genaiscript/runtime";
@@ -21,3 +47,10 @@ await initialize();
2147
## globals
2248

2349
The runtime installs global parsers and inline prompt types. However, the global `$`, `def`, etc... is not available, online inline prompts.
50+
51+
## Helpers
52+
53+
- [cast](/genaiscript/reference/scripts/cast), cast any data to structured outputs
54+
- [classify](/genaiscript/reference/scripts/classify), classify text
55+
- [makeItBetter](/genaiscript/guides/make-it-better), tell the LLM to improve its result
56+
- [pipeline](/genaiscript/guides/transformers-js), access to HuggingFace transformers
File renamed without changes.

docs/src/content/docs/reference/scripts/cast.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ It provides a simple interface to leverage the power of LLMs for extracting data
2222

2323
## Usage
2424

25-
`cast` is defined in the [GenAIScript runtime](/genaiscript/reference/scripts/runtime) and needs to be imported. It takes the unstructured text (or files), a JSON schema
25+
`cast` is defined in the [GenAIScript runtime](/genaiscript/reference/runtime) and needs to be imported. It takes the unstructured text (or files), a JSON schema
2626
and returns the extract data (or error).
2727

2828
```js

docs/src/content/docs/reference/scripts/classify.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ It provides a simple interface to leverage the power of LLMs for classification
2121

2222
## Usage
2323

24-
`classify` is defined in the [GenAIScript runtime](/genaiscript/reference/scripts/runtime) and needs to be imported. It takes the text to classify, a set of labels (and options for the LLM)
24+
`classify` is defined in the [GenAIScript runtime](/genaiscript/reference/runtime) and needs to be imported. It takes the text to classify, a set of labels (and options for the LLM)
2525
and returns the label provided by the LLM.
2626

2727
```js

docs/src/content/docs/reference/scripts/runtime.mdx

Lines changed: 0 additions & 44 deletions
This file was deleted.

docs/src/content/docs/reference/scripts/schemas.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ File ./data.json:
160160

161161
### Native zod support
162162

163-
The [GenAIScript runtime](/genaiscript/reference/scripts/runtime) exposes the `z` module.
163+
The [GenAIScript runtime](/genaiscript/reference/runtime) exposes the `z` module.
164164

165165
A [Zod](https://zod.dev/) type can be passed in `defSchema` and it will be automatically converted to JSON schema.
166166
The GenAIScript also exports the `z` object from Zod for convenience.

docs/src/content/docs/reference/scripts/structured-output.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ If you are looking to build a LLM-as-a-Judge and only looking for outputs in a s
126126

127127
## `cast`
128128

129-
The [cast](/genaiscript/reference/scripts/cast) function is a [GenAIScript runtime helper](/genaiscript/reference/scripts/runtime) to convert unstructured text/images into structured data.
129+
The [cast](/genaiscript/reference/scripts/cast) function is a [GenAIScript runtime helper](/genaiscript/reference/runtime) to convert unstructured text/images into structured data.
130130

131131
```js "cast"
132132
import { cast } from "@genaiscript/runtime"

0 commit comments

Comments
 (0)