🚀 Socket Launch Week Day 5:Introducing Repository Access Permissions and Custom Roles.Learn more
Sign In

@robinpath/ai

Package Overview
Dependencies
Maintainers
4
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@robinpath/ai - npm Package Compare versions

Comparing version
0.1.2
to
0.3.0
+25
dist/ai.d.ts
/**
* RobinPath AI Module (Node port).
*
* A thin, provider-agnostic LLM wrapper. Every handler takes a saved
* credential slug (type `ai_provider`) as its first argument. The slug
* encapsulates `{ provider, api_key, base_url?, default_model? }` so the
* same script works against OpenAI, Anthropic, or any OpenAI-compatible
* endpoint just by swapping the credential.
*
* This module is intentionally higher-level than the `openai` and
* `anthropic` modules — it exposes generic primitives (`chat`, `complete`,
* `summarize`, `extract`, `classify`, `translate`, `sentiment`,
* `generateJson`, `embedding`) that are useful in automations without
* forcing the author to commit to a specific vendor.
*
* Credential type:
* - ai_provider : { provider, api_key, base_url?, default_model?, default_max_tokens? }
*/
import type { BuiltinHandler, CredentialTypeSchema, FunctionMetadata, ModuleHost, ModuleMetadata } from "@robinpath/core";
export declare function configureAi(h: ModuleHost): void;
export declare const AiFunctions: Record<string, BuiltinHandler>;
export declare const AiCredentialTypes: CredentialTypeSchema[];
export declare const AiFunctionMetadata: Record<string, FunctionMetadata>;
export declare const AiModuleMetadata: ModuleMetadata;
//# sourceMappingURL=ai.d.ts.map
{"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,KAAK,EACV,cAAc,EACd,oBAAoB,EACpB,gBAAgB,EAChB,UAAU,EACV,cAAc,EAEf,MAAM,iBAAiB,CAAC;AAKzB,wBAAgB,WAAW,CAAC,CAAC,EAAE,UAAU,GAAG,IAAI,CAAoB;AA8UpE,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAEtD,CAAC;AAIF,eAAO,MAAM,iBAAiB,EAAE,oBAAoB,EA8CnD,CAAC;AA6CF,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CA4X/D,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,cAqB9B,CAAC"}
/**
* RobinPath AI Module (Node port).
*
* A thin, provider-agnostic LLM wrapper. Every handler takes a saved
* credential slug (type `ai_provider`) as its first argument. The slug
* encapsulates `{ provider, api_key, base_url?, default_model? }` so the
* same script works against OpenAI, Anthropic, or any OpenAI-compatible
* endpoint just by swapping the credential.
*
* This module is intentionally higher-level than the `openai` and
* `anthropic` modules — it exposes generic primitives (`chat`, `complete`,
* `summarize`, `extract`, `classify`, `translate`, `sentiment`,
* `generateJson`, `embedding`) that are useful in automations without
* forcing the author to commit to a specific vendor.
*
* Credential type:
* - ai_provider : { provider, api_key, base_url?, default_model?, default_max_tokens? }
*/
// ── Module state ────────────────────────────────────────────────────────
const state = {};
export function configureAi(h) { state.host = h; }
function host() {
if (!state.host)
throw new Error("AI module not initialized — use rp.installModule().");
return state.host;
}
const CREDENTIAL_TYPE = "ai_provider";
const PROVIDER_DEFAULTS = {
openai: { baseUrl: "https://api.openai.com/v1", model: "gpt-4o-mini" },
anthropic: { baseUrl: "https://api.anthropic.com/v1", model: "claude-sonnet-4-5" },
openrouter: { baseUrl: "https://openrouter.ai/api/v1", model: "openai/gpt-4o-mini" },
};
const errorReturn = (error, code, extra = {}) => ({ error, code, ...extra });
async function resolveProvider(slug) {
if (!slug)
return errorReturn("Credential slug is required.", "credential_not_found");
const fields = await host().credentials.get(slug);
if (!fields)
return errorReturn(`Credential '${slug}' not found.`, "credential_not_found");
const apiKey = String(fields.api_key ?? "");
if (!apiKey)
return errorReturn("Credential has no `api_key` field.", "api_key_missing");
const providerRaw = String(fields.provider ?? "openai").toLowerCase();
const provider = providerRaw === "anthropic" ? "anthropic" :
providerRaw === "openai" || providerRaw === "openrouter" ? "openai" :
"custom";
const defaults = PROVIDER_DEFAULTS[providerRaw] ?? { baseUrl: "", model: "" };
const baseUrl = String(fields.base_url ?? defaults.baseUrl).replace(/\/+$/, "");
if (!baseUrl)
return errorReturn("Credential has no `base_url` and provider is unrecognized.", "base_url_missing");
return {
provider,
apiKey,
baseUrl,
defaultModel: String(fields.default_model ?? defaults.model),
defaultMaxTokens: Number(fields.default_max_tokens ?? 1024),
};
}
async function callOpenAI(cfg, messages, model, maxTokens, temperature, system) {
const allMessages = system ? [{ role: "system", content: system }, ...messages] : messages;
const body = { model, messages: allMessages, max_tokens: maxTokens };
if (temperature !== undefined)
body.temperature = temperature;
let response;
try {
response = await fetch(`${cfg.baseUrl}/chat/completions`, {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: `Bearer ${cfg.apiKey}` },
body: JSON.stringify(body),
});
}
catch (e) {
return errorReturn(e instanceof Error ? e.message : String(e), "transport");
}
const raw = await response.text();
let data;
try {
data = raw ? JSON.parse(raw) : {};
}
catch {
data = { raw };
}
if (!response.ok) {
return errorReturn(`AI provider returned HTTP ${response.status}.`, response.status === 429 ? "rate_limited" : "provider_error", { status: response.status, provider_error: data.error ?? data });
}
const choices = data.choices;
const usage = data.usage;
return {
content: choices?.[0]?.message?.content ?? "",
role: "assistant",
model: data.model,
usage: usage ? {
promptTokens: usage.prompt_tokens ?? 0,
completionTokens: usage.completion_tokens ?? 0,
totalTokens: usage.total_tokens ?? 0,
} : undefined,
};
}
async function callAnthropic(cfg, messages, model, maxTokens, temperature, system) {
const body = { model, messages, max_tokens: maxTokens };
if (system)
body.system = system;
if (temperature !== undefined)
body.temperature = temperature;
let response;
try {
response = await fetch(`${cfg.baseUrl}/messages`, {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": cfg.apiKey,
"anthropic-version": "2023-06-01",
},
body: JSON.stringify(body),
});
}
catch (e) {
return errorReturn(e instanceof Error ? e.message : String(e), "transport");
}
const raw = await response.text();
let data;
try {
data = raw ? JSON.parse(raw) : {};
}
catch {
data = { raw };
}
if (!response.ok) {
return errorReturn(`AI provider returned HTTP ${response.status}.`, response.status === 429 ? "rate_limited" : "provider_error", { status: response.status, provider_error: data.error ?? data });
}
const content = data.content?.[0]?.text ?? "";
const usage = data.usage;
return {
content,
role: "assistant",
model: data.model,
usage: usage ? {
promptTokens: usage.input_tokens ?? 0,
completionTokens: usage.output_tokens ?? 0,
totalTokens: (usage.input_tokens ?? 0) + (usage.output_tokens ?? 0),
} : undefined,
stopReason: data.stop_reason,
};
}
async function doChat(slug, messagesInput, opts) {
const cfg = await resolveProvider(slug);
if ("error" in cfg)
return cfg;
const model = String(opts.model ?? cfg.defaultModel);
const maxTokens = opts.maxTokens != null ? Number(opts.maxTokens) : cfg.defaultMaxTokens;
const temperature = opts.temperature != null ? Number(opts.temperature) : undefined;
const system = opts.system != null ? String(opts.system) : undefined;
let msgs;
if (typeof messagesInput === "string") {
msgs = [{ role: "user", content: messagesInput }];
}
else if (Array.isArray(messagesInput)) {
msgs = messagesInput;
}
else {
msgs = [{ role: "user", content: String(messagesInput) }];
}
if (cfg.provider === "anthropic") {
return callAnthropic(cfg, msgs, model, maxTokens, temperature, system);
}
return callOpenAI(cfg, msgs, model, maxTokens, temperature, system);
}
// ── Handlers ────────────────────────────────────────────────────────────
const configure = async (args) => {
// `configure` validates that a given credential slug exists and echoes the
// resolved provider/model. It is NOT required to call this before chat —
// handlers resolve per-call — but it gives scripts a cheap sanity check.
const slug = String(args[0] ?? "");
const cfg = await resolveProvider(slug);
if ("error" in cfg)
return cfg;
return {
credential: slug,
provider: cfg.provider,
baseUrl: cfg.baseUrl,
defaultModel: cfg.defaultModel,
defaultMaxTokens: cfg.defaultMaxTokens,
};
};
const chat = async (args) => {
const slug = String(args[0] ?? "");
const messagesInput = args[1];
const opts = (args[2] && typeof args[2] === "object" ? args[2] : {});
return (await doChat(slug, messagesInput, opts));
};
const complete = async (args) => {
const slug = String(args[0] ?? "");
const prompt = String(args[1] ?? "");
const opts = (args[2] && typeof args[2] === "object" ? args[2] : {});
const result = await doChat(slug, prompt, opts);
if ("error" in result)
return result;
return result.content ?? "";
};
const summarize = async (args) => {
const slug = String(args[0] ?? "");
const text = String(args[1] ?? "");
const opts = (args[2] && typeof args[2] === "object" ? args[2] : {});
const hint = opts.maxLength ? `in ${Number(opts.maxLength)} words or less` : "concisely";
const prompt = `Summarize the following text ${hint}:\n\n${text}`;
return (await complete([slug, prompt, opts]));
};
const extract = async (args) => {
const slug = String(args[0] ?? "");
const text = String(args[1] ?? "");
const fields = Array.isArray(args[2])
? args[2].map(String)
: String(args[2] ?? "").split(",").map((s) => s.trim()).filter(Boolean);
const opts = (args[3] && typeof args[3] === "object" ? args[3] : {});
if (fields.length === 0)
return errorReturn("`fields` is required.", "fields_missing");
const prompt = `Extract the following fields from the text below and return ONLY a valid JSON object with these keys: ${fields.join(", ")}.\n\nText:\n${text}\n\nJSON:`;
const result = await complete([slug, prompt, { ...opts, temperature: 0 }]);
if (typeof result !== "string")
return result;
try {
const match = result.match(/\{[\s\S]*\}/);
return match ? JSON.parse(match[0]) : result;
}
catch {
return result;
}
};
const classify = async (args) => {
const slug = String(args[0] ?? "");
const text = String(args[1] ?? "");
const categories = Array.isArray(args[2])
? args[2].map(String)
: String(args[2] ?? "").split(",").map((s) => s.trim()).filter(Boolean);
const opts = (args[3] && typeof args[3] === "object" ? args[3] : {});
if (categories.length < 2)
return errorReturn("At least 2 categories are required.", "categories_missing");
const prompt = `Classify the following text into exactly one of these categories: ${categories.join(", ")}.\n\nText: ${text}\n\nRespond with ONLY the category name, nothing else.`;
const result = await complete([slug, prompt, { ...opts, temperature: 0 }]);
if (typeof result !== "string")
return result;
return result.trim();
};
const translate = async (args) => {
const slug = String(args[0] ?? "");
const text = String(args[1] ?? "");
const targetLang = String(args[2] ?? "English");
const opts = (args[3] && typeof args[3] === "object" ? args[3] : {});
const prompt = `Translate the following text to ${targetLang}. Return ONLY the translation, nothing else.\n\n${text}`;
return (await complete([slug, prompt, opts]));
};
const sentiment = async (args) => {
const slug = String(args[0] ?? "");
const text = String(args[1] ?? "");
const opts = (args[2] && typeof args[2] === "object" ? args[2] : {});
const prompt = `Analyze the sentiment of the following text. Respond with ONLY a JSON object: {"sentiment": "positive"|"negative"|"neutral", "score": 0.0-1.0, "confidence": 0.0-1.0}\n\nText: ${text}\n\nJSON:`;
const result = await complete([slug, prompt, { ...opts, temperature: 0 }]);
if (typeof result !== "string")
return result;
try {
const match = result.match(/\{[\s\S]*\}/);
return match ? JSON.parse(match[0]) : { sentiment: "neutral", score: 0.5 };
}
catch {
return { sentiment: "neutral", score: 0.5, raw: result };
}
};
const generateJson = async (args) => {
const slug = String(args[0] ?? "");
const prompt = String(args[1] ?? "");
const schema = args[2];
const opts = (args[3] && typeof args[3] === "object" ? args[3] : {});
let fullPrompt = `${prompt}\n\nRespond with ONLY a valid JSON object`;
if (schema)
fullPrompt += ` matching this structure: ${JSON.stringify(schema)}`;
fullPrompt += ". No explanations, no markdown, just JSON.";
const result = await complete([slug, fullPrompt, { ...opts, temperature: 0 }]);
if (typeof result !== "string")
return result;
try {
const match = result.match(/\{[\s\S]*\}|\[[\s\S]*\]/);
return match ? JSON.parse(match[0]) : result;
}
catch {
return result;
}
};
const embedding = async (args) => {
const slug = String(args[0] ?? "");
const input = args[1];
const opts = (args[2] && typeof args[2] === "object" ? args[2] : {});
const cfg = await resolveProvider(slug);
if ("error" in cfg)
return cfg;
const model = String(opts.model ?? "text-embedding-3-small");
const texts = Array.isArray(input) ? input.map(String) : [String(input)];
let response;
try {
response = await fetch(`${cfg.baseUrl}/embeddings`, {
method: "POST",
headers: { "Content-Type": "application/json", Authorization: `Bearer ${cfg.apiKey}` },
body: JSON.stringify({ model, input: texts }),
});
}
catch (e) {
return errorReturn(e instanceof Error ? e.message : String(e), "transport");
}
const raw = await response.text();
let data;
try {
data = raw ? JSON.parse(raw) : {};
}
catch {
data = { raw };
}
if (!response.ok) {
return errorReturn(`Embeddings provider returned HTTP ${response.status}.`, response.status === 429 ? "rate_limited" : "provider_error", { status: response.status, provider_error: data.error ?? data });
}
const embeds = data.data?.map((d) => d.embedding) ?? [];
return texts.length === 1 ? (embeds[0] ?? []) : embeds;
};
// ── Exports ─────────────────────────────────────────────────────────────
export const AiFunctions = {
configure, chat, complete, summarize, extract, classify, translate, sentiment, generateJson, embedding,
};
// ── Credential types ────────────────────────────────────────────────────
export const AiCredentialTypes = [
{
slug: CREDENTIAL_TYPE,
title: "AI Provider (generic)",
icon: "sparkles",
fields: [
{
name: "provider",
title: "Provider",
type: "text",
required: true,
placeholder: "openai",
description: "One of: `openai`, `anthropic`, `openrouter`, or a custom name. Determines the wire protocol.",
},
{
name: "api_key",
title: "API Key",
type: "password",
required: true,
description: "Provider API key. Stored encrypted.",
},
{
name: "base_url",
title: "Base URL",
type: "text",
required: false,
placeholder: "https://api.openai.com/v1",
description: "Override the provider endpoint. Required for custom / self-hosted OpenAI-compatible servers.",
},
{
name: "default_model",
title: "Default model",
type: "text",
required: false,
placeholder: "gpt-4o-mini",
description: "Used when a handler is called without an explicit `model`.",
},
{
name: "default_max_tokens",
title: "Default max tokens",
type: "number",
required: false,
description: "Default completion length. Default: 1024.",
},
],
},
];
// ── Function metadata ───────────────────────────────────────────────────
const credentialParam = {
name: "credential",
title: "Credential",
description: "Slug of a saved `ai_provider` credential.",
dataType: "string",
formInputType: "resource",
required: true,
allowExpression: true,
placeholder: "my_ai_provider",
resource: {
type: "credential",
listFn: "credential.list",
modes: ["list", "expression"],
searchable: true,
filter: { type: CREDENTIAL_TYPE },
},
};
const commonErrors = {
credential_not_found: "No credential with that slug exists in the vault.",
api_key_missing: "The credential exists but has no `api_key` field.",
base_url_missing: "The credential has no `base_url` and the provider is unrecognized.",
transport: "Network failure calling the AI provider.",
provider_error: "The provider returned an error — see `provider_error` for details.",
rate_limited: "You hit a rate limit. Slow down or upgrade your plan.",
};
const optionsParam = {
name: "options",
title: "Options",
description: "Recognized keys:\n model : default from credential\n maxTokens : default from credential (1024)\n temperature : 0–1\n system : system prompt string",
dataType: "object",
formInputType: "json",
required: false,
allowExpression: true,
language: "json",
rows: 4,
advanced: true,
};
export const AiFunctionMetadata = {
configure: {
title: "Validate AI credential",
summary: "Resolve a credential slug and echo its provider / defaults",
description: "Returns the resolved provider, base URL, default model, and default max tokens for a credential. Does not make a network call. Useful as a sanity check at the top of a script.",
group: "setup",
action: "read",
icon: "settings",
capability: "manage_options",
sideEffects: [],
idempotent: true,
since: "1.0.0",
tags: ["ai", "configure", "credential"],
parameters: [credentialParam],
returnType: "object",
returnDescription: "{ credential, provider, baseUrl, defaultModel, defaultMaxTokens }",
errors: commonErrors,
example: 'ai.configure "my_ai"',
},
chat: {
title: "Chat completion",
summary: "Send a chat message and get a structured response",
description: "Sends `messages` to the credential's provider. Returns `{content, role, model, usage}`. Pass either a string (wrapped as a single user message) or an array of `{role, content}` objects.",
group: "chat",
action: "write",
icon: "message-square",
capability: "manage_options",
sideEffects: ["makes_http_call", "charges_money"],
idempotent: false,
since: "1.0.0",
tags: ["ai", "chat", "llm", "completion"],
parameters: [
credentialParam,
{
name: "messages",
title: "Messages",
description: "String (single user prompt) or array of {role, content}.",
dataType: "any",
formInputType: "json",
required: true,
allowExpression: true,
language: "json",
rows: 6,
},
optionsParam,
],
returnType: "object",
returnDescription: "{ content, role, model, usage?: {promptTokens, completionTokens, totalTokens} }",
errors: commonErrors,
examples: [
{
title: "Ask a quick question",
code: 'ai.chat "my_ai" "Explain quantum computing in one line."',
},
{
title: "With a system prompt",
code: 'ai.chat "my_ai" [{role: "user", content: "Summarize {{ post.content }}"}] {system: "You are concise.", maxTokens: 80}',
},
],
example: 'ai.chat "my_ai" "Hi"',
},
complete: {
title: "Text completion",
summary: "Run a chat request and return just the text",
description: "Same as `chat` but unwraps the response and returns the plain text `content`.",
group: "chat",
action: "write",
icon: "type",
capability: "manage_options",
sideEffects: ["makes_http_call", "charges_money"],
idempotent: false,
since: "1.0.0",
tags: ["ai", "complete", "text"],
parameters: [
credentialParam,
{
name: "prompt",
title: "Prompt",
description: "The user prompt to send.",
dataType: "string",
formInputType: "textarea",
required: true,
allowExpression: true,
rows: 4,
},
optionsParam,
],
returnType: "string",
returnDescription: "The generated text (or error object on failure).",
errors: commonErrors,
example: 'ai.complete "my_ai" "Write a haiku about automation."',
},
summarize: {
title: "Summarize text",
summary: "Produce a concise summary of a piece of text",
description: "Wraps `complete` with a summarization prompt. Pass `maxLength` (in words) via options.",
group: "helpers",
action: "write",
icon: "list",
capability: "manage_options",
sideEffects: ["makes_http_call", "charges_money"],
idempotent: false,
since: "1.0.0",
tags: ["ai", "summarize"],
parameters: [
credentialParam,
{
name: "text",
title: "Text",
description: "The source text to summarize.",
dataType: "string",
formInputType: "textarea",
required: true,
allowExpression: true,
rows: 6,
},
{
name: "options",
title: "Options",
description: "Recognized keys:\n maxLength : target word count\n model / maxTokens / temperature",
dataType: "object",
formInputType: "json",
required: false,
allowExpression: true,
language: "json",
rows: 3,
advanced: true,
},
],
returnType: "string",
returnDescription: "The summary text.",
errors: commonErrors,
example: 'ai.summarize "my_ai" {{ post.content }} {maxLength: 50}',
},
extract: {
title: "Extract structured fields",
summary: "Pull named fields out of text as a JSON object",
description: "Asks the model to return a JSON object with the given keys. Temperature is forced to 0.",
group: "helpers",
action: "write",
icon: "box-select",
capability: "manage_options",
sideEffects: ["makes_http_call", "charges_money"],
idempotent: true,
since: "1.0.0",
tags: ["ai", "extract", "json"],
parameters: [
credentialParam,
{
name: "text",
title: "Text",
description: "Unstructured source text.",
dataType: "string",
formInputType: "textarea",
required: true,
allowExpression: true,
rows: 6,
},
{
name: "fields",
title: "Fields",
description: "Array of field names (or comma-separated string) to extract.",
dataType: "array",
formInputType: "json",
required: true,
allowExpression: true,
language: "json",
rows: 2,
placeholder: '["name", "email", "company"]',
},
optionsParam,
],
returnType: "object",
returnDescription: "Parsed JSON object with the requested keys, or raw text on parse failure.",
errors: { ...commonErrors, fields_missing: "You must pass at least one field name." },
example: 'ai.extract "my_ai" "John Smith, 30, NYC" ["name","age","city"]',
},
classify: {
title: "Classify into categories",
summary: "Pick exactly one category for a piece of text",
description: "Returns the category label chosen by the model. Temperature is forced to 0.",
group: "helpers",
action: "write",
icon: "tag",
capability: "manage_options",
sideEffects: ["makes_http_call", "charges_money"],
idempotent: true,
since: "1.0.0",
tags: ["ai", "classify"],
parameters: [
credentialParam,
{
name: "text",
title: "Text",
description: "Text to classify.",
dataType: "string",
formInputType: "textarea",
required: true,
allowExpression: true,
rows: 4,
},
{
name: "categories",
title: "Categories",
description: "Array (at least 2) of category labels to choose from.",
dataType: "array",
formInputType: "json",
required: true,
allowExpression: true,
language: "json",
rows: 2,
placeholder: '["billing","support","sales","spam"]',
},
optionsParam,
],
returnType: "string",
returnDescription: "The selected category label.",
errors: { ...commonErrors, categories_missing: "At least 2 categories are required." },
example: 'ai.classify "my_ai" "Love this product!" ["positive","negative","neutral"]',
},
translate: {
title: "Translate text",
summary: "Translate a string to a target language",
description: "Wraps `complete` with a translation prompt. Pass the language name (e.g. 'Spanish') as the third arg.",
group: "helpers",
action: "write",
icon: "languages",
capability: "manage_options",
sideEffects: ["makes_http_call", "charges_money"],
idempotent: true,
since: "1.0.0",
tags: ["ai", "translate"],
parameters: [
credentialParam,
{
name: "text",
title: "Text",
description: "Text to translate.",
dataType: "string",
formInputType: "textarea",
required: true,
allowExpression: true,
rows: 4,
},
{
name: "targetLang",
title: "Target language",
description: "Human-readable target language (e.g. 'Spanish', 'French').",
dataType: "string",
formInputType: "text",
required: true,
allowExpression: true,
placeholder: "Spanish",
},
optionsParam,
],
returnType: "string",
returnDescription: "The translated text.",
errors: commonErrors,
example: 'ai.translate "my_ai" "Hello world" "French"',
},
sentiment: {
title: "Analyze sentiment",
summary: "Classify text as positive / negative / neutral with a score",
description: "Returns `{sentiment, score, confidence}`. Temperature is forced to 0.",
group: "helpers",
action: "write",
icon: "smile",
capability: "manage_options",
sideEffects: ["makes_http_call", "charges_money"],
idempotent: true,
since: "1.0.0",
tags: ["ai", "sentiment"],
parameters: [
credentialParam,
{
name: "text",
title: "Text",
description: "Text to analyze.",
dataType: "string",
formInputType: "textarea",
required: true,
allowExpression: true,
rows: 4,
},
optionsParam,
],
returnType: "object",
returnDescription: "{ sentiment: 'positive'|'negative'|'neutral', score: 0..1, confidence: 0..1 }",
errors: commonErrors,
example: 'ai.sentiment "my_ai" "This is amazing!"',
},
generateJson: {
title: "Generate structured JSON",
summary: "Ask the model to produce JSON matching an optional schema",
description: "Returns the parsed JSON object (or raw text on parse failure). Temperature is forced to 0.",
group: "helpers",
action: "write",
icon: "braces",
capability: "manage_options",
sideEffects: ["makes_http_call", "charges_money"],
idempotent: true,
since: "1.0.0",
tags: ["ai", "json", "schema"],
parameters: [
credentialParam,
{
name: "prompt",
title: "Prompt",
description: "Describe what JSON you want.",
dataType: "string",
formInputType: "textarea",
required: true,
allowExpression: true,
rows: 4,
},
{
name: "schema",
title: "Schema",
description: "Optional example object that the output should mirror.",
dataType: "object",
formInputType: "json",
required: false,
allowExpression: true,
language: "json",
rows: 4,
},
optionsParam,
],
returnType: "object",
returnDescription: "Parsed JSON (or raw text on parse failure).",
errors: commonErrors,
example: 'ai.generateJson "my_ai" "Make a fake user" {name: "string", email: "string"}',
},
embedding: {
title: "Create embedding",
summary: "Get a vector embedding for text(s)",
description: "Calls `/embeddings` against the credential's provider. Expects an OpenAI-style embeddings endpoint — works for OpenAI, OpenRouter, and most compatible APIs. Anthropic currently has no hosted embeddings endpoint.",
group: "chat",
action: "write",
icon: "binary",
capability: "manage_options",
sideEffects: ["makes_http_call", "charges_money"],
idempotent: true,
since: "1.0.0",
tags: ["ai", "embedding", "vector"],
parameters: [
credentialParam,
{
name: "input",
title: "Input",
description: "A string or array of strings to embed.",
dataType: "any",
formInputType: "json",
required: true,
allowExpression: true,
language: "json",
rows: 3,
},
{
name: "options",
title: "Options",
description: "Recognized keys:\n model : default 'text-embedding-3-small'",
dataType: "object",
formInputType: "json",
required: false,
allowExpression: true,
language: "json",
rows: 3,
advanced: true,
},
],
returnType: "any",
returnDescription: "A vector (for a single string) or array of vectors (for multiple inputs).",
errors: commonErrors,
example: 'ai.embedding "my_ai" "Hello world"',
},
};
export const AiModuleMetadata = {
slug: "ai",
title: "AI (generic LLM)",
summary: "Provider-agnostic LLM helpers: chat, complete, summarize, extract, classify, translate, sentiment, JSON, embeddings",
description: "A thin provider-agnostic wrapper. Point a single `ai_provider` credential at OpenAI, Anthropic, OpenRouter, or any OpenAI-compatible endpoint and every handler just works. Use the dedicated `openai` / `anthropic` modules when you need vendor-specific features (images, audio, vision, tool use).",
category: "ai",
icon: "icon.svg",
color: "#7C3AED",
version: "0.2.0",
docsUrl: "https://docs.robinpath.com/modules/ai",
status: "stable",
requires: [],
minNodeVersion: "18.0.0",
credentialsType: CREDENTIAL_TYPE,
operationGroups: {
setup: { title: "Setup", description: "Credential validation.", order: 1 },
chat: { title: "Chat & Embeddings", description: "Core LLM calls.", order: 2 },
helpers: { title: "Helpers", description: "Sugar for common tasks.", order: 3 },
},
methods: Object.keys(AiFunctions),
};
//# sourceMappingURL=ai.js.map
{"version":3,"file":"ai.js","sourceRoot":"","sources":["../src/ai.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAWH,2EAA2E;AAE3E,MAAM,KAAK,GAA0B,EAAE,CAAC;AACxC,MAAM,UAAU,WAAW,CAAC,CAAa,IAAU,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC;AACpE,SAAS,IAAI;IACX,IAAI,CAAC,KAAK,CAAC,IAAI;QAAE,MAAM,IAAI,KAAK,CAAC,qDAAqD,CAAC,CAAC;IACxF,OAAO,KAAK,CAAC,IAAI,CAAC;AACpB,CAAC;AAED,MAAM,eAAe,GAAG,aAAa,CAAC;AAEtC,MAAM,iBAAiB,GAAuD;IAC5E,MAAM,EAAE,EAAE,OAAO,EAAE,2BAA2B,EAAE,KAAK,EAAE,aAAa,EAAE;IACtE,SAAS,EAAE,EAAE,OAAO,EAAE,8BAA8B,EAAE,KAAK,EAAE,mBAAmB,EAAE;IACl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,EAAE,EAAE;IACZ,cAAc,EAAE,QAAQ;IACxB,eAAe,EAAE,eAAe;IAChC,eAAe,EAAE;QACf,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,wBAAwB,EAAE,KAAK,EAAE,CAAC,EAAE;QAC1E,IAAI,EAAE,EAAE,KAAK,EAAE,mBAAmB,EAAE,WAAW,EAAE,iBAAiB,EAAE,KAAK,EAAE,CAAC,EAAE;QAC9E,OAAO,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,yBAAyB,EAAE,KAAK,EAAE,CAAC,EAAE;KAChF;IACD,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC;CAClC,CAAC"}
import type { ModuleAdapter } from "@robinpath/core";
declare const AiModule: ModuleAdapter;
export default AiModule;
export { AiModule };
export { AiFunctions, AiFunctionMetadata, AiModuleMetadata, AiCredentialTypes, configureAi, } from "./ai.js";
//# sourceMappingURL=index.d.ts.map
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AASrD,QAAA,MAAM,QAAQ,EAAE,aAQf,CAAC;AAEF,eAAe,QAAQ,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,GACZ,MAAM,SAAS,CAAC"}
import { AiFunctions, AiFunctionMetadata, AiModuleMetadata, AiCredentialTypes, configureAi, } from "./ai.js";
const AiModule = {
name: "ai",
functions: AiFunctions,
functionMetadata: AiFunctionMetadata,
moduleMetadata: AiModuleMetadata,
credentialTypes: AiCredentialTypes,
configure: configureAi,
global: false,
};
export default AiModule;
export { AiModule };
export { AiFunctions, AiFunctionMetadata, AiModuleMetadata, AiCredentialTypes, configureAi, } from "./ai.js";
//# sourceMappingURL=index.js.map
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,GACZ,MAAM,SAAS,CAAC;AAEjB,MAAM,QAAQ,GAAkB;IAC9B,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,WAAW;IACtB,gBAAgB,EAAE,kBAAkB;IACpC,cAAc,EAAE,gBAAgB;IAChC,eAAe,EAAE,iBAAiB;IAClC,SAAS,EAAE,WAAW;IACtB,MAAM,EAAE,KAAK;CACd,CAAC;AAEF,eAAe,QAAQ,CAAC;AACxB,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,WAAW,GACZ,MAAM,SAAS,CAAC"}
+17
-7
{
"name": "@robinpath/ai",
"version": "0.1.2",
"description": "LLM integration for OpenAI, Anthropic, and compatible APIs",
"version": "0.3.0",
"description": "Provider-agnostic LLM helpers (OpenAI, Anthropic, OpenRouter, or any OpenAI-compatible endpoint). Uses the encrypted credential vault.",
"publishConfig": {

@@ -25,6 +25,6 @@ "access": "public"

"peerDependencies": {
"@robinpath/core": ">=0.20.0"
"@robinpath/core": ">=0.40.0"
},
"devDependencies": {
"@robinpath/core": "^0.30.1",
"@robinpath/core": "^0.40.0",
"tsx": "^4.19.0",

@@ -34,3 +34,6 @@ "typescript": "^5.6.0"

"keywords": [
"ai"
"ai",
"llm",
"openai",
"anthropic"
],

@@ -41,5 +44,12 @@ "license": "MIT",

"type": "integration",
"auth": "api-key",
"functionCount": 10
"auth": "credential-vault",
"credentialType": "ai_provider",
"functionCount": 10,
"language": "nodejs",
"platforms": [
"cloud",
"cli",
"desktop"
]
}
}

@@ -22,3 +22,3 @@ # @robinpath/ai

```bash
npm install @robinpath/ai
robinpath add @robinpath/ai
```

@@ -25,0 +25,0 @@