Incorporating Generative AI Into Applications: Our Journey From Inspiration To Implementation

Incorporating Generative AI Into Applications: Our Journey From Inspiration To Implementation
AUTHOR
Pavel Stambrecht

Like many other mobile developers, we from Etnetera Flow visited this year's mDevCamp in Prague. And one of the topics we were most interested in was incorporating generative AI into apps. In an internal PoC called Floutek, we then verified for ourselves that incorporating AI into apps can be quite easy and beneficial. All you need is the right idea and a bit of experience. We hope to move our Floutek from the PoC phase to a full-fledged implementation that will simplify our daily workflow using AI.

Inspiration from mDevCamp

After a long break, the whole mDevCamp was offline again, which gave it a great atmosphere and allowed for face-to-face meetings with other technology enthusiasts. The presentations were not only informative but also inspiring. Our team at mDevCamp was most impressed by these presentations:

  • Building a Secure Fintech App by Petr Dvorak from Wultra, which discussed in detail the aspects of security in fintech applications.
  • Kamil Borzym from Allegro also gave a great presentation Hacking iOS Mobile App, which showed why it is better to use SFSafariViewController instead of WKWebView for OAuth.
  • However, we were most inspired by the presentation on incorporating Gemini AI into mobile apps Hey Google! Help me make my open source app more fun with Gemini and Generative AI by Ahmed Tikiwa. And it was thanks to her that we decided to try out the technology ourselves.

Floutek: Our innovative playground

At Etnetera Flow, we enjoy technology and are constantly looking for ways to make our work easier. One such example is the automatic detection and entry of home office, which we solve with Floutek.

Floutek is our internal Java Virtual Machine (JVM) application that determines whether a colleague is in or out of the office by detecting available IP addresses. If he is out of the office, a home office event is created in the HR tool. In addition, Floutek sends summary information to a specific channel in Slack.

Floutek is also a great place to experiment with new technologies. That's where the idea for a proof of concept (PoC) for using AI to automatically detect leave from the text of Slack messages came from.

Our PoC solution: How it works

Our PoC solution includes the following steps:

  1. A user posts a vacation message to a specific Slack channel.
  2. Slack forwards the message to our API, which uses AI to evaluate whether there is vacation information in the text.
  3. If the service detects a vacation, it sends the user a response in the form of a Slack message with the option to send the event to the HR tool. 

(Note: We don't cover the actual sending of the event to the HR tool in PoC right now. We only prepare the required button in the response.)

Following the example of the mDevCamp presentation mentioned above, we have chosen Gemini as the AI, which we access via Firebase. Since our solution also uses Firebase Functions and Firestore, using Firebase to access Gemini was a logical choice.

Technical implementation of AI in the application

Our solution uses the following components:

  • Floutek Slack application as an interface between Slack and our API.
  • Google Apps Script for Floutek logic.
  • Firebase Functions as an API to communicate with Gemini AI and store request history in the Firebase Firestore.

A key aspect of generative AI is getting the prompts right, i.e., the way we query the AI. After several iterations, we found a prompt structure that includes:

  • A description of the current state, i.e., a definition of the current day and date, which are dynamically injected.
  • An explicit description of the desired output with examples where we require valid JSON containing individual dates with holiday information.
  • An additional "sugar" description for modifying the non-valid output.
  • Explicit statement of what the AI should do.

Our prompt currently looks like this:

Example response:

The new Gemini 1.5 Pro Preview version also supports JSON format as output, which allows us to simplify the prompt significantly. However, we intentionally kept the structure for backwards compatibility with Gemini 1.0 Pro.

Results and next steps

It's fascinating what can be done with AI today. Using a short prompt, we were able to solve tasks that would have been time-consuming and complex using other methods. Another big advantage is the support of the Czech language, which, for example, Google Assistant never got.

 

You can review the results of PoC in this short video.

A few comments on the current state of PoC:

  • Outputs are not always completely correct
  • While the outputs are not always deterministic and sometimes not entirely true, we see significant steps forward with newer models like Gemini 1.5 Pro Preview.
  • We have confirmed that it makes sense to utilize AI not only during development, but also within the mobile apps themselves.
Generative Artificial Intelligence (Generative AI) is a rapidly growing field that enables the creation of new and original content such as text, images, music and videos using advanced algorithms such as deep neural networks. Unlike traditional AI systems that recognize patterns and perform specific tasks, generative AI generates answers and content based on input data. Well-known examples include OpenAI's GPT, which produces fluent text from simple prompts, and Google's Gemini, which supports creative collaboration and assists content creators.
<html>
<p>Test</p>
</html>

Read Next

Let’s make something great

Do you need to ideate, design or develop an app?
We are here to help you.
Schedule a call