Aiimi Insight Engine
User GuidesAiimi
  • Introducing Aiimi Insight Engine
  • Architecture
    • Overview and Key Concepts
    • Search Flows
      • Search Flow Types
      • Smart Filtering
      • Query and Prompt Classification
      • Search Algorithms
      • Extractive and Generative Models
    • Hosting Options
    • Architecture and How It Works
      • Agent Servers
        • Security Agent
        • Source Agent
        • Content Agent
        • Enrichment Agent
        • Job Agent
        • OCR Agent
        • Migration Agent
        • Tika Agent
      • Repository
        • Data Node
        • Proxy Node
        • Kibana Node
      • Gateway and User Interface
      • Document and Data Sources
    • Deployment Options
    • Security
      • User Security
      • Data and Document Security
      • Source System Security
      • Firewalling
      • Agent Servers
      • Repository
      • Gateway (Web Server)
      • Tools & Utilities
  • Installation
    • Elastic and Kibana Install (Windows)
    • Aiimi Insight Engine Installation (Windows)
      • Installation Security
      • Certificates in a Key Vault
      • SAR Configuration
      • CSOM Bridge Set Up
      • AI Studio
    • AI Services
      • Prerequisites
      • AI Enrichment Service
        • Installation and Setup
        • Enabling Enrichment Steps
        • Using AI Enrichment Steps
        • Performance and Concurrency
      • AI Model Service
        • Installation and Setup
        • Enabling Providers
        • Private Generative AI
        • Azure Open AI
        • Enabling AI History
        • HTML Cleaner Service
      • Configuration of Logging
      • Offline Set-up of Models
      • Using SSL
      • Running as a Service (Windows)
      • Using GPUs
      • AI and Semantic Search Set Up
        • Open & Closed Book AI
        • Semantic Search
          • Vectors for Semantic Search
          • Source Configuration
          • Sentence Transformer Models
          • Enrichment
          • Kibana
          • Final Search Flow
    • Email Threading Upgrade
  • Run Books
    • SharePoint Online Connector
  • Control Hub
    • Configurations
      • Config Management
      • Security Configurations
        • Security - General
        • Security - Source
          • Active Directory
          • Atlassian
          • Azure Active Directory
          • Builtin Security
          • Miro Security
          • Google Directory
          • Slack Security
        • Security - Sync
        • Security - Agents
        • Security - Scheduling
      • Source Configurations
        • Source - General
        • Source - Source
          • Alfresco Kafka
          • Azure Blob Storage
          • BBC Monitoring
          • Big Query Cataloguer
          • BIM360
          • CSV Data Loader
          • Confluence
          • Content Server
          • Data File Cataloguer
          • Document Store
          • DocuSign
          • Dropbox
          • Exchange 365
          • Filesystem
          • Google Bucket
          • Google Drive
          • Google Vault
          • Jira
          • JSON Data Loader
          • Livelink
          • Microsoft Teams
          • Mimecast
          • Miro
          • ODBC Data Loader
          • PowerBi Cataloguer
          • Reuters Connect
          • ShareFile
          • SharePoint
            • Azure Portal and Azure AD Authentication
            • Sensitivity Labels
          • SharePoint Legacy
          • SQL Server Cataloguer
          • Slack
          • Versioned Document Store
          • Websites
          • XML Data Loader
        • Source - Crawl
        • Source - Agents
        • Source - Schedule
        • Source - Advanced
      • Enrichment Configurations
        • Creating a Pipeline
          • General
          • Steps
            • AccessMiner
            • AI Classification
            • Anonymiser
            • CAD Extractor
            • Checksum
            • Content Retrieval
            • Copy
            • Data Rule Processor
            • Delete
            • Email Extractor
            • Entity Rule Processor
            • External Links
            • Geotag
            • Google NLP Extractor
            • Google Vision Extractor
            • Metrics Calculation
            • Microsoft Vision Extractor
            • OcrRest
            • Office Metadata
            • PCI Extractor
            • REST
            • Set Document Risk
            • Text Cleaner
            • Tika Text Extraction
            • Trie Entity Extractor
            • Update Metadata
          • Filters
          • Agents
          • Schedule
          • Advanced
      • OCR Engine
      • Job Configurations
        • General
        • Job
          • AutomatedSearchJob
          • Command Job
          • ElasticJob
          • Extended Metrics Job
          • File Extractor
          • GoogleVaultSAR
          • Google Drive Last Access Date
          • Nightly Events Processor Job
          • Notifications Processor Job
          • Portal Sync Job
          • Purge Job
          • Text Content Merge Job
        • Output
        • Agents
        • Scheduling
      • Migration Configuration
        • General
        • Filter
        • Metadata Mappings
        • Agents
        • Scheduling
        • Advanced
    • Credentials
    • Mappings
      • Entities
        • Manage Entity Groups
        • Create an Entity
        • Manage an Entity
      • Models
        • Create a New Model
        • Find a Model
        • Enable or Disable a Model
      • Vectors
      • Rank Features
    • Featured Links
    • AI Settings
      • Classifications
      • Class
      • Class Rules
      • AI Classification
    • User Settings
    • Stats
      • Data Views
    • Global Settings
      • General
      • Authentication
      • App Settings
      • Application Access
      • Thumbnails
      • Presets
      • Code of Conduct
      • Metrics
      • Viewer
      • SAR
        • Importing Data For A SAR
        • SAR Disclosure Document Storage
        • Getting SAR data from Google Vault
        • SAR Access
        • SAR File Status
      • Disclosure Portal
        • Disclosure Portal Set Up
        • SARs From The Portal
        • Email Delivery Settings
          • Delivery Settings
          • Brand Settings
          • Customise Emails
        • SMS Delivery Settings
        • Requestor Message Limit
        • Attachment Configuration
        • Password Configuration
        • File Scanner Configurator
      • Collections
      • Visualisations
        • Related Result Connections Diagram
        • Event Timeline
        • Timeline Lens Activity Chart
        • Relationship Map
      • Notifications
      • Map Lens
      • Theming
      • User Avatar
      • OData API
      • Uploads
      • Security
    • Search Settings
      • Search Relevancy
        • Core Settings
        • Makers Algorithm
        • Filename Boost Layer
        • Minimum Matching Terms Filter
        • Field Boost
        • Modified Date Boosting
        • Hit Highlighting
        • Why My Search Matched
        • Data Search Strategy
      • Bulk Search
        • Managing a Bulk Search
      • Search Flows
        • Create a Search Flow
          • General
          • Query Classification Step
          • Search Steps
          • Model Steps
      • Tools
        • Concepts
        • Import OOTB Tools
        • Built In Functions and Tools
        • Create and Edit Tools
      • Filtering
      • Search Performance
      • Related Results
  • AI Studio
    • Classifications
      • Classifications
      • Classification Rules
    • Jobs
  • Labels
  • API Guides
    • Insight API Guide
      • Swagger Documentation
      • Trying Some Endpoints
      • Search Filter
      • Hits / Items
      • Inspecting REST Calls
    • Data Science API Guide
      • REST Interface
        • Login
        • Datasets
        • Fields
        • Field Statistics
        • Search
        • Scroll
        • Update
      • Python Wrapper
        • Login
        • Datasets
        • Fields
        • Field Statistics
        • Search
        • Query Builders
        • Scroll
        • Scroll Search
        • Update Single Document
        • Bulk Update
    • Creating a Native Enrichment Step
      • Creating an Enrichment Step
        • Creating the Core Classes
        • Extending our Enrichment Step
        • Adding a Configuration Template
        • Adding the Enrichment Step
        • Creating an Enrichment Pipeline
      • Other Tasks
        • Entities, Metadata and Data
        • Accessing the Repository
      • Example Code
      • Troubleshooting
    • Creating a Python Enrichment Step
      • Creating an Enrichment Step
        • Running the Example from Command Line
        • Running the Example
      • Creating Your Own Step
      • Adding or Changing Entities, Metadata
  • Whitepapers and Explainers
    • From a Billion To One – Mastering Relevancy
    • Methods for Text Summarization
      • Application
      • Technology Methods
      • Commercial Tools
      • Key Research Centres
      • Productionisation
      • Related Areas of Text Analytics
      • Conclusion
      • References
