Skip to main content

OpenAI::Completions - OpenAI Completions scraper

img

Overview of the parser

Parser overview: configuration

OpenAI Completions parser. A parser for the OpenAI Completions method. Built based on the official API and uses an API key. Similar to the OpenAI::ChatGPTOpenAI::ChatGPT parser, the main difference being the absence of the System prompt content option and different model types for generation.

A-Parser functionality allows you to save parsing settings for this parser for future use (presets), set parsing schedules, and much more. You can use automatic query multiplication, substitution of subqueries from files, brute-forcing of alphanumeric combinations and lists to obtain the maximum possible number of results.

Saving results is possible in the form and structure you need, thanks to the built-in powerful template engine Template Toolkit which allows you to apply additional logic to the results and output data in various formats, including JSON, SQL, and CSV.

Collected data

  • Response from OpenAI
  • Number of tokens used

Capabilities

  • Parse response from OpenAI

Use cases

  • Generating responses from OpenAI to any questions

Queries

Queries must be specified as a single line of text, for example:

What are 5 key points I should know when studying Ancient Rome?

Query substitutions

You can use built-in macros for query multiplication.

In the query format, we will specify a character range from a to zzzz; this method allows for maximum rotation of search results and obtaining many new unique results:

$query {az:a:zzzz}

This macro will create 475254 additional queries for each initial search query, which in total will give 4 x 475254 = 1901016 search queries; the figure is impressive, but it is not a problem at all for A-Parser. At a speed of 2000 queries per minute, such a task will be processed in just 16 hours.

Output results examples

A-Parser supports flexible result formatting thanks to the built-in template engine Template Toolkit, which allows it to output results in arbitrary form, as well as in structured formats like CSV or JSON

Default output

Result format:

Used tokens: $total_tokens, Answer:\n$answer\n

Example result:

Used tokens: 290, Answer:
1. Founding and Early History: Ancient Rome was founded in 753 BCE by twin brothers Romulus and Remus. The city grew to become one of the most powerful and influential empires in world history.
2. Roman Republic: The Roman Republic was established in 509 BCE and lasted until 27 BCE. During this time, Rome developed a complex system of government, with two consuls elected annually, a senate, and assemblies of citizens.
3. Roman Empire: The Roman Empire began in 27 BCE when Augustus became the first Roman emperor. The empire grew to include much of Europe, the Middle East, and North Africa and lasted until the fall of the Western Roman Empire in 476 CE.
4. Achievements and Contributions: Ancient Rome made significant contributions to architecture, engineering, law, philosophy, art, literature, and language. Roman innovations include the arch, concrete, aqueducts, roads, and the Latin alphabet.
5. Decline and Fall: The Roman Empire faced numerous challenges, including economic instability, political corruption, military defeats, and invasions by barbarian tribes. The Western Roman Empire fell in 476 CE, while the Eastern Roman Empire (Byzantine Empire) survived until 1453 CE.

Possible settings

ParameterDefault valueDescription
API domainapi.openai.comAbility to change the domain for API requests
API keyAPI key. You can specify several (one per line); for each attempt, a key will be randomly selected from those available and not used within the current request.
Model nametext-davinci-003Model type (gpt-3.5-turbo-instruct / babbage-002 / davinci-002 / text-davinci-003)
Temperature0.7Temperature
Top P1Top P
Maximum length256Maximum number of tokens used
Presence penalty0Presence penalty
Frequency penalty0Frequency penalty