generateContentFromDescription

generateContentFromDescription

PREMIUM TRIAL / ADVANCED

Generates contents from a description.

Description
public generateContentFromDescription ( $description [, array $options = array()] )

This method generates contents from a description.

Supported AI integrations:

  • GPT OpenAI
Parameters

$description

Description.

options

An array with the available options.

The possible keys and values are:

key Type Description
frequency_penalty float Default as 0.0.
max_tokens int Default as 1000. Each OpenAI model limits max tokens.
model string Default as 'text-davinci-003'.
presence_penalty float Default as 0.0.
prompt string Default as 'Write a text about:'.
returnFullResponse bool If true returns the whole GPT response. Default as false.
temperature float Default as 0.7.
top_p float Default as 1.0.
url string Default as 'https://api.openai.com/v1/completions'.
Return values

string or array

Exceptions

Error connecting to GPT.

GPT error.

Code samples

Example #1

The resulting output looks like:

Release notes
  • phpdocx 14.0:
    • new method.