Powered by GitBook
On this page
  • LLM Tool Calling Function Definitions
  • What is a Function Definition?
  • JSON Schema Structure
  • Basic Structure
  • Core Fields
  • Parameter Types and Constraints
  • Complete Example
  • Best Practices
  • Advanced Features
  • Testing Your Definitions
  • Troubleshooting
  • LLM doesn't call your function
  • Parameter errors
  • Function called incorrectly
  1. Control Hub
  2. Search Settings
  3. Tools

Concepts

LLM Tool Calling Function Definitions

Tool calling allows language models to use external systems, APIs, and services. The foundation of this lies in JSON Schema definitions. They describe each available tool's interface, parameters, and expected behaviour.

What is a Function Definition?

A function definition is a structured specification that tells the LLM:

  • A description of what the function does

  • The parameters it accepts

  • What parameters are required and what are optional

  • The expected data types for each parameter

  • Valid value constraints and formats


JSON Schema Structure

Function definitions use JSON Schema formats with these key components:

Basic Structure

{
  "name": "function_name",
  "description": "What this function does",
  "parameters": {
    "type": "object",
    "properties": {
      "parameter_name": {
        "type": "string|number|boolean|array|object",
        "description": "What this parameter is for",
        "enum": ["option1", "option2"],
        "default": "default_value"
      }
    },
    "required": ["required_parameter_names"],
    "additionalProperties": false
  }
}

