house-chimney-heartIntroduction

The official AI library for the BoxLang JVM dynamic language.

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 library that brings enterprise-grade artificial intelligence capabilities to the JVM ecosystem. Whether you're building chatbots, content generators, code assistants, RAG systems, or complex AI workflows, this module provides everything you need.

spinner

✨ 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 a variety of AI providers out of the box. You can also create custom providers by following our Custom Provider Guide.

Provider
Type
Best For

Claude

Cloud

Long context, detailed analysis

Cohere

Cloud

Embeddings, multilingual, chat, tool calling

DeepSeek

Cloud

Code generation, reasoning

Gemini

Cloud

Google integration, multimodal

Grok

Cloud

Real-time data, Twitter integration

Groq

Cloud

Ultra-fast inference, LPU architecture

HuggingFace

Cloud

Open-source models, community-driven

Ollama

Local

Privacy, offline use, no API costs

OpenAI

Cloud

General purpose, GPT-5, etc

OpenRouter

Gateway

Access multiple models through one API

Perplexity

Cloud

Research, citations, factual answers

Voyage

Cloud

State-of-the-art embeddings, specialized for RAG

πŸš€ 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


πŸ“– Quick Start

πŸŽ“ 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

πŸ€– AI Agents

Build reusable and autonomous agents, sub-agents, and much more.


πŸ”§ 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

BIF
Purpose
Return Type
Example Use Case

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

aiService()

Get AI service instances

Service

Multi-provider management

πŸ—οΈ Pipeline Components

BIF
Purpose
Return Type
Example Use Case

aiAgent()

Create AI agents

AiAgent

Autonomous assistants, multi-turn

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

BIF
Purpose
Return Type
Example Use Case

aiMemory()

Create conversation or vector memory

Memory

Context-aware conversations, RAG, semantic search

πŸ“„ Document Processing

BIF
Purpose
Return Type
Example Use Case

aiDocuments()

Load documents from sources

Array/Loader

Document processing, RAG

πŸ”’ Utilities

BIF
Purpose
Return Type
Example Use Case

aiChunk()

Split text into chunks

Array

Processing large documents

aiEmbed()

Generate vector embeddings

Array/Struct

Semantic search, similarity

aiPopulate()

Populate a class instance, struct, or array from JSON data or struct.

Any

This is useful for testing, custom workflows, or working with cached AI responses.

aiTokens()

Estimate token counts

Numeric

Cost estimation, limits

βš™οΈ MCP (Model Context Protocol)

BIF
Purpose
Return Type
Example Use Case

MCP()

Connect to MCP servers

MCPClient

External tools, resources

MCPServer()

Create MCP server instances

MCPServer

Expose tools to agents


πŸš€ 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

🀝 Community & Support

πŸŽ“ Learning Paths

  1. 🌱 Beginners: Start with Quick Start β†’ Basic Chatting β†’ Examplesarrow-up-right

  2. πŸ—οΈ Builders: Learn Pipelines β†’ Memory β†’ Tools

  3. πŸš€ Advanced: Explore Agents β†’ RAG β†’ Custom Components


🌟 Upgrade to Plus

BoxLang and BoxLang AI are both Professional Open-Source (POS) projects. However, we also offer enterprise features, priority support, SLAs, and much more in our BoxLang +/++ Plans.arrow-up-right

  • 🏒 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/plansarrow-up-right


Copyright Β© 2023-2025 Ortus Solutions, Corp

License: Apache 2.0arrow-up-right

Website: ai.boxlang.ioarrow-up-right

Made with ❀️ by the Ortus Solutions team

Last updated