GPT Complete (Value Extractor): Difference between revisions

From Grooper Wiki
No edit summary
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{Migrated}}
__NOINDEX__
{{2023:{{PAGENAME}}}}
{|class="important-box"
|
'''!!'''
|
'''LEGACY TECHNOLOGY DETECTED!!'''
 
'''''GPT Complete''''' is now obsolete. Please use [[Ask AI]] instead. It is an improved version of GPT Complete.
 
'''''GPT Complete will be removed from Grooper in version 2025.'''''
|}
 
<blockquote>{{#lst:Glossary|GPT Complete}}</blockquote>
 
{|class="download-box"
|
[[File:Asset 22@4x.png]]
|
You may download the ZIP(s) below and upload it into your own Grooper environment (version 2023). The first contains one or more '''Batches''' of sample documents.  The second contains one or more '''Projects''' with resources used in examples throughout this article.
* [[Media:2023_Wiki_GPT-Integration_Batch.zip]]
* [[Media:2023_Wiki_GPT-Integration_Project.zip]]
|}
 
== About ==
''GPT Complete'' is a '''''Value Extractor''''' that was added to Grooper 2023. It is the setting you choose to leverage GPT integration on an extractor. Below are some examples of configuration and use. You should be able to follow along using the '''GPT Integration''' zip files ('''Batch''' and '''Project''' are included) that are included in this article. Begin by following along with the instructions. The details of the properties will be explained after.
 
It is also worth noting that the examples given below ARE NOT a comprehensive list. Provided are only a few examples of prompts used in extraction to get you thinking about what can be done. It is ''highly'' recommended that you not only reference the materials linked above, but also spend time experimenting and testing. Good luck!
 
=== Extractor Properties ===
Before moving on to seeing how the GPT model is used for classification in '''Grooper''' let's take a look at the properties used in the ''GPT Complete'' extractor.
 
[[image:2023_GPT-Complete-(Extractor-Type)_01_01.png]]
 
==== API Key ====
You must fill this property with a valid API key from OpenAI in order to leverage GPT integration with Grooper. See the '''[[GPT Integration (Concept)#Obtain an API Key|Obtain an API Key]]''' section of the [[GPT Integration (Concept)|GPT Integration]] article for instruction on how to get a key.
 
==== Model ====
The API Key you use will determine which GPT models are available to you.  The different GPT models can affect the text generated based on their size, training data, capabilities, prompt engineering, and fine-tuning potential. GPT-3's larger size and training data, in particular, can potentially result in more sophisticated, diverse, and contextually appropriate text compared to GPT-2. However, the actual performance and quality of the generated text also depend on various other factors, such as prompt engineering, input provided, and specific use case requirements. GPT-4 is the latest version, as of this writing, and takes the GPT model even further.
 
==== Parameters ====
Please see the [[Parameters (Property)|Parameters]] article for more information.
 
==== Timeout ====
The amount of time, in seconds, to wait for a response from the web service before raising a timeout error.
 
==== Instructions ====
The instructions or question to include in the prompt. The prompt sent to OpenAI consists of text content from the document, which provides context, plus the text entered here. This property should ask a question about the content or provide instructions for generating output. For example, "what is the effective date?", "summarize this document", or "Your task is to generate a comma-separated list of assignors".
 
==== Preprocessing ====
Please visit the [[Text Preprocessor]]''''' article for more information.
 
==== Overflow Disposition ====
Specifies the behavior when the document content is longer than the context length of the selected model.
 
May be one of the following:
* ''Truncate'' - The content will be truncated to fit the model's context length.
* ''Split'' - The content will be split into chunks which fit the model's context length. One result will be returned for each chunk.
 
==== Context Extractor ====
An optional extractor which filters the document content included in the prompt. All '''''Value Extractor''''' types are available.
 
==== Max Response Length ====
The maximum length of the output, in tokens. 1 token is equivalent to approximately 4 characters for English text. Increasing this value decreases the maximum size of the context.
 
==== Maximum Content Length ====
The maximum amount of content from the document to be included, in tokens.
 
== How To ==
# After importing the '''Grooper''' ZIP files provided with this course, expand the Node Tree out and select the '''Data Field''' named "Lessor".
# Click the drop-down menu for the '''''Value Extractor''''' property.
# Select the ''GPT Complete'' option from the menu.
 
[[Image:GPT Integration 004.png]]
 
 
# <li value=4> With the '''''Value Extractor''''' property set, click the ellipsis button to open its configuration window (if you prefer, you can instead click the drop-down arrow to the left of the property to edit its properties without a pop-up window).
 
[[Image:GPT Integration 005.png]]
 
 
# <li value=5> Start by entering your API key into the '''''API Key''''' property.
# Click the "Browse Batches" button.
# Select "GPT Complete Examples" '''Batch''' in the "GPT Integration - Batches" folder from the menu.
 
[[Image:GPT Integration 006.png]]
 
 
# <li value=8> Select "Lease (1)" from the '''Batch Viewer'''.
# Click the ellipsis button for the '''''Instructions''''' property to open its configuration window (if you prefer, you can instead simply type into the entry field of the property.)
 
[[Image:GPT Integration 007.png]]
 
 
# <li value=10> Type the string value <code>Who is the lessor?</code> into the editor.
# Click the "OK" button to accept and close this window.
 
[[Image:GPT Integration 008.png]]
 
 
# <li value=12> When the previous window closes the extractor will immediately fire (assuming you have automatic testing enabled), and you will see a result returned in the "Results" list view.
 
From a "prompt engineering" perspective the input we gave it is as basic as you can get. A result is returned, which is great, but it may not be the exact result that is desired. The value supplied is very conversational, which isn't necessarily a bad thing and is typical of an AI that's trained to emulate language, but considering how data is typically constructed in '''Grooper''', it's not quite right. If you break it down, the result given is really four values: the lessor's name, their marital status, their gender, and their location.  In this case the name of the lessor only will suffice.
 
The next thing to tackle will be using some prompt engineering to get a more specific result.
 
[[Image:GPT Integration 009.png]]
 
==== Getting a More Specific Result with Prompt Engineering ====
# Working with the same material as before, select the '''Data Field''' named "Lessee".
# Click the drop-down menu for the '''''Value Extractor''''' property.
# Select ''GPT Complete'' from the drop-down menu.
 
[[Image:GPT Integration 010.png]]
 
 
# <li value=4> With the '''''Value Extractor''''' set, click the ellipsis button to open its configuration window (if you prefer, you can instead click the drop-down arrow to the left of the property to edit its properties without a pop-up window).
 
[[Image:GPT Integration 011.png]]
 
 
# <li value=5> Start by entering your API key into the '''''API Key''''' property.
# Make sure "Lease (1)" is still selected in the '''Batch Viewer'''.
# Click the ellipsis button for the '''''Instructions''''' property to open its configuration window (if you prefer, you can instead simply type into the entry field of the property.)
 
[[Image:GPT Integration 012.png]]
 
 
# <li value=8> Type the string value <code>Who is the lessee?</code> into the editor.
# Click the "OK" button to accept and close this window.
 
[[Image:GPT Integration 013.png]]
 
 
# <li value=10> When the previous window closes the extractor will immediately fire (assuming you have automatic testing enabled), and you will see a result returned in the "Results" list view.
#* This is clearly a different result form the "Lessor", which is good, but let's address the issue mentioned previously. Let's use some simple "prompt engineer" to get the specific result desired.
# Click the ellipsis button for the '''''Instructions''''' property to open its configuration window (if you prefer, you can instead simply type into the entry field of the property.)
 
[[Image:GPT Integration 014.png]]
 
 
# <li value=12> Add to the string value <code>Respond only with the lessee's name.</code>
# Click the "OK" button to accept and close this window.
 
[[Image:GPT Integration 015.png]]
 
 
# <li value=14> This is a much better result than before. However, the period at the end is unnecessary and can be removed, again, by prompting the AI appropriately.
# Click the ellipsis button for the '''''Instructions''''' property to open its configuration window (if you prefer, you can instead simply type into the entry field of the property.)
 
[[Image:GPT Integration 016.png]]
 
 
# <li value=16> Add to the string value <code>Don't include control characters.</code>
# Click the "OK" button to accept and close this window.
 
[[Image:GPT Integration 017.png]]
 
 
# <li value=18> Perfect! This is the exact value needed.
 
This is by no means anything but a simple prompt, but notice how giving context and being more specific alters the result. As a user learning this new technology, it's now time to start experimenting with your prompts and getting creative to get the results you're looking for.
 
[[Image:GPT Integration 018.png]]
 
==== Example: Full and Brief Document Summary ====
# Working with the same material as before, select the '''Data Field''' named "Full Summary".
# Click the drop-down menu for the '''''Value Extractor''''' property.
# Select ''GPT Complete'' from the drop-down menu.
 
[[Image:GPT Integration 019.png]]
 
 
# <li value=4> With the '''''Value Extractor''''' set, click the ellipsis button to open its configuration window (if you prefer, you can instead click the drop-down arrow to the left of the property to edit its properties without a pop-up window).
 
[[Image:GPT Integration 020.png]]
 
 
# <li value=5> Start by entering your API key into the '''''API Key''''' property.
# Type <code>tldr</code> into the '''''Instructions''''' property.
# Assuming you have automatic testing enabled, you will see a result returned in the "Results" list view. Click this result.
# Click the "Inspect" button.
 
[[Image:GPT Integration 021.png]]
 
 
# <li value=9> In the "Data Inspector" you will see the number of characters in the result.
# You will also see the full text of the summary.
# Right-click in a blank space to get a list of commands.
# Make sure "Text Wrap" is enabled so that the text will wrap like it is in the screenshot.
 
[[Image:GPT Integration 022.png]]
 
 
# <li value=13> After confirming the previous settings and closing windows, right-click the "Full Summary" '''Data Field''' to get a list of commands.
# Select the "Clone..." command.
 
[[Image:GPT Integration 023.png]]
 
 
# <li value=15> Name the clone "Brief Summary".
# Confirm the clone by clicking the "Execute" button.
 
[[Image:GPT Integration 024.png]]
 
 
# <li value=17> With the clone made, click the ellipsis button of the '''''Value Extractor''''' property to open its configuration window (if you prefer, you can instead click the drop-down arrow to the left of the property to edit its properties without a pop-up window).
 
[[Image:GPT Integration 025.png]]
 
 
# <li value=18> Add <code> in 100 words or less</code> to the '''''Instructions''''' property.
# A result will be returned in the "Results" list view. Select this result.
#  Click the "Inspect" button.
 
[[Image:GPT Integration 026.png]]
 
 
# <li value=21> In the "Data Inspector" you will now notice this result's length is much shorter.
# The summary given is much shorter than the previous due to the additional instruction given in the prompt.
 
[[Image:GPT Integration 027.png]]
 
==== Example: Sentiment Analysis ====
# Working with the same material as before, select the '''Data Field''' named "Sentiment Analysis".
# Click the drop-down menu for the '''''Value Extractor''''' property.
# Select ''GPT Complete'' from the drop-down menu.
 
[[Image:GPT Integration 028.png]]
 
 
# <li value=4> With the '''''Value Extractor''''' set, click the ellipsis button to open its configuration window (if you prefer, you can instead click the drop-down arrow to the left of the property to edit its properties without a pop-up window).
 
[[Image:GPT Integration 029.png]]
 
 
# <li value=5> Start by entering your API key into the '''''API Key''''' property.
# Click the ellipsis button for the '''''Instructions''''' property to open its configuration window (if you prefer, you can instead simply type into the entry field of the property.)
 
[[Image:GPT Integration 030.png]]
 
 
# <li value=7> Type the string <code>Is this document's sentiment positive, negative, or neutral? Respond with only the sentiment and no control characters.</code> into the editor.
# Click the "OK" button to accept and close this window.
 
[[Image:GPT Integration 031.png]]
 
 
# <li value=9> When the previous window closes, click on "Document (4)" in the '''Batch Viewer'''.
# Assuming you have automatic testing enabled, you will see a result ("negative") returned in the "Results" list view.
 
[[Image:GPT Integration 032.png]]
 
 
# <li value=11> Click on "Document (5)" in the '''Batch Viewer'''.
# Assuming you have automatic testing enabled, you will see a result ("positive") returned in the "Results" list view.
 
[[Image:GPT Integration 033.png]]

Latest revision as of 16:42, 27 August 2025

!!

LEGACY TECHNOLOGY DETECTED!!

GPT Complete is now obsolete. Please use Ask AI instead. It is an improved version of GPT Complete.

GPT Complete will be removed from Grooper in version 2025.

GPT Complete is a Value Extractor that leverages Open AI's GPT models to generate chat completions for inputs, returning one hit for each result choice provided by the model's response.

PLEASE NOTE: GPT Complete is a deprecated Value Extractor. It uses an outdated method to call the OpenAI API. Please use the Ask AI extractor going forward.

You may download the ZIP(s) below and upload it into your own Grooper environment (version 2023). The first contains one or more Batches of sample documents. The second contains one or more Projects with resources used in examples throughout this article.

About

GPT Complete is a Value Extractor that was added to Grooper 2023. It is the setting you choose to leverage GPT integration on an extractor. Below are some examples of configuration and use. You should be able to follow along using the GPT Integration zip files (Batch and Project are included) that are included in this article. Begin by following along with the instructions. The details of the properties will be explained after.

It is also worth noting that the examples given below ARE NOT a comprehensive list. Provided are only a few examples of prompts used in extraction to get you thinking about what can be done. It is highly recommended that you not only reference the materials linked above, but also spend time experimenting and testing. Good luck!

Extractor Properties

Before moving on to seeing how the GPT model is used for classification in Grooper let's take a look at the properties used in the GPT Complete extractor.

API Key

You must fill this property with a valid API key from OpenAI in order to leverage GPT integration with Grooper. See the Obtain an API Key section of the GPT Integration article for instruction on how to get a key.

Model

The API Key you use will determine which GPT models are available to you. The different GPT models can affect the text generated based on their size, training data, capabilities, prompt engineering, and fine-tuning potential. GPT-3's larger size and training data, in particular, can potentially result in more sophisticated, diverse, and contextually appropriate text compared to GPT-2. However, the actual performance and quality of the generated text also depend on various other factors, such as prompt engineering, input provided, and specific use case requirements. GPT-4 is the latest version, as of this writing, and takes the GPT model even further.

Parameters

Please see the Parameters article for more information.

Timeout

The amount of time, in seconds, to wait for a response from the web service before raising a timeout error.

Instructions

The instructions or question to include in the prompt. The prompt sent to OpenAI consists of text content from the document, which provides context, plus the text entered here. This property should ask a question about the content or provide instructions for generating output. For example, "what is the effective date?", "summarize this document", or "Your task is to generate a comma-separated list of assignors".

Preprocessing

Please visit the Text Preprocessor article for more information.

Overflow Disposition

Specifies the behavior when the document content is longer than the context length of the selected model.

May be one of the following:

  • Truncate - The content will be truncated to fit the model's context length.
  • Split - The content will be split into chunks which fit the model's context length. One result will be returned for each chunk.

Context Extractor

An optional extractor which filters the document content included in the prompt. All Value Extractor types are available.

Max Response Length

The maximum length of the output, in tokens. 1 token is equivalent to approximately 4 characters for English text. Increasing this value decreases the maximum size of the context.

Maximum Content Length

The maximum amount of content from the document to be included, in tokens.

How To

  1. After importing the Grooper ZIP files provided with this course, expand the Node Tree out and select the Data Field named "Lessor".
  2. Click the drop-down menu for the Value Extractor property.
  3. Select the GPT Complete option from the menu.


  1. With the Value Extractor property set, click the ellipsis button to open its configuration window (if you prefer, you can instead click the drop-down arrow to the left of the property to edit its properties without a pop-up window).


  1. Start by entering your API key into the API Key property.
  2. Click the "Browse Batches" button.
  3. Select "GPT Complete Examples" Batch in the "GPT Integration - Batches" folder from the menu.


  1. Select "Lease (1)" from the Batch Viewer.
  2. Click the ellipsis button for the Instructions property to open its configuration window (if you prefer, you can instead simply type into the entry field of the property.)


  1. Type the string value Who is the lessor? into the editor.
  2. Click the "OK" button to accept and close this window.


  1. When the previous window closes the extractor will immediately fire (assuming you have automatic testing enabled), and you will see a result returned in the "Results" list view.

From a "prompt engineering" perspective the input we gave it is as basic as you can get. A result is returned, which is great, but it may not be the exact result that is desired. The value supplied is very conversational, which isn't necessarily a bad thing and is typical of an AI that's trained to emulate language, but considering how data is typically constructed in Grooper, it's not quite right. If you break it down, the result given is really four values: the lessor's name, their marital status, their gender, and their location. In this case the name of the lessor only will suffice.

The next thing to tackle will be using some prompt engineering to get a more specific result.

Getting a More Specific Result with Prompt Engineering

  1. Working with the same material as before, select the Data Field named "Lessee".
  2. Click the drop-down menu for the Value Extractor property.
  3. Select GPT Complete from the drop-down menu.


  1. With the Value Extractor set, click the ellipsis button to open its configuration window (if you prefer, you can instead click the drop-down arrow to the left of the property to edit its properties without a pop-up window).


  1. Start by entering your API key into the API Key property.
  2. Make sure "Lease (1)" is still selected in the Batch Viewer.
  3. Click the ellipsis button for the Instructions property to open its configuration window (if you prefer, you can instead simply type into the entry field of the property.)


  1. Type the string value Who is the lessee? into the editor.
  2. Click the "OK" button to accept and close this window.


  1. When the previous window closes the extractor will immediately fire (assuming you have automatic testing enabled), and you will see a result returned in the "Results" list view.
    • This is clearly a different result form the "Lessor", which is good, but let's address the issue mentioned previously. Let's use some simple "prompt engineer" to get the specific result desired.
  2. Click the ellipsis button for the Instructions property to open its configuration window (if you prefer, you can instead simply type into the entry field of the property.)


  1. Add to the string value Respond only with the lessee's name.
  2. Click the "OK" button to accept and close this window.


  1. This is a much better result than before. However, the period at the end is unnecessary and can be removed, again, by prompting the AI appropriately.
  2. Click the ellipsis button for the Instructions property to open its configuration window (if you prefer, you can instead simply type into the entry field of the property.)


  1. Add to the string value Don't include control characters.
  2. Click the "OK" button to accept and close this window.


  1. Perfect! This is the exact value needed.

This is by no means anything but a simple prompt, but notice how giving context and being more specific alters the result. As a user learning this new technology, it's now time to start experimenting with your prompts and getting creative to get the results you're looking for.

Example: Full and Brief Document Summary

  1. Working with the same material as before, select the Data Field named "Full Summary".
  2. Click the drop-down menu for the Value Extractor property.
  3. Select GPT Complete from the drop-down menu.


  1. With the Value Extractor set, click the ellipsis button to open its configuration window (if you prefer, you can instead click the drop-down arrow to the left of the property to edit its properties without a pop-up window).


  1. Start by entering your API key into the API Key property.
  2. Type tldr into the Instructions property.
  3. Assuming you have automatic testing enabled, you will see a result returned in the "Results" list view. Click this result.
  4. Click the "Inspect" button.


  1. In the "Data Inspector" you will see the number of characters in the result.
  2. You will also see the full text of the summary.
  3. Right-click in a blank space to get a list of commands.
  4. Make sure "Text Wrap" is enabled so that the text will wrap like it is in the screenshot.


  1. After confirming the previous settings and closing windows, right-click the "Full Summary" Data Field to get a list of commands.
  2. Select the "Clone..." command.


  1. Name the clone "Brief Summary".
  2. Confirm the clone by clicking the "Execute" button.


  1. With the clone made, click the ellipsis button of the Value Extractor property to open its configuration window (if you prefer, you can instead click the drop-down arrow to the left of the property to edit its properties without a pop-up window).


  1. Add in 100 words or less to the Instructions property.
  2. A result will be returned in the "Results" list view. Select this result.
  3. Click the "Inspect" button.


  1. In the "Data Inspector" you will now notice this result's length is much shorter.
  2. The summary given is much shorter than the previous due to the additional instruction given in the prompt.

Example: Sentiment Analysis

  1. Working with the same material as before, select the Data Field named "Sentiment Analysis".
  2. Click the drop-down menu for the Value Extractor property.
  3. Select GPT Complete from the drop-down menu.


  1. With the Value Extractor set, click the ellipsis button to open its configuration window (if you prefer, you can instead click the drop-down arrow to the left of the property to edit its properties without a pop-up window).


  1. Start by entering your API key into the API Key property.
  2. Click the ellipsis button for the Instructions property to open its configuration window (if you prefer, you can instead simply type into the entry field of the property.)


  1. Type the string Is this document's sentiment positive, negative, or neutral? Respond with only the sentiment and no control characters. into the editor.
  2. Click the "OK" button to accept and close this window.


  1. When the previous window closes, click on "Document (4)" in the Batch Viewer.
  2. Assuming you have automatic testing enabled, you will see a result ("negative") returned in the "Results" list view.


  1. Click on "Document (5)" in the Batch Viewer.
  2. Assuming you have automatic testing enabled, you will see a result ("positive") returned in the "Results" list view.