Blog

Luis Majano

March 18, 2025

Spread the word


Share your thoughts

Welcome to the Future of AI in BoxLang

We are thrilled to introduce BoxLang Gen AI, a powerful and intuitive module that brings seamless AI generation capabilities to your BoxLang applications. With a fluent, functional API, this module allows developers to interact with multiple AI providers in a consistent and abstracted manner.

If you're looking for even more power, check out our bx-aiplus module (Coming Soon), available as part of our BoxLang +/++ subscriptions, which extends this module with additional AI providers, enhanced capabilities, and advanced features.

Open Source & Easy to Get Started

BoxLang AI is open-source, licensed under the Apache 2.0 license, and easy to install:

install-bx-module bx-ai

For CommandBox-based web applications, add it to your server.json or use:

box install bx-ai

Once installed, you can start leveraging built-in functions (BIFs) for AI interactions.

Quick Example

// chat.bxs
answer = aiChat( "How amazing is BoxLang?" )
println( answer )

Review Ortus Books

Supported AI Providers

BoxLang AI supports multiple Large Language Model (LLM) providers:

  • OpenAI
  • DeepSeek
  • Gemini
  • Grok
  • Perplexity

More providers are available in the bx-aiplus module.

Key Features

  • Multi-provider integration
  • Fluent API for composing AI interactions
  • Asynchronous chat requests
  • Global defaults for streamlined requests
  • Raw chat request composition
  • Support for AI service and tool creation
  • System message support

Configuration

You can configure the module by adding settings to boxlang.json:

{
    "modules": {
        "bxai": {
            "provider": "openai",
            "apiKey": "your-api-key",
            "defaultParams": {
                "model": "gpt-3.5-turbo",
                "temperature": 0.5
            }
        }
    }
}

Global Functions (BIFs)

BoxLang AI exposes several global functions (BIFs) for AI interactions:

aiChat() - Simple AI Chat

aiChat( "Write a haiku about recursion in programming." )

aiChatAsync() - Asynchronous Chat

For non-blocking AI interactions, use:

var future = aiChatAsync( "Write a haiku about recursion." )
    .then( result -> println( "AI Response: " + result ) )
    .onError( error -> writeLog( text: "AI Chat failed: " + error.getMessage(), type: "error" ) )
println( future.get() )

aiChatRequest() - Compose a Raw Chat Request

chatRequest = aiChatRequest(
    "Write a haiku about recursion in programming.",
    { model: "gpt-3.5-turbo", temperature: 0.5 },
    { provider: "grok", timeout: 10 }
);
response = aiService().invoke( chatRequest );

aiMessage() - Build AI Messages

aiChat(
    aiMessage()
        .system( "You are a helpful assistant." )
        .user( "Write a haiku about recursion in programming." )
);

aiService() - AI Service Objects

Create an AI Service reference for reusable interactions:

service = aiService( "openai" ).configure( "myApiKey" );
response = service.invoke( aiChatRequest( "Explain quantum computing." ) );

aiTool() - AI Tool Creation

Define tools for real-time system processing:

tool = aiTool( "get_weather", "Fetches real-time temperature.", location -> {
    return (location contains "San Francisco") ? "68F" : "unknown";
});
result = aiChat( "What's the temperature in San Francisco?", { tools: [ tool ] } );
println( result );

Resources

Looking for more information, support, or community engagement? Check out the following resources:

Conclusion

With BoxLang Gen AI, integrating Large Language Models into your applications has never been easier. Whether you're interacting with OpenAI, DeepSeek, Gemini, or other providers, this fluent and functional API empowers you to build powerful AI-driven applications effortlessly.

Get started today with BoxLang AI and take your applications to the next level!

Review Ortus Books

Add Your Comment

Recent Entries

Speaker Featuring - Round 1

Speaker Featuring - Round 1

Every conference is more than the talks we see on stage it’s also the story of the people who make it possible.

With the first round of Into the Box 2026 sessions and workshops now live, we’re excited to introduce some of the speakers who will be joining us this year. These community members, practitioners, and Ortus team experts bring decades of real-world experience across CFML, BoxLang, JVM modernization, testing, AI, and cloud-native development.

Victor Campos
Victor Campos
January 26, 2026
First Round of the Into the Box 2026 Agenda Is Live

First Round of the Into the Box 2026 Agenda Is Live

Into the Box 2026 marks an important moment for the CFML and BoxLang community not just because of what’s on the agenda, but because of what it represents: 20 years of Ortus Solutions helping teams move forward, modernize, and build with confidence.

Victor Campos
Victor Campos
January 21, 2026
BoxLang AI v2: Enterprise AI Development Without the Complexity

BoxLang AI v2: Enterprise AI Development Without the Complexity

One Year. 100+ Features. Unlimited Possibilities.

Just one year ago, in March 2024, we launched BoxLang AI 1.0. Today, we're thrilled to announce BoxLang AI v2—a massive leap forward that positions BoxLang as the most powerful and versatile AI framework on the JVM.

Luis Majano
Luis Majano
January 19, 2026