Skip to main content
Skip table of contents

AI Knowledge Base Chat Connector: Functionality and Operation

The AI Knowledge Base Chat Connector generates AI-supported responses to user prompts and uses previously stored data to answer them.

Properties

Operation

Defines the operation executed by the adapter.

Possible values:

AI-Knowledgebase-Chat: Generates AI-supported responses to user prompts. Previously stored data is used for the response.

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:

876cf76d-bcb1-463e-8433-68270d04c00e (Default)

protocol

Used protocol (HTTP oder HTTPS)

Possible values:

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

  • https: Use HTTPS (SSL-encrypted)

host

Name of AI gateway host

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

port

(optional)

Number of 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

datasets

List of data records used for the response, comma-separated.

Possible values:

Any character string for existing data records in the system, comma-separated.

Example:

x4.documentation.ver7-3-1,x4.documentation.ver7-2-3

backstory

Initial context or background information for the LLM (Large Language Model).

There are two options:

  • a statement with the variables {knowledgebase} and {prompt} in the parameter backstory

  • Text file (.txt) with an statement in the folder Resources

Possible values (Examples) for a statement with the variables {knowledgebase} and {prompt}:

  • Complete the prompt based only on the following context: {knowledgebase} {prompt}

  • You are a helpful assistant and an X4 BPMS expert: {knowledgebase} {prompt}

Possible value when using a text file:

Path to a txt file

Example:

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

Example contents of the text file:

You are a helpful assistant and an X4 BPMS expert: {knowledgebase} {prompt}

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.

CODE
<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-Knowledgebase-Chat operation.

prompt

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

Output

The adapter generates a XML document as output:

CODE
<output>
  <original_prompt>customer’s question</original_prompt>
  <response>AI Response</response>
  <sources>
    <metadata>
      <id>uuid</id>
      <source>document name</source>
      <page>page</page>
      <source_url>url</source_url>
      <version>document version</version>
      <similarity_score>number between (0; 1)</similarity_score>
    </metadata>
    <metadata>
      <id></id>
      <source>X4BPMS_731_ESB_EN</source>
      <page>588</page>
      <source_url>http://download.softproject.de/x4bpms/7-3-1/X4BPMS_731_ESB_EN.pdf#page=588</source_url>
      <version>7.3.1</version>
      <similarity_score>0.16465315713444784</similarity_score>
    </metadata>
  </sources>
  <callback_log>
    <total_tokens>30</total_tokens>
    <completion_tokens>13</completion_tokens>
    <prompt_tokens>17</prompt_tokens>
    <total_cost_usd>0.01327</total_cost_usd>
    <successful_requests>1</successful_requests>
  </callback_log>
</output>

The following elements are included in the output:

Element

Description

Output

Root element for the operation AI-Semantic-Search.

original_prompt

Original question to the AI

response

AI answer

sources

Enclosing element for the element metadata.

metadata

Meta data of document with the elements:

  • id: Document ID

  • source: unique name (sourceKey) of the document

  • page: Document page

  • source_url: Document URL

  • version: Document version (Version: 7.3 1 7.4.0)

  • similarity_score: Similarity score of answer to the question asked. The lower the value, the better the match with the question.

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

  • total_cost_usd: Total cost of the request in USD

  • successful_requests: Number of successful requests

JavaScript errors detected

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

If this problem persists, please contact our support.