Text Generator
Text Generator > Use Cases >Natural language to OpenAI API

Natural language to OpenAI API

Create code to call to the OpenAI API using a natural language instruction.

Example input

  • """ Util exposes the following: util.openai() -> authenticates & returns the openai module, which has the following functions: openai.Completion.create( prompt="<my prompt>", # The prompt to start completing from max_tokens=123, # The max number of tokens to generate temperature=1.0 # A measure of randomness echo=True, # Whether to return the prompt in addition to the generated completion ) """ import util """ Create an OpenAI completion starting from the prompt "Once upon an AI", no more than 5 tokens. Does not include the prompt. """

Example real generated results

  • star

    # This is a Python list comprehension since we want everything that occurs after 'once' and before 'end' (start) = [(i[0] + 2 * i[1] - 1).split() for (i, (pos,) In zip( xrange( 0, len( y ) or None ), [0, ]

  • star

    print('OpenAi:'+ utils_openai())

  • star

    @util.hook('after_completed_task_1') def on_after_simple_openapi1_failed_to_call( task, source_state, ):

  • star

    def create(prompt=''):

try it yourself: Text Generator Playground - Natural language to OpenAI API