https://github.com/robbie-wasabi/llmonade
A simple yet powerful SDK for building conversational AI assistants using OpenAI. Supports both text and voice interactions.
- Builder pattern for easy configuration
- Text and Voice assistant support
- Extensible tools system
- Real-time voice interactions
- Event-driven architecture
- File storage capabilities
- Easily integrate with Discord, telegram, etc... (less than 40 lines of code total - see example)
deno add @robbie-wasabi/llmonadeOr via JSR:
jsr add @robbie-wasabi/llmonadeimport { TextAssistant } from "@robbie-wasabi/llmonade"
const assistant = TextAssistant.new()
.withModel("gpt-4o")
.withInstructions("You are a helpful assistant")
.onThinking(() => console.log("🤔"))
.onReply((message) => console.log(`🤖: ${message}`))
const reply = await assistant.chat("Hello!")import { VoiceAssistant } from "@robbie-wasabi/llmonade"
VoiceAssistant.new()
.withVoice("nova")
.withInstructions("You are a helpful assistant")
.withOpts({
turnDetection: {
type: "server_vad",
threshold: 0.5,
prefix_padding_ms: 1000,
silence_duration_ms: 2000,
},
})
.onThinking(() => console.log("🤔"))
.onMessage((message) => console.log(`🤖: ${message}`))
.startListening()LLMonade supports custom tools that allow assistants to perform actions. Here's an example using the built-in file writing tool:
import { TextAssistant, writeToFileTool } from "@robbie-wasabi/llmonade"
const assistant = TextAssistant.new()
.withInstructions("Save important information to a file")
.withTools([writeToFileTool("./data.txt")])import { TextAssistant } from "@robbie-wasabi/llmonade"
import { Client } from "discord.js"
const client = new Client({
intents: ["GUILDS", "DIRECT_MESSAGES", "GUILD_MESSAGES"],
})
const assistant = TextAssistant.new()
.withModel("gpt-4")
.withInstructions("You are a helpful Discord bot")
client.on("messageCreate", async (msg) => {
if (msg.content.includes("!llmonade")) {
const reply = await assistant.chat(msg.content)
msg.channel.send(reply)
}
})
client.connect()new(): Creates a new builder instancewithModel(model: string): Sets the OpenAI modelwithInstructions(instructions: string): Sets system instructionswithTools(tools: Tool[]): Adds toolsonThinking(handler: (message: string) => void): Thinking event handleronReply(handler: (message: string) => void): Reply event handleronError(handler: (error: string) => void): Error event handler
new(): Creates a new builder instancewithVoice(voice: string): Sets the voice modelwithInstructions(instructions: string): Sets system instructionswithTools(tools: Tool[]): Adds toolswithOpts(opts: AssistantOpts): Sets additional optionsonMessage(handler: (message: string) => void): Message event handleronThinking(handler: (message: string) => void): Thinking event handleronError(handler: (error: string) => void): Error event handlerstartListening(): Starts the voice assistant
MIT © Robert Rossilli