Llama.Chat
----------

Sends a chat messages to the model.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Llama](component_Llama.md) | [16.1](newinversion161.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "Llama.Chat"; LlamaSession; Prompt { ; maxToken; TemplateName } ) 

**MBS**( **"Llama.Chat";** /\* Sends a chat messages to the model. \*/  
**$LlamaSession**; /\* The session identifier.e.g. $$session \*/   
**$Prompt**; /\* The prompt text for the chat.e.g. "Hello" \*/   
**$maxToken**; /\* Optional; The maximum number of tokens allowed before the function cancels.  
Default is 999.e.g. 1234 \*/   
**$TemplateName**) /\* Optional; The chat template name.  
Default is "" to pick the default template.e.g. "chatml" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| LlamaSession | The session identifier. | $$session |  |
| Prompt | The prompt text for the chat. | "Hello" |  |
| maxToken | The maximum number of tokens allowed before the function cancels.   Default is 999. | 1234 | Optional |
| TemplateName | The chat template name.   Default is "" to pick the default template. | "chatml" | Optional |

### Result

Returns text or error.

### Description

Sends a chat messages to the model.  
Returns the response back.  
  
The Llama.Chat function applies the chat template to structure the chat and log the responses.  
### Release notes

- **Version 16.3**
    - Improved Llama.Chat and Llama.Query to yield time after 1000 tokens.
- **Version 16.2**
    - Fixed an issue with [Llama.Chat](https://www.mbsplugins.eu/LlamaChat.shtml) when the chat template couldn't be applied causing an exception.

### Example Databases

- [Llama chat](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/Llama%20chat.shtml#1ScriptAnchor_)

### Blog Entries

- [MBS FileMaker Plugin, version 16.3pr1](https://www.mbsplugins.de/archive/2026-06-01/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 16.2pr2](https://www.mbsplugins.de/archive/2026-04-13/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)
- [Use Llama.cpp in FileMaker](https://www.mbsplugins.de/archive/2026-02-17/Use_Llamacpp_in_FileMaker/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 10th February 2026 , last changed 13th February 2026

  
[Llama.Backends](LlamaBackends.md) - [Llama.ChatBuiltinTemplates](LlamaChatBuiltinTemplates.md)

[HTML Version](LlamaChat.shtml)