Core Fields

  • name (string, required)

    • The function identifier that the LLM will use to call this tool.

    • Should be descriptive and follow snake_case or camelCase naming conventions.

  • description (string, required)

    • This helps the LLM understand when to use this tool.

    • Should be a clear explanation of what the function does.

    • It's important it is concise but informative.

  • parameters (object, required)

    • Defines the function's input schema using JSON Schema.

    • Always has "type": "object" at the root level.


Parameter Types and Constraints

String Parameters

"username": {
  "type": "string",
  "description": "User's login name",
  "minLength": 3,
  "maxLength": 50,
  "pattern": "^[a-zA-Z0-9_]+$"
}

Number Parameters

"temperature": {
  "type": "number",
  "description": "Temperature in Celsius",
  "minimum": -273.15,
  "maximum": 1000
}

Boolean Parameters

"include_metadata": {
  "type": "boolean",
  "description": "Whether to include additional metadata",
  "default": false
}

Array Parameters

"tags": {
  "type": "array",
  "description": "List of category tags",
  "items": {
    "type": "string"
  },
  "minItems": 1,
  "maxItems": 10
}

Object Parameters

"user_profile": {
  "type": "object",
  "description": "User profile information",
  "properties": {
    "name": {"type": "string"},
    "age": {"type": "number"}
  },
  "required": ["name"]
}

Enum Parameters

"priority": {
  "type": "string",
  "description": "Task priority level",
  "enum": ["low", "medium", "high", "urgent"]
}

Complete Example

{
  "type": "function",
  "function": {
    "name": "Search_ai_demo",
    "description": "Performs a search to find relevant information to answer a users question. Use the makers_clear_water_inc sourceId for water related queries.",
    "parameters": {
      "type": "object",
      "properties": {
        "queryString": {
          "type": "string",
          "description": "The search query string. Just provide keywords that you want to search for. Do not provide the field name or anything else."
        },
        "sourceIds": {
          "description": "The source ids to search.",
          "items": {
            "enum": [
              "ai_demo",
              "makers_clear_water_inc"
            ],
            "type": "string"
          },
          "type": "array"
        },
        "size": {
          "type": "number",
          "description": "The number of results to return. If you do not pass this then the default number will be returned. This parameter should only be set if the user asks for a specific number of results to be returned."
        }
      },
      "required": [
        "queryString",
        "sourceIds"
      ]
    }
  }
}

Best Practices

Clear Descriptions

  • Write the descriptions from the LLM's perspective.

  • Explain when and why to use the function.

  • Include information about the expected outcomes.

Parameter Naming

  • Use descriptive, self-explanatory names.

  • Follow a consistent naming convention.

  • Avoid abbreviations unless universally understood.

Validation and Constraints

  • Set appropriate minimum and maximum values.

  • Use enums for fixed sets of options.

  • Include format specifications for dates, emails, URLs.

  • Set realistic string length limits.

Required vs Optional

  • Mark any essential parameters as required.

  • Provide sensible defaults for optional parameters.

  • Consider the minimum viable function call.

Error Prevention

  • Use additionalProperties: false to prevent unexpected parameters.

  • Include format validations where applicable.

  • Set realistic bounds on numeric values.


Advanced Features

Conditional Parameters

Use oneOf, anyOf, or allOf for complex parameter relationships:

"search_criteria": {
  "oneOf": [
    {
      "properties": {
        "by_name": {"type": "string"}
      },
      "required": ["by_name"]
    },
    {
      "properties": {
        "by_id": {"type": "integer"}
      },
      "required": ["by_id"]
    }
  ]
}

Dynamic Validation

"coordinates": {
  "type": "object",
  "properties": {
    "latitude": {
      "type": "number",
      "minimum": -90,
      "maximum": 90
    },
    "longitude": {
      "type": "number", 
      "minimum": -180,
      "maximum": 180
    }
  },
  "required": ["latitude", "longitude"]
}

Testing Your Definitions

When creating function definitions:

  1. Validate JSON Schema - Ensure your schema is syntactically correct.

  2. Test Edge Cases - Consider boundary values and invalid inputs.

  3. Verify Descriptions - Make sure they clearly communicate intent.

  4. Check Required Fields - Ensure minimum viable calls work.

  5. Test with LLM - Verify the model understands when to use your function.


Troubleshooting

Well-crafted function definitions are the key to successful LLM tool integration. This enables models to understand not just what tools are available, but exactly how and when to use them effectively.

LLM doesn't call your function

  1. Check the description clearly indicates when to use it.

  2. Ensure required parameters aren't too restrictive.

  3. Verify the function name is intuitive.

Parameter errors

  1. Review your type definitions and constraints.

  2. Check for typos in parameter names.

  3. Ensure required parameters are actually needed.

Function called incorrectly

  1. Add more specific descriptions.

  2. Use enums to limit parameter values.

  3. Include examples in descriptions where helpful.

PreviousToolsNextImport OOTB Tools

Last updated 1 day ago