AI
Model calls, classification, safety, embeddings and vector search. Each function lists its parameters, defaults and return value.
LLM Namespace
Section titled “LLM Namespace”LLM chat and completion functions.
Scope: System
Functions
Section titled “Functions”| Function | Description |
|---|---|
llm.chat() | LLM chat completion with multi-turn messages |
llm.complete() | LLM text completion with a single prompt |
llm.chat()
Section titled “llm.chat()”Perform LLM chat completion with multi-turn message history.
Note: This function requires a pipeline environment with ProxySelector for model routing. Use the YAML interface (chat task with type: chat) for full functionality. The script namespace stub returns an error directing to the YAML interface.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
messages | array | — | Chat messages with role and content fields (required) |
selection | map | {} | Model selection criteria |
temperature | float | 1.0 | Sampling temperature |
maxtokens | int | 200 | Maximum tokens to generate |
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether the completion succeeded |
error | string | Error message (stub always returns error) |
Examples
Section titled “Examples”// Note: Requires pipeline environment. This stub returns an error.let result = llm.chat({ messages: [ { role: "system", content: "You are a helpful assistant." }, { role: "user", content: "What is machine learning?" } ], selection: { model: "gpt-4" }, maxtokens: 500})// Use the chat YAML task with type: chat insteadllm.complete()
Section titled “llm.complete()”Perform LLM text completion with a single prompt.
Note: This function requires a pipeline environment with ProxySelector for model routing. Use the YAML interface (chat task with type: completion) for full functionality. The script namespace stub returns an error directing to the YAML interface.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
prompt | string | — | Prompt text for completion (required) |
selection | map | {} | Model selection criteria |
temperature | float | 1.0 | Sampling temperature |
maxtokens | int | 200 | Maximum tokens to generate |
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether the completion succeeded |
error | string | Error message (stub always returns error) |
Examples
Section titled “Examples”// Note: Requires pipeline environment. This stub returns an error.let result = llm.complete({ prompt: "Summarize the following text: ...", selection: { accuracy: "high" }, temperature: 0.7, maxtokens: 300})// Use the chat YAML task with type: completion insteadIntent Namespace
Section titled “Intent Namespace”Intent classification functions.
Scope: System
Functions
Section titled “Functions”| Function | Description |
|---|---|
intent.classify() | Classify the intent of a user prompt |
intent.classify()
Section titled “intent.classify()”Classify the intent of user prompts by sending them to an intent classification model endpoint.
Note: This function requires a pipeline environment with ProxySelector for model routing. Use the YAML interface (getintent task) for full functionality. The script namespace stub returns an error directing to the YAML interface.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
prompt | string | — | Prompt to classify (required) |
selection | map | {} | Model selection criteria |
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether the classification succeeded |
error | string | Error message (stub always returns error) |
Examples
Section titled “Examples”// Note: Requires pipeline environment. This stub returns an error.let result = intent.classify({ prompt: "I want to book a flight to New York"})// Use the getintent YAML task insteadGuard Namespace
Section titled “Guard Namespace”LLM safety classification functions.
Scope: System
Functions
Section titled “Functions”| Function | Description |
|---|---|
guard.check() | Classify content safety using Llama Guard |
guard.check()
Section titled “guard.check()”Classify user prompts or agent responses against unsafe content categories (S1–S11).
Note: This function requires a pipeline environment with ProxySelector for model routing. Use the YAML interface (pre-guard/post-guard tasks) for full functionality. The script namespace stub returns an error directing to the YAML interface.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
prompt | string | — | Content to classify (required) |
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether the classification completed |
error | string | Error message (stub always returns error) |
Unsafe Content Categories
Section titled “Unsafe Content Categories”| Category | Description |
|---|---|
| S1 | Violent Crimes |
| S2 | Non-Violent Crimes |
| S3 | Sex Crimes |
| S4 | Child Exploitation |
| S5 | Specialized Advice |
| S6 | Privacy |
| S7 | Intellectual Property |
| S8 | Indiscriminate Weapons |
| S9 | Hate |
| S10 | Self-Harm |
| S11 | Sexual Content |
Examples
Section titled “Examples”// Note: Requires pipeline environment. This stub returns an error.let result = guard.check({ prompt: "Is this message safe?"})// Use the pre-guard/post-guard YAML tasks insteadEmbed Namespace
Section titled “Embed Namespace”Embedding generation and text splitting functions.
Scope: System
Functions
Section titled “Functions”| Function | Description |
|---|---|
embed.generate() | Generate vector embeddings (requires pipeline) |
embed.split() | Split text data by delimiter or by length |
embed.generate()
Section titled “embed.generate()”Generate vector embeddings from text data.
Note: This function requires a pipeline environment with ProxySelector for model routing. Use the YAML interface (embed or embeddata tasks) for full functionality. The script namespace stub returns an error directing to the YAML interface.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
data | array | — | Array of text strings to embed (required) |
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether embedding generation succeeded |
error | string | Error message (stub always returns error) |
Examples
Section titled “Examples”// Note: Requires pipeline environment. This stub returns an error.let result = embed.generate({ data: ["Hello world", "Machine learning is great"]})// Use the embed or embeddata YAML tasks insteadembed.split()
Section titled “embed.split()”Split text data into chunks by delimiter or by character length. Works independently without requiring a pipeline environment.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
data | array | — | Array of text strings to split (required) |
delimiter | string | — | Delimiter string to split by |
length | int | — | Character length to split into chunks |
One of delimiter or length is required.
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether the split succeeded |
result | array | Array of arrays — one split-result array per input string |
error | string | Error message if failed |
Examples
Section titled “Examples”// Split by delimiterlet result = embed.split({ data: ["Hello world. This is a test.", "Another document here."], delimiter: ". "})// result.result = [["Hello world", "This is a test."], ["Another document here."]]
// Split by character lengthlet result = embed.split({ data: ["A long text that needs to be split into smaller chunks for embedding"], length: 20})// result.result = [["A long text that nee", "ds to be split into ", "smaller chunks for e", "mbedding"]]
// Split paragraphs for embedding preplet result = embed.split({ data: [ "First paragraph content.\n\nSecond paragraph content.\n\nThird paragraph.", "Another document.\n\nWith two paragraphs." ], delimiter: "\n\n"})for (let i = 0; i < result.result.length; i++) { log("Document " + i + " has " + result.result[i].length + " chunks")}AI Knowledge Namespace
Section titled “AI Knowledge Namespace”AI Knowledge vector store functions.
Scope: System
Functions
Section titled “Functions”| Function | Description |
|---|---|
ai-knowledge.embed() | Send embeddings to a AI Knowledge vector store REST endpoint |
ai-knowledge.embed()
Section titled “ai-knowledge.embed()”Send embeddings and associated data to a AI Knowledge vector store REST endpoint.
Note: This function requires a pipeline environment with REST service connection. Use the YAML interface (ai-knowledge task) for full functionality. The script namespace stub returns an error directing to the YAML interface.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
url | string | — | AI Knowledge REST endpoint URL (required) |
embeddingskey | string | — | Environment key for embeddings data (required) |
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether the operation succeeded |
error | string | Error message (stub always returns error) |
Examples
Section titled “Examples”// Note: Requires pipeline environment. This stub returns an error.let result = ai-knowledge.embed({ url: "https://ai-knowledge.example.com/v1/documents", embeddingskey: "embeddings"})// Use the ai-knowledge YAML task insteadMilvus Namespace
Section titled “Milvus Namespace”Milvus vector database functions. Provides insert, search, query, list, and delete operations for vector collections with tenant-based database isolation.
Scope: System
Functions
Section titled “Functions”| Function | Description |
|---|---|
milvus.insert() | Insert vector embeddings into a collection |
milvus.search() | Vector similarity search in a collection |
milvus.query() | Query records by field filters |
milvus.list() | List unique topic names for a user |
milvus.delete() | Delete records by user/topic/URL |
Note: All Milvus functions require a pipeline environment with Milvus client connection and tenant context. Use the YAML interface (topics tasks) for full functionality. The script namespace stubs return errors directing to the YAML interface.
milvus.insert()
Section titled “milvus.insert()”Insert vector embeddings into a Milvus collection.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
url | string | — | Milvus gRPC endpoint URL (required) |
collection | string | — | Collection name (required) |
embeddings | string | — | Environment key for embeddings data (required) |
userid | string | — | User ID for inserted records (required) |
topic | string | — | Topic name for inserted records (required) |
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether the insert succeeded |
error | string | Error message (stub always returns error) |
Examples
Section titled “Examples”// Note: Requires pipeline environment. This stub returns an error.let result = milvus.insert({ url: "localhost:19530", collection: "knowledge_base", embeddings: "embeddingresult", userid: "user123", topic: "machine-learning"})// Use the topicsinsert YAML task insteadmilvus.search()
Section titled “milvus.search()”Perform vector similarity search using L2 distance.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
url | string | — | Milvus gRPC endpoint URL (required) |
collection | string | — | Collection name (required) |
embeddings | string | — | Environment key for query embedding (required) |
topic | string | — | Topic name to filter by (required) |
userid | string | — | User ID to filter by |
limit | int | 3 | Maximum results (top-k) |
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether the search succeeded |
error | string | Error message (stub always returns error) |
Examples
Section titled “Examples”// Note: Requires pipeline environment. This stub returns an error.let result = milvus.search({ url: "localhost:19530", collection: "knowledge_base", embeddings: "queryembedding", topic: "machine-learning", limit: 5})// Use the topicssearch YAML task insteadmilvus.query()
Section titled “milvus.query()”Query records from a collection using field-based filters.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
url | string | — | Milvus gRPC endpoint URL (required) |
collection | string | — | Collection name (required) |
topic | string | — | Topic name to query by (required) |
userid | string | — | User ID to filter by |
limit | int | 3 | Maximum results |
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether the query succeeded |
error | string | Error message (stub always returns error) |
Examples
Section titled “Examples”// Note: Requires pipeline environment. This stub returns an error.let result = milvus.query({ url: "localhost:19530", collection: "knowledge_base", topic: "machine-learning", limit: 10})// Use the topicsquery YAML task insteadmilvus.list()
Section titled “milvus.list()”List unique topic names for a user from a collection.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
url | string | — | Milvus gRPC endpoint URL (required) |
collection | string | — | Collection name (required) |
userid | string | — | User ID to filter by (required) |
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether the listing succeeded |
error | string | Error message (stub always returns error) |
Examples
Section titled “Examples”// Note: Requires pipeline environment. This stub returns an error.let result = milvus.list({ url: "localhost:19530", collection: "knowledge_base", userid: "user123"})// Use the topicslist YAML task insteadmilvus.delete()
Section titled “milvus.delete()”Delete records from a collection by user, topic, and optional URL.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
url | string | — | Milvus gRPC endpoint URL (required) |
collection | string | — | Collection name (required) |
userid | string | — | User ID to delete by (required) |
topic | string | — | Topic name to delete by (required) |
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether the delete succeeded |
error | string | Error message (stub always returns error) |
Examples
Section titled “Examples”// Note: Requires pipeline environment. This stub returns an error.let result = milvus.delete({ url: "localhost:19530", collection: "knowledge_base", userid: "user123", topic: "old-topic"})// Use the topicsdelete YAML task insteadText Namespace
Section titled “Text Namespace”Text transformation functions.
Scope: System
Functions
Section titled “Functions”| Function | Description |
|---|---|
text.tosentence() | Convert entity YAML to natural language sentences (requires pipeline) |
text.split() | Split text by delimiter or by length |
text.tosentence()
Section titled “text.tosentence()”Convert entity YAML definitions into natural language sentences.
Note: This function requires entity YAML context from the pipeline environment. Use the YAML interface (tosentence task) for full functionality. The script namespace stub returns an error directing to the YAML interface.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
entityyaml | string | — | Entity YAML string to convert (required) |
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether the conversion succeeded |
error | string | Error message (stub always returns error) |
Examples
Section titled “Examples”// Note: Requires pipeline environment. This stub returns an error.let result = text.tosentence({ entityyaml: "name: User\nfields:\n - name: email\n type: string"})// Use the tosentence YAML task insteadtext.split()
Section titled “text.split()”Split text by a delimiter string or by character length.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
text | string | — | Text to split (required) |
delimiter | string | — | Delimiter string to split by |
length | int | — | Character length to split into chunks |
One of delimiter or length is required.
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether the split succeeded |
result | array | Array of text chunks |
error | string | Error message if failed |
Examples
Section titled “Examples”// Split by delimiterlet result = text.split({ text: "hello world. this is a test. another sentence.", delimiter: ". "})// result.result = ["hello world", "this is a test", "another sentence."]
// Split by lengthlet result = text.split({ text: "The quick brown fox jumps over the lazy dog", length: 10})// result.result = ["The quick ", "brown fox ", "jumps over", " the lazy ", "dog"]
// Split paragraphslet result = text.split({ text: "First paragraph.\n\nSecond paragraph.\n\nThird paragraph.", delimiter: "\n\n"})for (let part of result.result) { log("Paragraph: " + part)}Validate Namespace
Section titled “Validate Namespace”JSON and YAML schema validation functions.
Scope: System
Functions
Section titled “Functions”| Function | Description |
|---|---|
validate.json() | Validate a JSON value against a JSON schema |
validate.yaml() | Validate a YAML value against a JSON schema |
validate.json()
Section titled “validate.json()”Validate a JSON value against a JSON schema using the JSON Schema specification.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
schema | string | — | JSON schema string (required) |
value | string | — | JSON value string to validate (required) |
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether the validation completed |
valid | bool | Whether the value matches the schema |
error | string | Validation error details if invalid, or error message if failed |
Examples
Section titled “Examples”// Validate a JSON objectlet result = validate.json({ schema: '{"type": "object", "properties": {"name": {"type": "string"}, "age": {"type": "integer"}}, "required": ["name"]}', value: '{"name": "Alice", "age": 30}'})if (result.success && result.valid) { log("JSON is valid")}
// Check for validation errorslet result = validate.json({ schema: '{"type": "object", "required": ["email"]}', value: '{"name": "Bob"}'})if (result.success && !result.valid) { log("Validation error: " + result.error)}
// Validate an arraylet result = validate.json({ schema: '{"type": "array", "items": {"type": "number"}}', value: '[1, 2, 3]'})log("Valid: " + result.valid)validate.yaml()
Section titled “validate.yaml()”Validate a YAML value against a JSON schema. The YAML is parsed and then validated using the JSON Schema specification.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
schema | string | — | JSON schema string (required) |
value | string | — | YAML value string to validate (required) |
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether the validation completed |
valid | bool | Whether the value matches the schema |
error | string | Validation error details if invalid, or error message if failed |
Examples
Section titled “Examples”// Validate a YAML configlet result = validate.yaml({ schema: '{"type": "object", "properties": {"name": {"type": "string"}, "version": {"type": "string"}}, "required": ["name"]}', value: "name: my-app\nversion: 1.0.0"})if (result.success && result.valid) { log("YAML config is valid")}
// Validate YAML against a schemalet result = validate.yaml({ schema: '{"type": "object", "properties": {"port": {"type": "integer"}}, "required": ["port"]}', value: "host: localhost\nport: 8080"})log("Valid: " + result.valid)
// Check for missing required fieldslet result = validate.yaml({ schema: '{"type": "object", "required": ["name", "email"]}', value: "name: Alice"})if (!result.valid) { log("Missing fields: " + result.error)}Scrape Namespace
Section titled “Scrape Namespace”Web and document scraping functions.
Scope: System
Functions
Section titled “Functions”| Function | Description |
|---|---|
scrape.web() | Scrape content from web URLs |
scrape.pdf() | Scrape text from PDF files |
scrape.excel() | Scrape content from Excel files |
scrape.docx() | Scrape text from DOCX files |
scrape.pptx() | Scrape text from PPTX files |
Note: All scrape functions require a pipeline environment with ProxySelector for service routing (except scrape.excel which processes files directly). Use the YAML interface (scrape tasks) for full functionality. The script namespace stubs return errors directing to the YAML interface.
scrape.web()
Section titled “scrape.web()”Scrape content from web URLs with configurable crawl depth and page limits.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
urls | array | — | URLs to scrape (required) |
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether the scrape succeeded |
error | string | Error message (stub always returns error) |
Examples
Section titled “Examples”// Note: Requires pipeline environment. This stub returns an error.let result = scrape.web({ urls: ["https://docs.example.com/guide"]})// Use the scrapedata YAML task insteadscrape.pdf()
Section titled “scrape.pdf()”Scrape text content from PDF files via a remote scraping service.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
url | string | — | URL of the PDF file (required) |
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether the scrape succeeded |
error | string | Error message (stub always returns error) |
Examples
Section titled “Examples”// Note: Requires pipeline environment. This stub returns an error.let result = scrape.pdf({ url: "https://example.com/document.pdf"})// Use the scrape-pdf YAML task insteadscrape.excel()
Section titled “scrape.excel()”Scrape content from Excel files.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
file | string | — | URL of the Excel file (required) |
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether the scrape succeeded |
error | string | Error message (stub always returns error) |
Examples
Section titled “Examples”// Note: Requires pipeline environment. This stub returns an error.let result = scrape.excel({ file: "https://example.com/data.xlsx"})// Use the scrape-excel YAML task insteadscrape.docx()
Section titled “scrape.docx()”Scrape text content from DOCX files via a remote scraping service.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
url | string | — | URL of the DOCX file (required) |
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether the scrape succeeded |
error | string | Error message (stub always returns error) |
Examples
Section titled “Examples”// Note: Requires pipeline environment. This stub returns an error.let result = scrape.docx({ url: "https://example.com/document.docx"})// Use the scrape-docx YAML task insteadscrape.pptx()
Section titled “scrape.pptx()”Scrape text content from PPTX (PowerPoint) files via a remote scraping service.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
url | string | — | URL of the PPTX file (required) |
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether the scrape succeeded |
error | string | Error message (stub always returns error) |
Examples
Section titled “Examples”// Note: Requires pipeline environment. This stub returns an error.let result = scrape.pptx({ url: "https://example.com/presentation.pptx"})// Use the scrape-pptx YAML task insteadPipeline Namespace
Section titled “Pipeline Namespace”ML pipeline chat, request, and response functions for streaming multi-turn conversations within data pipelines.
Scope: System
Functions
Section titled “Functions”| Function | Description |
|---|---|
pipeline.chat() | Stream pipeline ML chat with conversation memory |
pipeline.request() | Stream pipeline request ingestion |
pipeline.response() | Stream pipeline response delivery |
Note: All pipeline functions require a pipeline environment with ProxySelector, pipe, and record context. Use the YAML interface (mlpipeline tasks) for full functionality. The script namespace stubs return errors directing to the YAML interface.
pipeline.chat()
Section titled “pipeline.chat()”Stream pipeline ML chat. Reads incoming data records, builds chat messages from conversation memory, and delegates to the chat task.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
selection | map | {} | Model selection criteria |
promptkey | string | — | Record field name containing the user prompt |
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether the chat succeeded |
error | string | Error message (stub always returns error) |
Examples
Section titled “Examples”// Note: Requires pipeline environment. This stub returns an error.let result = pipeline.chat({ selection: { model: "gpt-4" }, promptkey: "message"})// Use the mlpipelinechat/mlpipechat YAML task insteadpipeline.request()
Section titled “pipeline.request()”Stream pipeline request ingestion. Reads incoming data records and forwards them with conversation context.
Parameters
Section titled “Parameters”No additional parameters required beyond pipeline wiring.
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether the request was processed |
error | string | Error message (stub always returns error) |
Examples
Section titled “Examples”// Note: Requires pipeline environment. This stub returns an error.let result = pipeline.request({})// Use the mlpipelinerequest/mlpiperequest YAML task insteadpipeline.response()
Section titled “pipeline.response()”Stream pipeline response delivery. Reads processed records and submits them to an external URL via HTTP POST.
Parameters
Section titled “Parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
url | string | — | URL to submit the response to (required) |
Returns
Section titled “Returns”| Field | Type | Description |
|---|---|---|
success | bool | Whether the response was delivered |
error | string | Error message (stub always returns error) |
Examples
Section titled “Examples”// Note: Requires pipeline environment. This stub returns an error.let result = pipeline.response({ url: "https://api.example.com/v1/conversation/response"})// Use the mlpipelineresponse/mlpiperesponse YAML task instead