OpenAI Operations

Learn how to carry out operations with OpenAI models in Kognitos.

Overview

The OpenAI operations in Kognitos allow you to interact with OpenAI models through structured queries. You can send messages, questions, or tasks to models like GPT-4. Additionally, you have the flexibility to utilize your own OpenAI API key for enhanced functionality.

Operations

1. Ask Koncierge

Users can leverage ask koncierge to interact with OpenAI models. This feature simplifies tasks such as answering questions, summarizing content, and extracting information from documents. It also provides control over the response style, creativity level, output format, and selection of the OpenAI model (e.g., GPT-4 or GPT-3.5-turbo).

Syntax

To use ask koncierge, use the following syntax:

ask koncierge
    the message is "{message}" | the task is "{task}" | the question is "{question}"
    the creativity is {creativity}
    the openai model is "{model}"
    the system command is "{command}"
    the response format is "{format}"
    the visual reference is {visual reference}

Inputs

Required: (one of the following)

  1. message: The message you want to send.
  2. task: The specific task to be performed.
  3. question: The question you would like answered.

πŸ”” Note: If neither a message, task, nor question is specified, a question will be raised.

Optional

  1. creativity
    • A number that controls the creativity of the response. Higher values produce more creative responses.
    • Default: 0.0
    • Range: 0.0-2.0.
  2. model
    • The OpenAI model to use to generate the response.
    • Default: gpt-4-turbo-2024-04-09
  3. command
    • A system-level command or instruction that can influence the response.
    • Example: password reset instructions
  4. format
    • The desired format of the response.
    • Default: string
    • Allowed Values:
      • string
      • text
      • date
      • table
      • list of texts
      • list of numbers
      • list of dates
      • list of records
      • structured data
      • json
  5. visual reference:
    • A variable to represent a document or image that serves as a visual reference, helping GPT enhance its accuracy. This refers to a fact defined earlier in the automation.
    • Examples: the file, the document, the text

Example 1

πŸ’¬ Prompt

ask koncierge
  the message is "Recommend a movie for a family night"
  the creativity is 0.5

πŸ“– Results

For a family movie night, I recommend "Paddington 2" (2017). This charming and heartwarming sequel follows Paddington Bear as he embarks on a series of adventures in an attempt to buy the perfect present for his Aunt Lucy's 100th birthday, only for the gift to be stolen. The film is known for its humor, whimsical storytelling, and strong messages about kindness and family. It's highly enjoyable for both children and adults, making it a great choice for a family gathering


Example 2

πŸ’¬ Prompt

ask koncierge
  the task is "create an upper body workout routine"
  the creativity is 0.8
  the openai model is "gpt-4"

πŸ“– Results

Workout 1: Chest and Triceps

  1. Warm-up: 5-10 minutes of light cardio
  2. Flat Barbell Bench Press: 3 sets of 8-12 reps
  3. Incline Dumbbell Bench Press: 3 sets of 8-12 reps
  4. Cable Crossover: 3 sets of 12-15 reps
  5. Skull Crushers: 3 sets of 8-12 reps
  6. Tricep Dips: 3 sets of 8-12 reps
  7. Tricep Pushdown: 3 sets of 12-15 reps
  8. Cool-down: Stretching exercises

Workout 2: Back and Biceps

  1. Warm-up: 5-10 minutes of light cardio
  2. Deadlift: 3 sets of 8-12 reps
  3. Bent-over Barbell Rows: 3 sets of 8-12 reps
  4. Wide-grip Pull-up: 3 sets of 8-12 reps
  5. Seated Cable Rows: 3 sets of 12-15 reps
  6. Barbell Curl: 3 sets of 8-12 reps
  7. Hammer Curl: 3 sets of 8-12 reps
  8. Cable Curl: 3 sets of 12-15 reps
  9. Cool-down: Stretching exercises

Workout 3: Shoulders and Abs

  1. Warm-up: 5-10 minutes of light cardio
  2. Overhead Press: 3 sets of 8-12 reps
  3. Dumbbell Lateral Raise: 3 sets of 8-12 reps
  4. Face Pull: 3 sets of 12-15 reps
  5. Plank: 3 sets of 30-60 seconds
  6. Bicycle Crunches: 3 sets of 15-20 reps
  7. Russian Twists: 3 sets of 15-20 reps
  8. Cool-down: Stretching exercises

Note: Rest for 60-90 seconds between sets. Adjust the weights to suit your strength levels. Always prioritize form and control over weight. If the weight is too heavy and you can't perform the exercise with proper form, reduce the weight.


Example 3

πŸ’¬ Prompt

ask koncierge
  the question is "How do I reset my password?"
  the system command is "short password reset instructions"

πŸ“– Results

To reset your password, follow these steps:

  1. Go to the login page of the website or app.
  2. Click on the "Forgot Password?" or "Reset Password" link.
  3. Enter your email address or username and submit the form.
  4. Check your email for a password reset link from the service.
  5. Click on the link and follow the instructions to set a new password.
  6. Choose a strong, new password and confirm it.
  7. Log in with your new password to ensure it works.

