Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Before you can start, an AI backend needs to be configured. Depending on your license, by default PIPEFORCE comes with it’s own built-in AI backend. The secret name of this is openaiai-default-secret.

If you do not specify otherwise, this AI backend secret is used by default.

...

  • base_url: The base url of the API (requried).

  • model: The AI model to be used (required).

  • api_token: The security token to be used.

  • max_token: The max token to be send (defaults to 800)

  • custom_headers: Key-value pairs to be passed along as HTTP headers on any request. This is handy for example in case basic authentication or any other additional header setting is required.

Connect to OpenAI (ChatGPT)

...

Code Block
languagejson
{
  "base_url": "https://api.openai.com/v1",
  "model": "gpt-3.5-turbo",
  "api_token": "your_token",
  "max_token": 800
} 

Send a question or advice (prompt) to

...

AI

...

One of most generic and simplest use cases is to send a prompt (= a requestquestion / advice) to the AI and use the response data in your pipeline. For this you can use the ai.prompt.send command. Here is an example to return some data from the AI:

...

Code Block
languagejson
[
    "Tokyo",
    "Delhi",
    "Shanghai",
    "Sao Paulo",
    "Mumbai",
    "Beijing",
    "Mexico City",
    "Osaka",
    "Cairo",
    "Dhaka"
]

Adding context data (

...

input) to the prompt

You can also apply the prompt on a given context data which is the input datawith context data. This context data can be set as input to the command:

Code Block
languageyaml
pipeline:
  - ai.prompt.send:
      input: |
        [
          "Tokyo",
          "Delhi",
          "Shanghai",
          "Sao Paulo",
          "Mumbai",
          "Beijing",
          "Mexico City",
          "Osaka",
          "Cairo",
          "Dhaka"
        ]
      prompt: |
        Order the given list alphabetically.

The result of this example in the body is then:

Code Block
languagejson
[
    "Beijing",
    "Cairo",
    "Delhi",
    "Dhaka",
    "Mexico City",
    "Mumbai",
    "Osaka",
    "Sao Paulo",
    "Shanghai",
    "Tokyo"
]

See another example which converts a given input:

...

languageyaml

...

The input of the command will become the context data. It can be plain text, a file or an URI. In case it is a file (for example a PDF or Word document) or any other supported format, it will be automatically converted into an AI compatible format.

Here is an example which uses a PDF file as file context, stored in PIPEFORCE’s Drive cloud storage:

Code Block
languageyaml
pipeline:
  - ai.prompt.send:
    <person>  input: $uri:drive:invoice-3662.pdf
       <firstName>Max</firstName>prompt: |
        Check the invoice to ensure it is <lastName>Smith</lastName>correct both in terms 
      <age>36</age>  of content and calculations. If everything is </person>fine, return "OK". 
   prompt: "Convert to JSON"

...

   If not, provide the reason for the error in one sentence.

See another example which converts a given input:

{
Code Block
languagejson
yaml
pipeline:
  - ai.prompt.send:
  "person": {   input: |
    "firstName": "Max",   <person>
     "lastName": "Smith",    <firstName>Max</firstName>
    "age": 36     }
}

And once more you could apply data privacy filters for example:

Code Block
languageyaml
pipeline:<lastName>Smith</lastName>
   - ai.prompt.send:      <age>36</age>
input: |       </person>
 {     prompt: "Convert to JSON"

And the result from the AI in the body will be this:

Code Block
languagejson
{
    "person": {

           "firstName": "Max",
   
        "lastName": "Smith",
   
        "age": 36
     
    }
        }
      prompt
}

And one more example: Apply a data privacy filter:

Code Block
languageyaml
pipeline:
  - ai.prompt.send:
      input: |
        {
 Remove   all personal data because of privacy and"person": {
          replace by randomized names and add prefix p_

As a result, a changed JSON comes back:

Code Block
languagejson
{"firstName": "Max",
            "personlastName": { "Smith",
            "firstNameage": "p_Alex", 36
         "lastName": "p_Johnson", }
        "age":}
48     }
}

Send multiple messages

In case you need to send multiple messages, you can use the messages parameter like this:

