⚡BoxLang AI Module Documentation
Welcome to the BoxLang AI Module - your unified gateway to integrating AI capabilities into BoxLang applications. This module provides an elegant, easy-to-use API for interacting with multiple AI providers, from simple chat requests to complex multi-agent systems.
🎯 What is BoxLang AI?
BoxLang AI is a comprehensive module that brings enterprise-grade artificial intelligence capabilities to the BoxLang ecosystem. Whether you're building chatbots, content generators, code assistants, RAG systems, or complex AI workflows, this module provides everything you need.
✨ Key Features
🌐 Multi-Provider Support: Work with OpenAI, Claude, Gemini, Grok, Groq, DeepSeek, Ollama, and more
🔄 Unified API: One consistent interface across all providers
👥 Multi-Tenant Memory: Enterprise-grade isolation with userId and conversationId across all 20 memory types
🎨 Multimodal Content: Process images, audio, video, and documents alongside text
🏠 Local AI Support: Run models locally with Ollama for privacy and offline use
🔗 AI Pipelines: Chain operations together for complex multi-step workflows
⚡ Streaming Responses: Get real-time responses as they're generated
🛠️ Tool Integration: Enable AI to call functions and access real-time data
🚀 Async Support: Non-blocking operations for better performance
📝 Template System: Create reusable prompts with dynamic placeholders
🤖 AI Agents: Autonomous agents with memory, tools, and reasoning
📄 Document Loaders: Load and process various file formats for RAG
🧠 Vector Memory: Semantic search with 10+ vector database integrations
Supported Providers
BoxLang supports out of the box with a variety of AI providers. You can also create custom providers by following our Custom Provider Guide.
OpenAI
Cloud
General purpose, GPT-5, etc
Claude
Cloud
Long context, detailed analysis
Gemini
Cloud
Google integration, multimodal
Grok
Cloud
Real-time data, Twitter integration
HuggingFace
Cloud
Open-source models, community-driven
Groq
Cloud
Ultra-fast inference, LPU architecture
DeepSeek
Cloud
Code generation, reasoning
Ollama
Local
Privacy, offline use, no API costs
OpenRouter
Gateway
Access multiple models through one API
Perplexity
Cloud
Research, citations, factual answers
Voyage
Cloud
State-of-the-art embeddings, specialized for RAG
Cohere
Cloud
Embeddings, multilingual, chat, tool calling
🚀 Use Cases
💬 Chatbots: Build conversational interfaces with memory and context
✍️ Content Generation: Create articles, documentation, marketing copy
💻 Code Assistance: Generate, review, and explain code
📊 Data Analysis: Extract insights from text and structured data
📄 Document Processing: Analyze PDFs, contracts, and reports
🎥 Media Analysis: Process images, audio, and video content
🌍 Translations: Multi-language content translation
📋 Summarization: Condense long documents intelligently
❓ Question Answering: Build knowledge bases and FAQs with RAG
🔄 Custom Workflows: Multi-step AI processing pipelines
📖 Documentation Structure
🎓 Getting Started
Perfect for beginners - get up and running quickly
💬 Simple AI Interactions
Learn basic chat, streaming, and structured output
🔗 AI Pipelines
Build complex workflows with agents, memory, and tools
🔬 Advanced Topics
Deep dives into specialized features and customization
📋 Table of Contents
🎓 Getting Started
Get started with BoxLang AI quickly and easily: Overview
🎓 AI Concepts Overview of AI concepts, terminology, and architecture.
📦 Installation Install the BoxLang AI module in minutes.
🧩 Provider Setup & Configuration Detailed setup for all 12+ AI providers with API keys, models, and best practices.
⚡ Quick Start Guide Get up and running in minutes with simple examples and your first AI chat.
🙋FAQ Common questions and troubleshooting tips for BoxLang AI.
💬 Simple AI Interactions
Get started quickly with BoxLang AI's core chat capabilities: Overview
🗣️ Basic Chatting Simple question-answer interactions, parameters, and provider switching.
🎯 Advanced Chatting Multi-message conversations, AI tools, async requests, and streaming responses.
⚙️ Service-Level Chatting Direct service control, custom requests, headers, and managing multiple providers.
📦 Structured Output Extract type-safe, validated data from AI responses using classes, structs, or schemas.
🔗 AI Pipelines & Components
✈️ Main Components Overview Core concepts of AI pipelines, composability, and building workflows.
🔄 Understanding Pipelines Core concepts of AI pipelines, composability, and building workflows.
🤖 AI Agents Create autonomous agents with memory, tools, and reasoning. Simplify complex AI workflows.
🧠 Working with Models Creating model runnables, configuration, and integrating AI providers into pipelines.
✉️ Message Templates Building reusable prompts with dynamic placeholders and binding strategies.
🛠️ AI Tools & Function Calling Enable AI to call functions, access real-time data, and interact with external systems.
💭 Memory Systems Maintain conversation context with Windowed, Summary, Session, File, Cache, and JDBC memory.
🔮 Vector Memory Semantic search using vector embeddings. Integrate ChromaDB, Pinecone, PostgreSQL, and more.
🔧 Transformers Process and transform data between pipeline steps with pre/post-processing.
🏗️Structured Output Extract type-safe, validated data from AI responses using classes, structs, or schemas.
🔗 Pipelines Build composable AI workflows by chaining models, messages, and transformers into reusable templates.
📡 Pipeline Streaming Real-time streaming through pipelines for responsive applications.
📄 Document Loaders Load documents from files, directories, URLs. Supports text, Markdown, CSV, JSON, XML, and more.
🎯 RAG (Retrieval Augmented Generation) Build RAG systems combining document loaders, vector memory, and AI models.
🔬 Advanced Topics
🔐 Message Context Inject security, RAG, and application context into AI messages with multi-tenant patterns.
🎪 Event System Intercept and customize AI operations with hooks for monitoring, security, and extensibility.
🔢 Embeddings Generate vector representations for semantic search, recommendations, and similarity detection.
👥 Multi-Tenant Memory Enterprise-grade memory isolation with userId and conversationId patterns.
🛠️ Utility Functions Text chunking, token counting, and optimization techniques for AI processing.
🔌 MCP Client Connect to Model Context Protocol servers for external tools, resources, and prompts.
🖥️ MCP Server Expose BoxLang capabilities as MCP server for integration with other AI systems.
🦾Production Deployments Best practices for deploying BoxLang AI applications in production environments.
🔰Security & Compliance Guidelines and best practices for securing AI applications and ensuring compliance.
🎨 Custom AI Providers Build custom provider integrations to connect any LLM service with BoxLang AI.
🧠 Custom Memory Build your own memory implementations by extending BaseMemory.
🧩 Custom Vector Memory Implement custom vector memory providers by extending BaseVectorMemory.
📚 Custom Document Loaders Create custom loaders for specialized data sources and formats.
🔄 Custom Transformers Build custom transformers for specialized data processing in pipelines.
🔧 Built-In Functions (BIFs)
BoxLang AI provides a comprehensive set of BIFs for different AI operations. You can see all of our BIF reference documentation here: BIF Reference.
💬 Chat & Conversation
aiChat()
Simple one-shot chat request
String
Quick Q&A, content generation
aiChatAsync()
Non-blocking chat request
Future
Background processing, parallel requests
aiChatRequest()
Build structured chat requests
AiRequest
Complex requests with tools
aiChatStream()
Real-time streaming responses
void
Live chat, progressive output
🏗️ Pipeline Components
aiMessage()
Build message pipelines
AiMessage
Reusable prompts, templates
aiModel()
Create model runnables
AiModel
Pipeline integration
aiTransform()
Create data transformers
Transformer
Pipeline data processing
aiTool()
Define callable functions
Tool
Real-time data, function calling
🧠 Memory & Context
aiMemory()
Create conversation or vector memory
Memory
Context-aware conversations, RAG, semantic search
📄 Document Processing
aiDocuments()
Load documents from sources
Array/Loader
Document processing, RAG
🔢 Utilities
aiChunk()
Split text into chunks
Array
Processing large documents
aiTokens()
Estimate token counts
Numeric
Cost estimation, limits
aiEmbed()
Generate vector embeddings
Array/Struct
Semantic search, similarity
⚙️ Service Management
aiService()
Get AI service instances
Service
Multi-provider management
MCP()
Connect to MCP servers
MCPClient
External tools, resources
Quick Reference by Category:
🚀 Simple Operations:
aiChat(),aiChatAsync(),aiChatStream()📝 Structured Requests:
aiChatRequest(),aiMessage(),aiModel()🔧 Advanced Features:
aiTool(),aiMemory(),aiTransform()📊 Utilities:
aiChunk(),aiTokens(),aiEmbed()🎛️ Service Management:
aiService(),MCP()
🚀 Quick Examples
💬 Simple Chat
🎨 Simple Chat with Parameters
🔗 Build a Pipeline
⚡ Stream Responses
📦 Get JSON Responses
🛠️ Use AI Tools
🔢 Generate Embeddings
📄 Load Documents
🤖 Create an Agent
🆘 Need Help?
📚 Resources
📖 Full Documentation: Explore all sections above for comprehensive guides
💡 Examples: Check the
/examplesfolder for runnable code samples🔍 BIF Reference: See
reference/built-in-functions/for detailed function docs📦 Module Components: Explore
main-components/for in-depth component guides
🤝 Community & Support
👥 Community: BoxLang Community Forum
🐛 Issues: GitHub Issues
💬 Discussions: GitHub Discussions
✉️ Email Support: [email protected]
🎓 Learning Paths
🌱 Beginners: Start with Quick Start → Basic Chatting → Examples
🚀 Advanced: Explore Agents → RAG → Custom Components
🌟 Upgrade to Plus
Want enterprise features and priority support?
🏢 Enterprise Modules: Advanced components and integrations
🛠️ Advanced Tooling: Enhanced development and debugging tools
⚡ Priority Support: Direct access to our engineering team
🔐 Enterprise Features: SSO, audit logs, advanced security
Learn more: boxlang.io/plans
📜 Legal & Credits
Copyright © 2023-2025 Ortus Solutions, Corp License: Apache 2.0 Website: boxlang.io
Made with ❤️ by the Ortus Solutions team
Last updated