SLang files can import built-in modules and local helper modules. Built-ins are imported by name, and local modules are imported by path.Documentation Index
Fetch the complete documentation index at: https://docs.withsutro.com/llms.txt
Use this file to discover all available pages before exploring further.
Built-In Modules
The current built-in modules are:| Module | Import | Export |
|---|---|---|
| AI | import "AI" | AI.prompt(message := "text") |
| HTTP | import "HTTP" | HTTP.fetch(url := "https://api.example.com") |
import "AI" is shorthand for import "slang:AI". You can also alias built-ins with as.
AI Prompting
AI.prompt generates text. It accepts a required user message plus optional system instructions, FILE attachments, provider/model overrides, and max token settings.
openai and anthropic. If you omit provider, SLang uses the default configured provider. If you omit modelName, the module uses the default model for that provider.
Attachments must be FILE values. Store uploaded files before saving them on an entity; pass either the uploaded file or the stored file to AI.prompt.
HTTP Fetching
HTTP.fetch makes outbound HTTP or HTTPS calls and returns an object with status, headers, and optional body.
HTTP.fetch behavior:
methoddefaults toGET.- Supported methods are
GET,POST,PUT,DELETE,PATCH,OPTIONS, andHEAD. querymust be a plain object of strings, numbers, booleans, arrays of those primitives,null, orundefined.- Object request bodies are JSON-encoded and get
content-type: application/jsonunless you set a content type yourself. - JSON responses are parsed into objects; non-JSON responses return text.
Local Modules
Local imports use relative paths and only expose symbols declared withexport.
Examples:
import "./helpers"merges exported symbols into the current file.import "./helpers" as Helpersplaces exported symbols underHelpers.export action BuildTitle(title: TEXT): TEXTmakes an action importable.export entity SharedModelmakes an entity importable.
Helpers.BuildTitle(title := title) to be explicit.