Versions Compared

Key

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

...

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

Send a prompt to the AI

One of the simple use cases is to send a prompt (= a request) 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
languageyaml
pipeline:
  - ai.prompt.send:
      prompt: |
        Return the names of the 10 biggest cities in the world as JSON array.

This will result in an entry like this in the body:

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

Adding context data (user data)

You can also apply the prompt on a given context data which is the input data:

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 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:

Code Block
languageyaml
pipeline:
  - ai.prompt.send:
      input: |
        <person>
          <firstName>Max</firstName>
          <lastName>Smith</lastName>
          <age>36</age>
        </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
    }
}

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

Code Block
languageyaml
pipeline:
  - ai.prompt.send:
      input: |
        {
          "person": {
            "firstName": "Max",
            "lastName": "Smith",
            "age": 36
          }
        }
        prompt: |
          Remove all personal data because of privacy and 
          replace by randomized names and add prefix p_

As a result, a changed JSON comes back:

Code Block
languagejson
{
    "person": {
        "firstName": "p_Alex",
        "lastName": "p_Johnson",
        "age": 48
    }
}

Text-to-Command

This powerful feature of the AI Studio 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.

...