Skip to main content
Skip table of contents

Funktionen und Operationen 5

The AI Chat Connector generates AI-based answers for user prompts.

Properties

Operation

Defines the operation executed by the adapter.

Possible values:

  • AI-Chat: Generates AI-based answers

Parameters

Adapter

Main adapter class (do not change!)

Possible values:

de.softproject.integration.nativeadapter.NativeAdapter: Main class (Default)

Repository

The virtual repository of the adapter project.

Possible values:

13a6386b-c321-4cfb-a259-835774a016c6

protocol

Used AI gateway protocol (HTTP or HTTPS)

Possible values:

  • http: Use HTTP (no encryption) (Default)

  • https: Use HTTPS (SSL-encrypted)

host

Name of the AI gateway host

Possible values: Any valid character string without protocol specification (e.g. localhost)

port

(optional)

Number of the AI gateway port

Possible values:

Any integer (e.g. 9999)

accessToken

Is required to establish a Keycloak connection.

Possible values:

unique access token

The access token needs to be generated in Keycloak.

configKey

Configuration key for the chat service. The key originates from a valid X4AI configuration in the system.

Possible values:

Any string

Examples:

  • default

  • general-knowledge

backstory

Initial context or background information for the LLM (Large Language Model), usually a text file with an instruction in the Resources folder.

Example contents of the text file:

You are a helpful assistant and an X4 BPMS expert.

Possible values:

Path to a txt file

Example:

%USER_COLLECTION_ABSOLUTE%/X4AI-Example-ChatAdapter/Resources/backstory.txt

callbackLog

Outputs information during execution, such as token consumption.

Status values

1 (successful)

The operation was executed successfully.

0

The operation was executed successfully, but without result.

-1 (failed)

The operation failed due to a technical error.

Input

The adapter expects an XML document with the following structure as input.

XML
<x4ai_adapter>
  <prompt>your prompt</prompt>
</x4ai_adapter>

The following elements are included in the input:

Element

Description

x4ai_adapter

Enclosing element for the AI-Chat operation.

prompt

Prompt or question, i.e. instruction to the AI

Output

The adapter generates a XML document as output:

XML
<output>
  <response>AI Response</reponse>
  <callback_log>
    <total_tokens>30</total_tokens>
    <completion_tokens>13</completion_tokens>
    <prompt_tokens>17</prompt_tokens>
  </callback_log>
</output>

The following elements can be contained in the output:

Element

Description

Output

Contains the answer generated by the adapter.

response

Answer of the AI

callback_log

Returns the token consumption during execution.

Contains the elements:

  • total_tokens: Total number of tokens

  • completion_tokens: Number of tokens used for completions

  • prompt_tokens: Number of tokens used for prompts

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.