Modules@robinpath/ai

@robinpath/ai

0.1.1Public

LLM integration for OpenAI, Anthropic, and compatible APIs

@robinpath/ai

LLM integration: chat, complete, summarize, extract, classify, translate, sentiment analysis, and embeddings

Category Functions Auth License

Why use this module?

The ai module lets you:

  • Send a chat message and get a response
  • Get a simple text completion (returns just the text)
  • Summarize text using AI
  • Extract structured data from text using AI
  • Classify text into one of given categories

All functions are callable directly from RobinPath scripts with a simple, consistent API.

Installation

npm install @robinpath/ai

Quick Start

1. Set up credentials

ai.configure "openai" {"provider": "openai", "apiKey": $key}

2. Send a chat message and get a response

ai.chat "openai" "Explain quantum computing" {"system": "You are a teacher"}

Available Functions

FunctionDescription
ai.configureConfigure an AI provider (OpenAI, Anthropic, or custom)
ai.chatSend a chat message and get a response
ai.completeGet a simple text completion (returns just the text)
ai.summarizeSummarize text using AI
ai.extractExtract structured data from text using AI
ai.classifyClassify text into one of given categories
ai.translateTranslate text to a target language
ai.sentimentAnalyze the sentiment of text
ai.generateJsonGenerate structured JSON from a prompt
ai.embeddingGenerate text embeddings (OpenAI only)

Examples

Send a chat message and get a response

ai.chat "openai" "Explain quantum computing" {"system": "You are a teacher"}

Get a simple text completion (returns just the text)

ai.complete "openai" "Write a haiku about automation"

Summarize text using AI

ai.summarize "openai" $longText {"maxLength": 100}

Integration with RobinPath

import { RobinPath } from "@wiredwp/robinpath";
import Module from "@robinpath/ai";

const rp = new RobinPath();
rp.registerModule(Module.name, Module.functions);
rp.registerModuleMeta(Module.name, Module.functionMetadata);

const result = await rp.executeScript(`
  ai.configure "openai" {"provider": "openai", "apiKey": $key}
  ai.chat "openai" "Explain quantum computing" {"system": "You are a teacher"}
`);

Full API Reference

See MODULE.md for complete documentation including all parameters, return types, error handling, and advanced examples.

Related Modules

License

MIT

Versions (1)

VersionTagPublished
0.1.1latestyesterday
Install
$ robinpath install @robinpath/ai
Version0.1.1
LicenseMIT
Unpacked Size6.3 KB
Versions1
Weekly Downloads0
Total Downloads0
Stars0
Last Publishyesterday
Createdyesterday

Category

ai