Ian’s Nov 2024 Meeting Summary

  • GraphQL, or There and Back Again, an API engineer’s tale… – Richard Hatherall
  • I made money from AI – Simon Hooper
  • Creating an AI Assistant for Excel – Conrad Vermeulen
  • Flecks: Split editors in Delphi & Signing emails – Richard Hatherall & Will Watts

Ian’s Summary

Welcome and News

This was a virtual meeting, with all attendees on-line. The meeting began on time with the usual housekeeping. There has been a change of date for the January meeting, which is now on Wed.15th January. Jason asked for flecks for the end of the session, as he was expecting a gap to fill.

The usual comment about not having enough in Talks and Planning. Do people want more talks or practical sessions on AI? Lorenz said that he was disappointed with AI. Jason is trying to book Marco Geuze from GDK for January, who could talk on either AI or Spring4D.

Issues with Delphi 12.2 LSP were mentioned and the discussion moved to tools in Delphi. Some MVPs might be active in this area. Idera or Embarcadero, who controls what, who makes the decisions and on what basis? Will the upcoming 30th anniversary just be another marketing opportunity?

GraphQL, or There and Back Again, an API engineer’s tale… – Richard Hatherall

The first scheduled session was by Richard Hatherall, on the subject of GraphQL. It was presented, with innovative graphics, as a summary of his time with a market research company. At the start it had a REST API serving data to client processes. A drawback of this arrangement was that REST is a style not a standard, so there is no common way to present endpoints.

With REST, each endpoint serves resource. Ruby-on-Rails has a standardised convention for routing based on CRUD actions around a resource and was introduced to simplify the process. It allows chaining of resources, for which examples were shown. The keyword “shallow” was introduced to hide the parent tree in chained requests.

JSON output could be large, Mbs, and async requests can result in unknown payload sizes and load times. Attempts to standardise JSON for REST were mentioned including examples like HATEOS and active model serialisers, although users then find themselves tied to a particular version.

Moving on to GraphQL, it allowed front-end developers to do what API developers usually did. It was described as SQL for JSON APIs, JSON, but typed and with schema. There are 3 basic types of operation, queries, mutations and subscriptions. Multiple actions can be combined in a single request. An example was shown. The server side needs to know the schema, because it still needs to know how to access the data.

Reflecting on the use of GraphQL, Richard explained that there is no decent GraphQL client for Delphi. Using REST with a GraphQL proxy is not a good way to go. In their first attempt, they used integers as IDs, but mutations triggered multiple REST API calls, which was not safe and it did not scale well.

Moving on to Ruby with a GraphQL gem, it uses Rails features for authorisation, global object id, mutations in transactions and caching. An example of object identification was shown, Using “__type” will return type information from the schema. Browser memory was mentioned, because it can vary and can be important with large result sets.

In conclusion, Richard said that REST is much more straight forward than GraphQL and should be used if it is sufficient for the requirements of the process. There was a question on representations and a discussion of multiple representations. The GraphQL specification contains recommendations on object representation.

I made money from AI – Simon Hooper

The second session was by Simon Hooper entitled I made money out of AI. Simon began by stating that hem is not an expert on AI, but it has its uses. He identified a valid use-case within one of his applications and gave a demonstration of how he had added new AI based features and sold it to his customers.

The session was presented as a demonstration of a web application, which is used for designing training courses. The function of the application was described. For the demo, a new course was created and the use of AI in the process of building the course was shown. In essence, a topic is presented to the “AI” and the response is shown on the form, where the user can accept it, edit it or try again. The benefit is that it shortens the cycle, where the trick is to extract the bits that are relevant.

There is a setup form, which controls the parameters, levels of accuracy or acceptability of the results that will be generated from the model. There is also a list of models, from which the user can select the most appropriate. The models had been built over 2 years using ChatGpt. The models have similar interfaces and can be added to the list by name. The models need to be up to date.

Looking at code, an in-house library had been created, although this is not for a specific application, but can be used in many. There is also a third party library in use and some configuration around license keys, as a part of the AI service subscription. Within the application, an AI object is created and a method is called to generate a result; it takes a string as a parameter and returns a string.

Creating an AI Assistant for Excel – Conrad Vermeulen

The third session was presented by Conrad Vermeulen on the topic of AI in Excel. The AI bit was provided by a local model server, downloadable from ollama.com, which can be installed on Linux, Mac and Windows. Different models are available for download. In theory the models can be trained in ollama, but that had not been tried in this case. The AI function used in this project will extract elements from a long string.

To run the AI processes in Excel, they have been built into a library, which, for Excel is an “xll”, rather than a normal “dll”. The functions in the library need to be registered in Excel, with the Excel sdk. Registering the functions will create a new category in the functions menu. Excel does now support functions in Javascript, but for this exercise, Conrad demonstrated writing them with Delphi.

In Delphi, a new library project was created. It was set to import some support units that Conrad has written, but these were not shown. The exposed functions are decorated with attributes, to be picked up by the sdk. A normal class is defined, then class functions, again decorated with attributes and finally the function parameters also had attributes applied. The function is registered in the initialization section.

Details on how to use the ollama models are available in the help docs on GitHub. The Ollama model can accept requests with either simple parameters or advanced parameters. It can respond with different forms of completion. There is an option for a single, immediate response, which is what was used in the Excel demo. Building the query object creates a JSON string with the query parameters and the JSON response is unpacked and returned to Excel.

Ollama also has chat style responses, where successive calls generate different responses. The other option is a streaming response, where it appears to keep going until told to stop. A demo of the streaming response was shown in the context of “Tell me Story”.

Flecks: Split editors in Delphi & Signing emails – Richard Hatherall & Will Watts

There were then two Flecks, the first from Richard Hatherall on split editors in Delphi. In the Options menu, Split opens the current editor file in another window, which appears to be docked side-by-side with the main editor window. Richard complained that the main editor window could not be made smaller than 80 characters, so the new window could not be made large enough. He also said that running with breakpoints, the second window jumps out, but it is hit and miss whether it rearranges itself properly.

The second fleck was from Will Watts on signing emails, with a demo on how. He uses Actalis, who do have a free tier, but that requires jumping through many hoops. Some providers only last a month, but Actalis lasts a year. There were questions on what happens when it expires. Will uses the Thunderbird mail client and showed how to set it up.