First Read the Excel sheet (you can use a library in Python to read the contents of the Excel sheet into a DataFrame. Assuming you have the sheet data in a variable called df, you can extract the descriptions column using descriptions = df['column_name'], where 'column_name' is the name of the column containing the descriptions.
Convert the descriptions into a format suitable for including in the prompt. You can create a string that concatenates all the descriptions, separating them with appropriate delimiters (e.g., newlines or commas) to distinguish between different descriptions.
descriptions_text = '\n\n'.join(descriptions)
- Construct the prompt
prompt = f"<command here> \n\n{descriptions_text}"
- Pass the prompt to OpenAI API
response = openai.Completion.create(
engine="text-davinci-003",
prompt=prompt,
temperature=0.1
)