Utils

Utils for the Integreat Chat

Chat Bot

Wrapper for the Chat Bot / LLM API

async integreat_cms.api.v3.chat.utils.chat_bot.async_process_translate(message_text: str, source_language: str, target_language: str) dict[source]

Process automatic or counselor answers

Parameters:
  • message_text (str)

  • source_language (str)

  • target_language (str)

Return type:

dict

async integreat_cms.api.v3.chat.utils.chat_bot.async_process_user_message(zammad_chat_language_slug: str, region_slug: str, region_default_language_slug: str, messages: list[dict]) tuple[dict, dict][source]

Process the message from an Integreat App user

Parameters:
  • zammad_chat_language_slug (str) – Language selected in Integreat App

  • region_slug (str) – region used in webhook

  • region_default_language_slug (str) – default language of region / counselors

  • messages (list[dict]) – list of all messages (can contain newer messages than message_text)

Return type:

tuple[dict, dict]

async integreat_cms.api.v3.chat.utils.chat_bot.automatic_answer(messages: list, region_slug: str, language_slug: str, session: ClientSession) dict[source]

Get automatic answer to question asynchronously

Parameters:
  • messages (list)

  • region_slug (str)

  • language_slug (str)

  • session (ClientSession)

Return type:

dict

async integreat_cms.api.v3.chat.utils.chat_bot.automatic_translation(message: str, source_language_slug: str, target_language_slug: str, session: ClientSession) dict[source]

Use LLM to translate message asynchronously

Parameters:
  • message (str)

  • source_language_slug (str)

  • target_language_slug (str)

  • session (ClientSession)

Return type:

dict