Code Block
languageyaml
pipeline:
  - ai.prompt.send: prompt: |
         messages: Remove all personal data because of privacy and -
role: system         replace by content:randomized Tellnames meand aadd joke based on given user input.
prefix p_

As a result, a changed JSON comes back:

Code Block
languagejson
{
    "person": {
       - role"firstName": user"p_Alex",
        "lastName":  content: I'm a 28 year old man living in New York.

The result could be like this in the body:

Code Block
Why did the New York man bring a ladder to his job interview? 
Because he wanted to climb the corporate ladder!

...

"p_Johnson",
        "age": 48
    }
}

Avanced prompting: Send multiple messages

In case you need to send multiple messages in one prompt, you can use the parameter messages like this:

Code Block
languageyaml
pipeline:
  - ai.prompt.send:
      messages:
        - role: system
          content: Tell me a joke based on given user input.
        - role: user
          content: I'm a 28 year old man living in New York.

The result could be like this in the body:

Code Block
Why did the New York man bring a ladder to his job interview? 
Because he wanted to climb the corporate ladder!

If both parameters, messages and prompt are given, prompt will be automatically added to messages of role system at the very end.

Possible values for role are:

  • system = A system message from the caller (typically the context data with basic advice).

  • user = A message from the user (typically the question or advice based on the context data).

  • ai = A message from the AI (typically used to enrich the context or trace the conversation).

The parameter content can be a plain text or any AI convertable object (like a PDF file for example). The conversion and preparation to an AI compatible format is done by PIPEFORCE automatically.

Text-to-Command -

...

Let the AI start a command

This is the next level of automation where the AI can start a command and with this, start a business process fully automated. For this, the AI takes a non-structured text such as an email, a chat message or a PDF document for example, analyses it using AI and then automatically detects and executes the according PIPEFORCE command including its parameters which must be executed in order to take action and fulfill the user’s request.

...

Drawio
mVer2
zoom1
simple0
inComment0
custContentId3209920520
pageId3209068546
lbox1
diagramDisplayNameUntitled Diagram-1733754941173.drawio
contentVer1
revision1
baseUrlhttps://logabit.atlassian.net/wiki
diagramNameUntitled Diagram-1733754941173.drawio
pCenter0
width1559.93
links
tbstyle
height517

Here are some examples example use cases where this feature could be helpful:

  • Automatically forward emails with a summary to the responsible internal team
    Scan any email sent to a given inbox such as info@mycompany.tld for example, find out the intention of the sender, then forward the email to the internal team such as support, sales, … which can handle the request. The AI can find out the type of request, whether it is a support request, an order request, a question regarding an invoice or any other type just by writing an advice to the AI and without any programming. It can also detect and extract all required data such as customerId, invoiceNumber and more from the sender’s email. Furthermore, it can also create a short summary about what the core intent of the sender is to make it easier for the internal team to process the request.

  • Automatically validate and start an internal workflow by email
    Scan any email sent to a given inbox such as invoice@mycompany.tld for example and if this email matches to an existing workflow, extract all variables required for this workflow from the email, start the workflow and pass these variables along with it. For example to start an accounts payable workflow based on an given payable invoice. The AI can validate whether all required data exist and is valid in order to start the workflow.

  • Automatically call endpoints of other systems by email
    Scan any email sent to a given inbox such as info@mycompany.tld for example and if this email is related to a service, offered by a third party system which provides an remote API, call this remote API (for example REST) and pass along parameters extracted from the email. For example create a new ticket on an external ticket system.

...

See this example to construct a message out of advice parameters using a template:

Code Block
languageyaml
...
targetCommand: "mail.send"
...
params:
  message:
    value: "The customerId is: {{advice.params.customerId}}"
  ...

...

In this case the AI will auto-detect the value of the parameter value by reading and applying this instruction on the input and setting the result on the value field automatically.

...

Code Block
languageyaml
...
targetCommand: "mail.send"
...
params:
  subject:
    instruction: "Use the subject from initial sender email"
  ...

As you can see in this example, there is no fixed value for parameter subject set. Instead the AI was instructured to extract the value from the given email input.