Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

MBS FileMaker Plugin Example Databases

Llama chat

All examples are included with download of MBS FileMaker Plugin.

Llama chat.fmp12

Overview
Tables 1
Relationships 0
Layouts 1
Scripts 8
Value Lists 0
Custom Functions 1
Custom Menus 24
File Options
Default custom menu set [Standard FileMaker Menus]
Default theme Apex Blue
When opening file
Minimum allowed version 12.0
Login using Account Name; Account= Admin
Allow user to save password On
Require iOS passcode Off
Show Sign-in fields On
Switch to layout Off
Hide all toolbars Off
Script triggers
OnFirstWindowOpen Script: Start
OnLastWindowClose Script: Closing
OnWindowOpen Off
OnWindowClose Off
OnFileAVPlayerChange Off
OnWindowTransaction Off
Thumbnail Settings
Generate Thumbnails On; Temporary

 

Tables

Table Name
Statistics
Comments
Occurrences in Relationship Graph
Llama
10 fields defined, 0 record
Llama

Fields

Table Name: Llama - 10 Fields
Field Name Type Options Comments On Layouts In Relationships In Scripts In Value Lists
PrimaryKey Normal, Text Auto-Enter:
  • Context table: Llama
    Calculation: Get( UUID )
Validation:
  • Only during data entry
  • Not empty
  • Unique
  • Strict validation
Storage:
  • Repetitions: 1
  • Indexing: Minimal
  • Automatically create indexes as needed
  • Index Language: Unicode Raw