If you don't receive an email, check your spam folder or contact support for further assistance


Example 4

πŸ’¬ Prompt

ask koncierge
  the question is "What significant events happened on 14/07/1789?"
  the system command is "provide historical events"
  the openai model is "gpt-4-turbo-preview"
  the response format is "text"

πŸ“– Results

On July 14, 1789, one of the most significant events in French history occurred: the Storming of the Bastille. This event is widely regarded as a turning point in the French Revolution. The Bastille was a medieval fortress, armory, and political prison in Paris that represented royal authority in the center of the city. Its storming was driven by the revolutionaries' demand for gunpowder and arms, but more symbolically, it represented a blow against the tyranny of the Bourbon monarchy at the time.
The fall of the Bastille was celebrated in France as a national holiday, known as Bastille Day or La FΓͺte Nationale, which commemorates the beginning of the French Revolution and the eventual establishment of a republican form of government. The day is marked by festivities, parades, and fireworks, symbolizing the unity and freedom of the French people


2. Ask Koncierge To Extract Information From A Document

Use ask koncierge for to extract information from a document.

Syntax

ask koncierge for {information} where
    the document
    the creativity is {creativity}
    the openai model is "{model}"
    the system command is "{command}"
    the response format is "{format}"
    the message is "{message}"
    the task is "{task}"
    the question is "{question}"
    the rules are "{rules}"
    the visual reference is {visual reference}

Inputs

Required

  1. information
    • The specific piece of information or value you are requesting from the system.
    • Examples: the invoice date,the total amount, the delivery status

Optional

  1. the document
    • The document from which information needs to be extracted. This will raise a question asking you to Please Provide File.
  2. creativity
    • A number that controls the creativity of the response. Higher values produce more creative responses.
    • Default: 0.0
    • Range: 0.0-2.0.
  3. model
    • The OpenAI model to use to generate the response.
    • Default: gpt-4-turbo-2024-04-09
  4. command
    • A system-level command or instruction that can influence the response.
    • Example: password reset instructions
  5. format
    • The desired format of the response.
    • Default: string
    • Allowed Values:
      • string
      • text
      • date
      • table
      • list of texts
      • list of numbers
      • list of dates
      • list of records
      • structured data
      • json
  6. message
    • The message you want to send.
  7. task
    • The specific task to be performed.
  8. question
    • The question you would like answered.
  9. rules
    • The user rules to be followed for the task.
  10. visual reference
    • A variable to represent a document or image that serves as a visual reference, helping GPT enhance its accuracy. This refers to a fact defined earlier in the automation.
    • Examples: the file, the document, the text

Example 1

ask koncierge for the invoice date where
  the document
  the task is "extract the invoice date"
  the response format is "date"

Example 2

ask koncierge for the total amount where
  the document
  the system command is "you are an expert invoice processor\ndo not calculate the total amount manually"
  the task is "Extract the total amount"
  the response format is "number"

3. Identifying Elements in a String

This section describes how to find specific elements within a given string. This operation supports singular and plural forms and can process associated questions or options.

Syntax

find the {items} in "{the text}" where
  the options are "{options}"
  the question is "{question}"
  the response format is "{format}"

Inputs

Required

  1. items
    • The item(s) to locate within the text, which can be singular or plural.
    • This can be a noun or a noun with adjectives (ex: animal, cute animals).
  2. the text
    • The target string in which the item(s) are to be found.

Optional

  1. options
    • A list of options from which the thing is to be identified.
  2. question
    • A question related to the item that the function will attempt to answer based on the content of the string.
  3. format
    • The desired format of the response.
    • Default: string
    • Allowed Values:
      • string
      • text
      • date
      • table
      • list of texts
      • list of numbers
      • list of dates
      • list of records
      • structured data
      • json

Example 1

πŸ’¬ Prompt

find the people in "The project was completed by John, Sarah, and Tim."

πŸ“ Breakdown

Text: The project was completed by John, Sarah, and Tim.
Items: people
Results: John, Sarah, Tim


Example 2

πŸ’¬ Prompt

find the very cute animals in "Today we saw a puppy and three kittens at the pet shop."

πŸ“ Breakdown

Text: Today we saw a puppy and three kittens at the pet shop.
Items: very cute animals
Results: puppy, kittens


Example 3

πŸ’¬ Prompt

The email is "Hey Emily, I just wanted to tell you about some awesome places I visited during my vacation: Bali, Paris, and Tokyo. Can't wait to share my photos!"
find the places in the email

πŸ“ Breakdown

Text: Hey Emily, I just wanted to tell you about some awesome places I visited during my vacation: Bali, Paris, and Tokyo. Can't wait to share my photos!
Items: places
Results: Bali, Paris, Tokyo


Example 4

