• Что бы вступить в ряды "Принятый кодер" Вам нужно:
    Написать 10 полезных сообщений или тем и Получить 10 симпатий.
    Для того кто не хочет терять время,может пожертвовать средства для поддержки сервеса, и вступить в ряды VIP на месяц, дополнительная информация в лс.

  • Пользаватели которые будут спамить, уходят в бан без предупреждения. Спам сообщения определяется администрацией и модератором.

  • Гость, Что бы Вы хотели увидеть на нашем Форуме? Изложить свои идеи и пожелания по улучшению форума Вы можете поделиться с нами здесь. ----> Перейдите сюда
  • Все пользователи не прошедшие проверку электронной почты будут заблокированы. Все вопросы с разблокировкой обращайтесь по адресу электронной почте : info@guardianelinks.com . Не пришло сообщение о проверке или о сбросе также сообщите нам.

Add AI superpower to your Delphi & C++Builder apps part 2: function calling

Sascha Оффлайн

Sascha

Заместитель Администратора
Команда форума
Администратор
Регистрация
9 Май 2015
Сообщения
1,486
Баллы
155
TMS Software Delphi  Components


Image generated by Grok

After the

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

on basic completion, i.e. prompt & answer cycles with the LLM, here is the 2nd part on function calling. This is where things get really interesting for us Delphi & C++Builder developers! We can basically hook up Delphi or C++Builder code to the LLM to let the LLM intelligently execute our code or to give the LLM our data it can then further process.

Integrating Function Calling with Cloud-Based LLMs Using TTMSFNCCloudAI


Large Language Models (LLMs) have become immensely powerful in reasoning, synthesis, and automation tasks. But their capabilities extend far beyond basic conversationthanks to function calling. This transformative feature allows an LLM not only to understand natural language but to actively trigger predefined functions in your software.

In this post, well explore what function calling is, why its such a significant step forward, and how you can easily integrate it into your own applications using the TTMSFNCCloudAI component from the

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

.

What is Function Calling?


At its core, function calling lets an LLM invoke external logiclike APIs or app-specific proceduresbased on the users intent.

Rather than just generating text, the model can identify when a user request matches a known "tool" or "function," understand its parameters, and return a structured payload that your application can process. Your code then executes the appropriate function and sends the result back to the model, closing the loop between natural language and real-world action.

Imagine asking:

With function calling, the model recognizes this intent, fills in the required parameter (city: "Tokyo"), and triggers a predefined function like getWeather. Your app runs that functionperhaps calling a weather APIand returns the current forecast.

Why Is This So Powerful?


Function calling allows LLMs to:


  • Perform precise, structured tasks (like querying APIs or databases)


  • Maintain data security by avoiding hallucinations and only accessing defined functions


  • Enable multi-turn workflows, where the model interacts with tools and returns contextual follow-ups


  • Become part of real applications, not just chat interfaces

It bridges the gap between AI as a reasoning engine and AI as a smart assistant executing actual business logic.

Implementing Function Calling with TTMSFNCCloudAI


The TTMSFNCCloudAI component makes it incredibly easy to integrate function calling, abstracting away much of the complexity.

1. Define Tools and Parameters


Each tool represents a callable function. You add tools to the Tools collection of the TTMSFNCCloudAI component and define parameters for each one.

Heres a minimal example:

This creates a tool called getweather with one required parameter: city. This is a simple example, but tool parameters can be a lot more complex. Multiple parameter's of different types can be added, parameters can be marked as required or not and you can even specify array parameters and define complex types for array elements.

2. Respond to Tool Calls


When the LLM identifies a need to use a tool, the OnExecuteTool event is triggered. You implement this handler to execute your custom logic:

In this example, the LLM supplies the city name, your app calls a weather API, and returns the resultseamlessly integrating AI reasoning with your business logic.

Some more examples


Building further from the GetWeather tool that fetches the current weather conditions and provides it to the AI, now we could add a tool that is able to interact with a map in our Delphi application and put labels on the map. With just this additional tool provided to the LLM, we have an application where the AI can automatically interact with the map and place labels with current weather conditions. The map in this example is our own powerful service-abstract

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

using the Google Maps service.

This is the code to add the tool to TTMSFNCCloudAI that informs the LLM there is a function to add an array of labels on the map at a coordinate Lon,Lat and a string parameter Weather

The code for handling this function call is:


The result for the command below can be seen on the map


"Add a label with the current weather conditions for Paris, Madrid and Lissabon"

TMS Software Delphi  Components


Another example is to use the LLM to convert natural language to SQL commands and have these executed via a Delphi TQuery component. To only thing needed here to help the LLM is inform the LLM what fields are in our databse. This can be done by adding a parameter-less tool that will add the fields displayed in a grid (

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

in this case) and a tool with one string parameter holding the SQL command to execute the it. Configuring the tools is all done at design-time without adding a single line of code!

TMS Software Delphi  Components


The handlers for these two tools are:

With this tool provided, it is smart enough to convert the natural language to a SQL command and have it executed:

TMS Software Delphi  Components


More use cases?


It looks to me that the uses for this are more limited by our imagination than the tecnical details. I can't wait to hear your feedback about other innovative use cases for this technology. Be in touch and we'll be eager to assist you!

Works Across Cloud LLM Providers
TMS Software Delphi  Components



This setup works with any supported LLM that includes function/tool calling capabilitiessuch as OpenAI, Claude, Gemini, Mistral, Ollama, Grok or DeepSeek. TTMSFNCCloudAI abstracts the provider differences and lets you focus on the tool logic! That is the power of

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

where you never worry about the nitty gritty details of the REST APIs behind it.

Conclusion


Function calling is a cornerstone of next-generation AI applications. It turns a passive model into an active collaboratorunderstanding, delegating, and executing tasks. With the TTMSFNCCloudAI component, implementing this is as easy as defining tools, adding parameters, and writing a bit of code in an event handler.

If youre using LLMs in your application and havent yet explored function calling, nows the time.

In upcoming articles, well dive deeper into image processing AI, RAG, agents, MCP servers & clients.
If you have an active

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

license, you can now get also access to the first test version of

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

that uses the TTMSFNCCloudAI component but also has everything on board to let you build MCP servers and clients.
Register now to participate in this testing via this

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

.


Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.





Источник:

Пожалуйста Авторизируйтесь или Зарегистрируйтесь для просмотра скрытого текста.

 
Вверх Снизу