Unique identifier of each record in this table
          CreationTimestamp Normal, Timestamp Auto-Enter:
          • Creation timestamp
          Validation:
          • Only during data entry
          • Strict data type: 4 digit year
          • Not empty
          • Strict validation
          Storage:
          • Repetitions: 1
          • Indexing: None
          • Automatically create indexes as needed
          • Index Language: German
          Date and time each record was created
                  CreatedBy Normal, Text Auto-Enter:
                  • Creation account name
                  Validation:
                  • Only during data entry
                  • Not empty
                  • Strict validation
                  Storage:
                  • Repetitions: 1
                  • Indexing: None
                  • Automatically create indexes as needed
                  • Index Language: German
                  Account name of the user who created each record
                          ModificationTimestamp Normal, Timestamp Auto-Enter:
                          • Modification timestamp
                          Validation:
                          • Only during data entry
                          • Strict data type: 4 digit year
                          • Not empty
                          • Strict validation
                          Storage:
                          • Repetitions: 1
                          • Indexing: None
                          • Automatically create indexes as needed
                          • Index Language: German
                          Date and time each record was last modified
                                  ModifiedBy Normal, Text Auto-Enter:
                                  • Modification account name
                                  Validation:
                                  • Only during data entry
                                  • Not empty
                                  • Strict validation
                                  Storage:
                                  • Repetitions: 1
                                  • Indexing: None
                                  • Automatically create indexes as needed
                                  • Index Language: German
                                  Account name of the user who last modified each record
                                          Text Normal, Text Auto-Enter:
                                          • Allow editing
                                          Validation:
                                          • Only during data entry
                                          Storage:
                                          • Repetitions: 1
                                          • Indexing: None
                                          • Automatically create indexes as needed
                                          • Index Language: German
                                              IsOutput Normal, Number Auto-Enter:
                                              • Allow editing
                                              Validation:
                                              • Only during data entry
                                              Storage:
                                              • Repetitions: 1
                                              • Indexing: None
                                              • Automatically create indexes as needed
                                              • Index Language: German
                                                  Transcript Normal, Text Auto-Enter:
                                                  • Allow editing
                                                  Validation:
                                                  • Only during data entry
                                                  Storage:
                                                  • Global
                                                  • Repetitions: 1
                                                  • Index Language: German
                                                      TextReadOnly Calculated, Text Calculation: Storage:
                                                      • Repetitions: 1
                                                      • Indexing: None
                                                      • Automatically create indexes as needed
                                                      • Index Language: German
                                                            Model Path Normal, Text Auto-Enter:
                                                            • Allow editing
                                                            Validation:
                                                            • Only during data entry
                                                            Storage:
                                                            • Global
                                                            • Repetitions: 1
                                                            • Index Language: German

                                                                Layout Objects: Llama

                                                                Regular Fields

                                                                Field Name: Llama::TextReadOnly
                                                                Field Properties Coordinates Field Format Field Behavior Quick Find
                                                                • Top: 115 pt
                                                                • Left: 12 pt
                                                                • Bottom: 197 pt
                                                                • Right: 645 pt
                                                                • Anchoring: Left and Right, Top and Bottom
                                                                Field Format:
                                                                • Edit Box
                                                                Field Behavior:
                                                                • Allow field to be entered: In Browse mode
                                                                • Disable visual spell-checking
                                                                • Touch keyboard type: Default for Data Type
                                                                • Go to next field using: Tab key
                                                                Yes

                                                                Field Name: Llama::Text
                                                                Field Properties Coordinates Field Format Field Behavior Quick Find
                                                                • Top: 115 pt
                                                                • Left: 14 pt
                                                                • Bottom: 146 pt
                                                                • Right: 562 pt
                                                                • Anchoring: Left and Right, Top
                                                                Field Format:
                                                                • Edit Box
                                                                Field Behavior:
                                                                • Allow field to be entered: In Find mode, In Browse mode
                                                                • Touch keyboard type: Default for Data Type
                                                                • Go to next field using: Tab key
                                                                Yes

                                                                Field Name: Llama::Transcript
                                                                Field Properties Coordinates Field Format Field Behavior Quick Find
                                                                • Top: 37 pt
                                                                • Left: 439 pt
                                                                • Bottom: 532 pt
                                                                • Right: 866 pt
                                                                • Anchoring: Left, Top
                                                                Field Format:
                                                                • Edit Box
                                                                Field Behavior:
                                                                • Allow field to be entered: In Find mode, In Browse mode
                                                                • Disable visual spell-checking
                                                                • Touch keyboard type: Default for Data Type
                                                                • Go to next field using: Tab key
                                                                No

                                                                Field Name: Llama::Model Path
                                                                Field Properties Coordinates Field Format Field Behavior Quick Find
                                                                • Top: 215 pt
                                                                • Left: 111 pt
                                                                • Bottom: 246 pt
                                                                • Right: 521 pt
                                                                • Anchoring: Left and Right, Top
                                                                Field Format:
                                                                • Edit Box
                                                                Field Behavior:
                                                                • Allow field to be entered: In Find mode, In Browse mode
                                                                • Touch keyboard type: Default for Data Type
                                                                • Go to next field using: Tab key
                                                                No

                                                                Buttons

                                                                Button Properties Coordinates Script/Script Step
                                                                  Type:
                                                                • Text: Send
                                                                • Top: 115 pt
                                                                • Left: 572 pt
                                                                • Bottom: 146 pt
                                                                • Right: 640 pt
                                                                • Anchoring: Right, Bottom
                                                                Perform Script [ “SendRequest” ]

                                                                Scripts:


                                                                Button Properties Coordinates Script/Script Step
                                                                  Type:
                                                                • Text: Load Model
                                                                • Top: 215 pt
                                                                • Left: 534 pt
                                                                • Bottom: 246 pt
                                                                • Right: 645 pt
                                                                • Anchoring: Right, Bottom
                                                                Perform Script [ “Load Model” ]

                                                                Scripts:


                                                                Button Properties Coordinates Script/Script Step
                                                                  Type:
                                                                • Text: See Blog Post
                                                                  Additional Properties:
                                                                • Change to hand cursor over button
                                                                • Top: 64 pt
                                                                • Left: 12 pt
                                                                • Bottom: 92 pt
                                                                • Right: 143 pt
                                                                • Anchoring: Left, Top
                                                                Open URL [ "https://www.mbsplugins.de/archive/2026-02-17/Use_Llamacpp_in_FileMaker/monkeybreadsoftware_blog_filemaker" ] [ In external browser; No dialog ]

                                                                Popover Buttons

                                                                Popover Button Properties Coordinates
                                                                  Type:
                                                                • Text: Transcript
                                                                • Top: 33 pt
                                                                • Left: 521 pt
                                                                • Bottom: 88 pt
                                                                • Right: 645 pt
                                                                • Anchoring: Right, Top
                                                                Popover Properties Coordinates
                                                                  Show Title Bar:
                                                                • Yes
                                                                  Title:
                                                                • "Transcript"
                                                                  Position:
                                                                • Left
                                                                • Top: 5 pt
                                                                • Left: 426 pt
                                                                • Bottom: 546 pt
                                                                • Right: 879 pt
                                                                • Anchoring: Left, Top
                                                                Popover Content
                                                                Tab Controls Slide Controls Fields Buttons Portals Web Viewer Controls Charts
                                                                    Field Objects

                                                                    Graphic Objects

                                                                    Graphic Object Properties Coordinates
                                                                      Type:
                                                                    • Rounded Rectangle
                                                                    • Top: 114 pt
                                                                    • Left: 6 pt
                                                                    • Bottom: 204 pt
                                                                    • Right: 647 pt
                                                                    • Anchoring: Left and Right, Top and Bottom

                                                                    Script Hierarchy

                                                                    SendRequest
                                                                    Closing
                                                                    Start
                                                                    Show Transcript
                                                                    Load Model
                                                                    Clear
                                                                    Clear Transcript
                                                                    Show backends

                                                                    Next Script: [Closing]
                                                                    Script Name SendRequest
                                                                    Run script with full access privileges Off
                                                                    Siri Shortcut Visible Off
                                                                    Include In Menu No
                                                                    Layouts that use this script
                                                                    Scripts that use this script
                                                                      Script Definition
                                                                      Script Steps
                                                                      • Set Variable [ $text; Value:Llama::Text ]
                                                                      • If [ Length ( $text ) = 0 ]
                                                                      • Exit Script [ ]
                                                                      • End If
                                                                      • Set Field [ Llama::IsOutput; 1 ]
                                                                      • Commit Records/Requests [ No dialog ]
                                                                      • #new record for the answer
                                                                      • New Record/Request
                                                                      • Set Field [ Llama::IsOutput; 2 ]
                                                                      • #let FileMaker redraw the layout
                                                                      • Pause/Resume Script [ Duration (seconds): ,2 ]
                                                                      • #now ask the model for an answer, which may take a few seconds
                                                                      • Set Variable [ $answer; Value:MBS("Llama.Chat"; $$session; $Text; 1000) ]
                                                                      • Set Variable [ $$LastAnswer; Value:$Answer ]
                                                                      • #handle the ** in the text and make it bold
                                                                      • Set Variable [ $count; Value:PatternCount ( $answer ; "**" ) ]
                                                                      • If [ $count > 0 ]
                                                                      • Set Variable [ $inside; Value:0 ]
                                                                      • Set Variable [ $index; Value:1 ]
                                                                      • Set Variable [ $output; Value:"" ]
                                                                      • Loop [ Flush: Defer ]
                                                                      • Set Variable [ $part; Value:NthItem ( $answer ; "**" ; $index ) ]
                                                                      • If [ $inside ]
                                                                      • Set Variable [ $output; Value:$output & TextStyleAdd ( $part ; Bold ) ]
                                                                      • Else [ ]
                                                                      • Set Variable [ $output; Value:$output & $part ]
                                                                      • End If
                                                                      • Set Variable [ $inside; Value:not $inside ]
                                                                      • Set Variable [ $index; Value:$index + 1 ]
                                                                      • Exit Loop If [ $index > $count+2 ]
                                                                      • End Loop
                                                                      • Set Variable [ $answer; Value:$output ]
                                                                      • End If
                                                                      • #store answer
                                                                      • Set Field [ Llama::Text; $answer ]
                                                                      • Commit Records/Requests [ No dialog ]
                                                                      • #next input
                                                                      • New Record/Request
                                                                      • Go to Field [ Llama::Text ] [ Select/perform ]
                                                                      Fields used in this script
                                                                      Scripts used in this script
                                                                        Layouts used in this script
                                                                          Tables used in this script
                                                                          Table occurrences used by this script
                                                                          Custom Functions used by this script
                                                                          Custom menu set used by this script

                                                                            Previous Script: [SendRequest] Next Script: [Start]
                                                                            Script Name Closing
                                                                            Run script with full access privileges Off
                                                                            Siri Shortcut Visible Off
                                                                            Include In Menu No
                                                                            Layouts that use this script
                                                                              Scripts that use this script
                                                                                Script Definition
                                                                                Script Steps
                                                                                • If [ IsEmpty ( $$session ) ]
                                                                                • #nothing to do
                                                                                • Else [ ]
                                                                                • Set Variable [ $r; Value:MBS("Llama.Release"; $$session) ]
                                                                                • Set Variable [ $$session; Value:"" ]
                                                                                • End If
                                                                                Fields used in this script
                                                                                  Scripts used in this script
                                                                                    Layouts used in this script
                                                                                      Tables used in this script
                                                                                        Table occurrences used by this script
                                                                                          Custom Functions used by this script
                                                                                            Custom menu set used by this script

                                                                                              Previous Script: [Closing] Next Script: [Show Transcript]
                                                                                              Script Name Start
                                                                                              Run script with full access privileges Off
                                                                                              Siri Shortcut Visible Off
                                                                                              Include In Menu No
                                                                                              Layouts that use this script
                                                                                                Scripts that use this script
                                                                                                  Script Definition
                                                                                                  Script Steps
                                                                                                  • If [ MBS("isWindows") ]
                                                                                                  • #you need to update paths!
                                                                                                  • Set Variable [ $r; Value:MBS( "Process.SetCurrentDirectory"; "C:\Users\cs\Desktop\llama-b7993-bin-win-cpu-x64") ]
                                                                                                  • Set Variable [ $r; Value:MBS("Llama.LoadLibrary"; "ggml.dll") ]
                                                                                                  • Set Variable [ $r; Value:MBS("Llama.LoadLibrary"; "ggml-base.dll") ]
                                                                                                  • Set Variable [ $r; Value:MBS("Llama.LoadLibrary"; "llama.dll") ]
                                                                                                  • If [ MBS("IsError") ]
                                                                                                  • Show Custom Dialog [ Title: "Failed to load library."; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                  • Else [ ]
                                                                                                  • Set Variable [ $$session; Value:MBS("Llama.New") ]
                                                                                                  • Truncate Table [ No dialog; Table: “Llama” ]
                                                                                                  • End If
                                                                                                  • Else [ ]
                                                                                                  • #this is for using homebrew to install the libraries.
                                                                                                  • Set Variable [ $r; Value:MBS("Llama.LoadLibrary"; "/opt/homebrew/lib/libllama.dylib") ]
                                                                                                  • If [ MBS("IsError") ]
                                                                                                  • Show Custom Dialog [ Title: "Failed to load library."; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                  • Else [ ]
                                                                                                  • Set Variable [ $$session; Value:MBS("Llama.New") ]
                                                                                                  • Truncate Table [ No dialog; Table: “Llama” ]
                                                                                                  • End If
                                                                                                  • End If
                                                                                                  Fields used in this script
                                                                                                    Scripts used in this script
                                                                                                      Layouts used in this script
                                                                                                        Tables used in this script
                                                                                                          Table occurrences used by this script
                                                                                                            Custom Functions used by this script
                                                                                                              Custom menu set used by this script

                                                                                                                Previous Script: [Start] Next Script: [Load Model]
                                                                                                                Script Name Show Transcript
                                                                                                                Run script with full access privileges Off
                                                                                                                Siri Shortcut Visible Off
                                                                                                                Include In Menu No
                                                                                                                Layouts that use this script
                                                                                                                  Scripts that use this script
                                                                                                                    Script Definition
                                                                                                                    Script Steps
                                                                                                                    Fields used in this script
                                                                                                                    Scripts used in this script
                                                                                                                      Layouts used in this script
                                                                                                                        Tables used in this script
                                                                                                                        Table occurrences used by this script
                                                                                                                        Custom Functions used by this script
                                                                                                                          Custom menu set used by this script

                                                                                                                            Previous Script: [Show Transcript] Next Script: [Clear]
                                                                                                                            Script Name Load Model
                                                                                                                            Run script with full access privileges Off
                                                                                                                            Siri Shortcut Visible Off
                                                                                                                            Include In Menu No
                                                                                                                            Layouts that use this script
                                                                                                                            Scripts that use this script
                                                                                                                              Script Definition
                                                                                                                              Script Steps
                                                                                                                              • Set Variable [ $path; Value:Llama::Model Path ]
                                                                                                                              • Set Variable [ $r; Value:MBS("Llama.LoadModel"; $$session; $path) ]
                                                                                                                              • If [ MBS("IsError") ]
                                                                                                                              • Show Custom Dialog [ Title: "Failed to load model."; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                              • Else [ ]
                                                                                                                              • Set Variable [ $r; Value:MBS( "Llama.StartContext" ; $$session ; JSONSetElement( "{}" ; [ "n_ctx" ; 20480 ; JSONNumber ] ; [ "n_batch" ; 20480 ; JSONNumber ] ) ) ]
                                                                                                                              • If [ MBS("IsError") ]
                                                                                                                              • Show Custom Dialog [ Title: "Failed to start context."; Message: $r; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                              • Else [ ]
                                                                                                                              • Set Variable [ $r; Value:MBS( "Llama.InitSampler" ; $$session ; JSONSetElement( "[]" ; [ "[+].sampler" ; "min_p" ; JSONString ] ; [ "[:].p" ; ,8 ; JSONNumber ] ; [ "[:].min_keep" ; 1 ; JSONNumber ] ; [ "[+].sampler" ; "temp" ; JSONString ] ; [ "[:].t" ; ,8 ; JSONNumber ] ; [ "[+].sampler" ; "dist" ; JSONString ] ) ) ]
                                                                                                                              • Show Custom Dialog [ Title: "Model loaded and ready."; Default Button: “OK”, Commit: “Yes” ]
                                                                                                                              • Commit Records/Requests [ No dialog ]
                                                                                                                              • Truncate Table [ No dialog; Table: “Llama” ]
                                                                                                                              • New Record/Request
                                                                                                                              • Go to Field [ Llama::Text ]
                                                                                                                              • Set Field [ Llama::Text; "Hello" ]
                                                                                                                              • End If
                                                                                                                              • End If
                                                                                                                              Fields used in this script
                                                                                                                              Scripts used in this script
                                                                                                                                Layouts used in this script
                                                                                                                                  Tables used in this script
                                                                                                                                  Table occurrences used by this script
                                                                                                                                  Custom Functions used by this script
                                                                                                                                    Custom menu set used by this script

                                                                                                                                      Previous Script: [Load Model] Next Script: [Clear Transcript]
                                                                                                                                      Script Name Clear
                                                                                                                                      Run script with full access privileges Off
                                                                                                                                      Siri Shortcut Visible Off
                                                                                                                                      Include In Menu Yes
                                                                                                                                      Layouts that use this script
                                                                                                                                        Scripts that use this script
                                                                                                                                          Script Definition
                                                                                                                                          Script Steps
                                                                                                                                          • Commit Records/Requests [ No dialog ]
                                                                                                                                          • Truncate Table [ No dialog; Table: “Llama” ]
                                                                                                                                          Fields used in this script
                                                                                                                                            Scripts used in this script
                                                                                                                                              Layouts used in this script
                                                                                                                                                Tables used in this script
                                                                                                                                                  Table occurrences used by this script
                                                                                                                                                    Custom Functions used by this script
                                                                                                                                                      Custom menu set used by this script

                                                                                                                                                        Previous Script: [Clear] Next Script: [Show backends]
                                                                                                                                                        Script Name Clear Transcript
                                                                                                                                                        Run script with full access privileges Off
                                                                                                                                                        Siri Shortcut Visible Off
                                                                                                                                                        Include In Menu Yes
                                                                                                                                                        Layouts that use this script
                                                                                                                                                          Scripts that use this script
                                                                                                                                                            Script Definition
                                                                                                                                                            Script Steps
                                                                                                                                                            • Set Variable [ $r; Value:MBS( "Llama.ClearTranscript"; $$session ) ]
                                                                                                                                                            • Set Variable [ $text; Value:Llama::Text ]
                                                                                                                                                            • Commit Records/Requests [ No dialog ]
                                                                                                                                                            • Truncate Table [ No dialog; Table: “Llama” ]
                                                                                                                                                            • New Record/Request
                                                                                                                                                            • Go to Field [ Llama::Text ]
                                                                                                                                                            • Set Field [ Llama::Text; $text ]
                                                                                                                                                            Fields used in this script
                                                                                                                                                            Scripts used in this script
                                                                                                                                                              Layouts used in this script
                                                                                                                                                                Tables used in this script
                                                                                                                                                                Table occurrences used by this script
                                                                                                                                                                Custom Functions used by this script
                                                                                                                                                                  Custom menu set used by this script

                                                                                                                                                                    Previous Script: [Clear Transcript]
                                                                                                                                                                    Script Name Show backends
                                                                                                                                                                    Run script with full access privileges Off
                                                                                                                                                                    Siri Shortcut Visible Off
                                                                                                                                                                    Include In Menu Yes
                                                                                                                                                                    Layouts that use this script
                                                                                                                                                                      Scripts that use this script
                                                                                                                                                                        Script Definition
                                                                                                                                                                        Script Steps
                                                                                                                                                                        • Show Custom Dialog [ Title: "Backends"; Message: MBS("Llama.Backends"); Default Button: “OK”, Commit: “Yes” ]
                                                                                                                                                                        Fields used in this script
                                                                                                                                                                          Scripts used in this script
                                                                                                                                                                            Layouts used in this script
                                                                                                                                                                              Tables used in this script
                                                                                                                                                                                Table occurrences used by this script
                                                                                                                                                                                  Custom Functions used by this script
                                                                                                                                                                                    Custom menu set used by this script

                                                                                                                                                                                      Custom Functions

                                                                                                                                                                                      Function Name Parameters Availability Definition In Field Definitions In Scripts
                                                                                                                                                                                      NthItem text;delimiter;itemnumber All accounts // test case: /// text = "Okay, here are 4 things:¶¶1. **The Shadow:** The central legend and mystery of the village.¶2. **Rituals:** The unique and unsettling ceremonies practiced by the villagers.¶3. **Threat Intelligence:** Nickenich’s expertise in analyzing and responding to security threats.¶4. **Incident Response:** Their specialized approach to handling security incidents." /// delimiter = "**" /// itemnumber = 9 Let ( [ start = Case ( itemnumber ≤ 1; 1; Position ( text ; delimiter ; 1 ; itemnumber - 1 ) + Length ( delimiter ) ); end = Position ( text ; delimiter ; start ; 1 ) ]; Case ( itemnumber ≤ 0; ""; start = Length ( delimiter ); ""; end > 0; Middle ( text ; start ; end - start ); Middle ( text ; start ; Length ( text ) - start + 1 ) ) )

                                                                                                                                                                                        Custom Menu Sets

                                                                                                                                                                                        Menu Sets Menus In Scripts In Layouts Comments
                                                                                                                                                                                        [Standard FileMaker Menus]
                                                                                                                                                                                        • All Standard Menus

                                                                                                                                                                                        Download example: Llama chat

                                                                                                                                                                                        Used functions: