You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
11
21
12
-
## Import and configuration
22
+
In order to use the runtime, you will need to install GenAIScript
23
+
in your project.
24
+
25
+
<PackageManagerspkg="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.
13
39
14
40
```js
15
41
import { initialize } from"@genaiscript/runtime";
@@ -21,3 +47,10 @@ await initialize();
21
47
## globals
22
48
23
49
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
Copy file name to clipboardExpand all lines: docs/src/content/docs/reference/scripts/cast.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ It provides a simple interface to leverage the power of LLMs for extracting data
22
22
23
23
## Usage
24
24
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
Copy file name to clipboardExpand all lines: docs/src/content/docs/reference/scripts/classify.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ It provides a simple interface to leverage the power of LLMs for classification
21
21
22
22
## Usage
23
23
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)
Copy file name to clipboardExpand all lines: docs/src/content/docs/reference/scripts/structured-output.mdx
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff 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
126
126
127
127
## `cast`
128
128
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.
0 commit comments