> For the complete documentation index, see [llms.txt](https://ai.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ai.ortusbooks.com/introduction/release-history/2.0.0.md).

# 2.0.0

BoxLang AI Module v2.0.0 Release Notes - Document Loaders, MCP Security, Multiple Provider Support, and Embeddings

**Released:** January 19, 2026

One of our biggest library updates yet! This release introduces a powerful new document loading system, comprehensive security features for MCP servers, and full support for several major AI providers including Mistral, HuggingFace, Groq, OpenRouter, and Ollama. Additionally, we have implemented complete embeddings functionality and made numerous enhancements and fixes across the board.

## 🎉 Major Features

### Document Loaders System

New comprehensive document loading system for importing content from various sources into your AI workflows.

**New BIFs:**

* `aiDocuments()` - Load documents with automatic type detection
* `aiDocumentLoader()` - Create loader instances with advanced configuration
* `aiDocumentLoaders()` - Retrieve all registered loaders with metadata
* `aiMemoryIngest()` - Ingest documents into memory with comprehensive reporting

**Built-in Loaders:**

* `TextLoader` - Plain text files (.txt, .text)
* `MarkdownLoader` - Markdown files with header splitting, code block removal
* `HTMLLoader` - HTML files and URLs with script/style removal, tag extraction
* `CSVLoader` - CSV files with row-as-document mode, column filtering
* `JSONLoader` - JSON files with field extraction, array-as-documents mode
* `DirectoryLoader` - Batch loading from directories with recursive scanning

**Example - Loading Documents:**

```javascript
// Load a single markdown file
docs = aiDocuments( "./docs/guide.md" )

// Load entire directory with auto-detection
docs = aiDocuments( "./content/" )

// Advanced loader configuration
loader = aiDocumentLoader( "markdown" )
    .withSplitByHeaders( true )
    .withRemoveCodeBlocks( true )

docs = loader.load( "./docs/" )
```

**Example - Ingesting into Memory:**

```javascript
// Ingest documents into vector memory
report = aiMemoryIngest(
    documents: aiDocuments( "./knowledge-base/" ),
    memory: vectorMemory,
    options: {
        chunkSize: 1000,
        chunkOverlap: 200
    }
)

// Report includes: documentsIn, chunksOut, stored, skipped,
// deduped, tokenCount, embeddingCalls, estimatedCost, duration
writeOutput( "Ingested #report.stored# chunks from #report.documentsIn# documents" )
writeOutput( "Estimated cost: $#report.estimatedCost#" )
```

### MCP Server Enterprise Security

Comprehensive security enhancements for MCP servers with CORS, rate limiting, API key validation, and automatic security headers.

**CORS Configuration:**

```javascript
mcpServer = aiMcpServer( name: "SecureAPI" )
    .withCors( ["https://app.example.com", "https://admin.example.com"] )
    .withCors( "*.mycompany.com" ) // Wildcard support
```

**Request Body Size Limits:**

```javascript
mcpServer.withBodyLimit( 1048576 ) // 1MB limit
```

**Custom API Key Validation:**

```javascript
mcpServer.withApiKeyProvider( function( apiKey, requestData ) {
    // Custom validation logic
    return queryExecute(
        "SELECT id FROM api_keys WHERE key = :key AND active = 1",
        { key: apiKey }
    ).recordCount > 0
} )
```

**Automatic Security Headers** - All responses include:

* `X-Content-Type-Options: nosniff`
* `X-Frame-Options: DENY`
* `X-XSS-Protection: 1; mode=block`
* `Strict-Transport-Security: max-age=31536000`
* And more...

### New AI Provider Support

**Mistral AI:**

```javascript
// Chat with Mistral
result = aiChat(
    provider: "mistral",
    messages: "Explain quantum computing",
    params: { model: "mistral-small-latest" }
)

// Generate embeddings
embeddings = aiEmbed(
    provider: "mistral",
    input: "BoxLang is awesome",
    params: { model: "mistral-embed" }
)
```

**HuggingFace:**

```javascript
result = aiChat(
    provider: "huggingface",
    messages: "What is BoxLang?",
    params: { model: "Qwen/Qwen2.5-72B-Instruct" }
)
```

**Groq (Fast Inference):**

```javascript
result = aiChat(
    provider: "groq",
    messages: "Write a haiku about coding",
    params: { model: "llama-3.3-70b-versatile" }
)
```

**OpenRouter:**

```javascript
result = aiChat(
    provider: "openrouter",
    messages: "Compare Python and BoxLang"
)
```

**Ollama (Local Models):**

```javascript
// Run models locally with Ollama
result = aiChat(
    provider: "ollama",
    messages: "Hello, world!",
    params: { model: "qwen2.5:0.5b-instruct" }
)
```

### Embeddings Support

Complete embeddings functionality for semantic search, clustering, and recommendations across all providers.

**Generate Embeddings:**

```javascript
// Single text embedding
embedding = aiEmbed(
    provider: "openai",
    input: "BoxLang AI Module is powerful",
    params: { model: "text-embedding-3-small" }
)

// Batch embeddings
embeddings = aiEmbed(
    provider: "openai",
    input: ["First text", "Second text", "Third text"],
    params: { model: "text-embedding-3-large" }
)

// Get just the embeddings array
vectors = aiEmbed(
    provider: "openai",
    input: "Text to embed",
    options: { returnFormat: "embeddings" }
)
```

**Supported Providers:**

* OpenAI: `text-embedding-3-small`, `text-embedding-3-large`
* Ollama: Local embeddings for privacy
* DeepSeek: OpenAI-compatible API
* Groq: OpenAI-compatible API
* OpenRouter: Aggregated models
* Gemini: `text-embedding-004`

### Enhanced ChatMessage Methods

**Template Binding:**

```javascript
// Bind variables to messages
message = aiMessage( "user", "Hello, {{name}}! You are {{age}} years old." )
    .bind({ name: "John", age: 30 })

// Render with bindings
rendered = message.render() // "Hello, John! You are 30 years old."

// Format with new bindings
formatted = message.format({ name: "Jane", age: 25 })
```

## 🔧 Enhancements

* **Automatic API Key Detection**: Services now auto-detect API keys using `<PROVIDER>_API_KEY` convention
* **Tool JSON Serialization**: Automatic JSON serialization for tool calls that don't return strings
* **Docker Testing Infrastructure**: Automated local development and CI/CD support with Docker Compose
* **Enhanced GitHub Actions**: Improved CI/CD pipeline with AI service support
* **BIF Reference Documentation**: Complete function reference table in README
* **Comprehensive Event Documentation**: Complete event system documentation

## 🐛 Bug Fixes

* **Tool Argument Descriptions**: Tool arguments without descriptions now default to argument name instead of causing errors
* **Model Name Compatibility**: Updated OllamaService default model from llama3.2 to qwen2.5:0.5b-instruct
* **Docker GPU Support**: Made GPU configuration optional for systems without GPU access
* **Test Model References**: Corrected model names in Ollama tests to match available models

## 📚 Documentation

* New comprehensive document loaders documentation
* MCP server security features documentation with examples
* Complete embeddings documentation with provider examples
* Enhanced provider-specific documentation

## 🚀 Upgrade Notes

This is a major release with significant new features. All existing code remains compatible, but you can now leverage:

1. **Document loaders** for ingesting content into AI workflows
2. **MCP security features** for production-ready API servers
3. **Multiple new providers** for flexibility and cost optimization
4. **Embeddings** for semantic search and RAG applications
5. **Enhanced message templating** for dynamic content generation

## 🙏 Thank You

Thank you to all contributors and users who helped make this release possible!


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://ai.ortusbooks.com/introduction/release-history/2.0.0.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
