...
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 | ||
---|---|---|
| ||
{ "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 the simple 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 | ||
---|---|---|
| ||
[ "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 | ||
---|---|---|
| ||
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 in of this example in the body is then:
Code Block | ||
---|---|---|
| ||
[ "Beijing", "Cairo", "Delhi", "Dhaka", "Mexico City", "Mumbai", "Osaka", "Sao Paulo", "Shanghai", "Tokyo" ] |
See another example which converts a given input:
...
language | yaml |
---|
...
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 | ||
---|---|---|
| ||
pipeline: - ai.prompt.send: input: $uri:drive:invoice-3662.pdf <person> prompt: | <firstName>Max</firstName> Check the invoice to ensure it is correct both <lastName>Smith</lastName>in terms <age>36</age>of content and calculations. If everything is fine, </person>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 | ||
---|---|---|
| ||
{pipeline: "person"- ai.prompt.send: { input: | "firstName": "Max", <person> "lastName": "Smith", <firstName>Max</firstName> "age": 36 } } |
And once more you could apply data privacy filters for example:
Code Block | ||
---|---|---|
| ||
pipeline: - ai.prompt.send: <lastName>Smith</lastName> input: | <age>36</age> { </person> prompt: "Convert to "person": {JSON" |
And the result from the AI in the body will be this:
Code Block | ||
---|---|---|
| ||
{ "person": { "firstName": "Max", "lastName": "Smith", "age": 36 } } |
And one more example: Apply a data privacy filter:
Code Block | ||
---|---|---|
| ||
pipeline: - ai.prompt.send: } input: | } { prompt: | "person": { Remove all personal data because of privacy and "firstName": "Max", replace by randomized names and add prefix p_ |
As a result, a changed JSON comes back:
Code Block | ||
---|---|---|
| ||
{"lastName": "Smith", "personage": { 36 } "firstName": "p_Alex", } "lastName"prompt: "p_Johnson", | "age": 48Remove all personal data because } } |
Text-to-Command
...
of privacy and
replace by randomized names and add prefix p_ |
As a result, a changed JSON comes back:
Code Block | ||
---|---|---|
| ||
{
"person": {
"firstName": "p_Alex",
"lastName": "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 | ||
---|---|---|
| ||
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 requestin order to take action and fulfill the user’s request.
This can be seen as an ultimative tool to bridge between humans and machines since any generated non-structured text in written and spoken form can start nearly any computer task you can imagine.
Drawio | ||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
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 ascustomerId
,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.
Using the command ai.command.detect
In order to integrate Text-to-Command functionality into your automation pipelines, you can use the command ai.command.detect
. It will
...
See this example to construct a message out of advice parameters using a template:
Code Block | ||
---|---|---|
| ||
... 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 | ||
---|---|---|
| ||
...
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.