πŸ’¬ Prompt

the memo is "Reminder: Don't forget to check out the new cafΓ©s I visited this weekend: Java House and CafΓ© Mocha."
find the sweet spots in the memo

πŸ“ Breakdown

Text: Reminder: Don't forget to check out the new cafΓ©s I visited this weekend: Java House and CafΓ© Mocha.
Items: sweet spots
Results: Java House, CafΓ© Mocha


Example 5: Using Additional Options

πŸ’¬ Prompt

find the movies in "Recently watched films: 'Inception', 'The Matrix', and 'The Godfather'" where
  the question is "Which movies are sci-fi?"
  the options are "sci-fi, drama"

πŸ“ Breakdown

Text: Recently watched films: 'Inception', 'The Matrix', and 'The Godfather'
Items: movies
Results: 'Inception' and 'The Matrix'


4. Extracting Data

This operation extracts data from sources like texts, documents, or files.

Syntax

extract data from the {source}
  the creativity is {creativity}
  the openai model is "{model}"
  the output format is "{output format}"
  the visual reference is {visual reference}

  the first field is "{field}"
  the first field's rule is "{field rule}"
  the first field's default value is "{field default}"
  the first field's format is "{field format}"

Inputs

Required

  1. source
    • A variable to represent the information source to extract data from
    • Examples: document, file, text.
  2. field
    • A field to be extracted from the text or file.
    • You can add any number of fields, but at least 1 is required.
    • Examples: invoice number, date.

Optional

  1. creativity
    • A number that controls the creativity of the response. Higher values produce more creative responses.
    • Default: 0.0
    • Range: 0.0-2.0.
  2. model
    • The OpenAI model to use to generate the response.
    • Default: gpt-4o-latest
  3. output format
    • The desired format of the response.
    • Default: string
    • Allowed Values:
      • string
      • text
      • date
      • table
      • list of texts
      • list of numbers
      • list of dates
      • list of records
      • structured data
      • json
  4. visual reference
    • A variable to represent a document or image that serves as a visual reference, helping GPT enhance its accuracy. This refers to a fact defined earlier in the automation.
    • Examples the file, the document, the text
  5. field rule
    • The rule to be followed for the field extraction.
  6. field default
    • The field's default value.
  7. field format
    • The format of the fields that need to be extracted from the text.
    • Possible values: number, string, date.

Example

extract data from the file
  the openai model is "gpt-4o-latest"
  the visual reference is the file

  the first field is "invoice number"
  the first field's format is "number"
  the first field's rule is "keep just the first four digits"

  the second field is "invoice amounts"
  the second field's format is "string"
  the second field's rule is "keep just the amount without the currency"

  the third field is "invoice date"
  the third field's format is "date"

the data's invoice amounts
get the invoice number from the data

5. Extracting Tables

This operation extracts a table from a source, such as a document or file.

Syntax

extract a table from {source}
  the description is "{description}"
  the creativity is {creativity}
  the openai model is "{model}"
  the visual reference is {visual reference}
  the extraction mode is "{extraction mode}"

Inputs

Required

  1. source
    • A variable to represent the information source to extract a table from.
    • Examples: document, file, text
  2. description
    • A description of the table to be extracted.

Optional

  1. creativity
    • A number that controls the creativity of the response. Higher values produce more creative responses.
    • Default: 0.0
    • Range: 0.0-2.0.
  2. model
    • The OpenAI model to use to generate the response.
    • Default: gpt-4o-latest
  3. visual reference
    • A variable to represent a document or image that serves as a visual reference, helping GPT enhance its accuracy. This refers to a fact defined earlier in the automation.
    • Examples the file, the document, the text
  4. extraction mode
    • A string that represents the accuracy as it sends location data to GPT
    • Allowed Values: precise

Example

extract a table from the document
  the openai model is "gpt-4o"
  the visual reference is the document
  the extraction mode is "precise"
  the description is "The table has invoice number, date and amount. the amount should not have the currency
  in it. Keep only the first 4 digits of the invoice number. It has only one row of data."

the table

Using An OpenAI API Key

These operations enable you to use your own OpenAI API key for enhanced functionality. Adding the following line will prompt the platform to request your key:

the department's openai key

This OpenAI key will be the default for all processes in the department.


OpenAI Models

Here is a list of OpenAI models available for use. These are Azure hosted models.

Models Available in the EU

  • gpt-4
  • gpt-3.5-turbo
  • gpt-4-vision-preview
  • gpt-4-turbo
  • gpt-4o
  • gpt-4o-latest
  • gpt-4o-mini

Models Available in the US

  • gpt-4o-mini
  • gpt-4
  • gpt-4o
  • gpt-4o-latest
  • gpt-4-latest
  • gpt-4-turbo
  • gpt-4-turbo-latest
  • gpt-4-vision-preview
  • gpt-4-vision-preview-latest
  • gpt-3.5-turbo
  • gpt-3.5-turbo-latest