demidovsky / dreamcore-pub

1 stars 1 forks source link

Description generation #2

Open demidovsky opened 1 year ago

demidovsky commented 1 year ago

Feature request

We need to create a microservice that accepts a text string describing the desired achievement, and generates a step-by-step plan how to achieve it.

POST /create

Request:

Content-Type: application/json
{ text: " ... " }

Response:

Content-Type: application/json
{ description: "..." }

Possible challenges and improvements:

1. Separate steps It may be nice to split the bullet-points into array, e.g. { description: ['...', '...', ...] }

2. Length It may be useful to specify the maximum length (_maxtokens) as a request parameter e.g. { text: '...', max_length: 500 }

3. Regenerate or not? It's an open question: should we cache the result, and make responses pure (I mean, when same input gives same output), or allow rephrasing of the output.

4. Prompt A basic prompt is simply prepending "How to " to the name of achievement. Maybe we can use m.ore general or flexible sentence

5. Language We can limit to only EN for now.

demidovsky commented 1 year ago

API call example:

import os
import openai

openai.api_key = os.getenv("OPENAI_API_KEY")

start_sequence = "\nA:"
restart_sequence = "\n\nQ: "

response = openai.Completion.create(
  model="text-davinci-003",
  prompt="How to give a rock concert?,
  temperature=0,
  max_tokens=500,
  top_p=1,
  frequency_penalty=0,
  presence_penalty=0
)