Hi,
I am trying to use GPT4o-mini to complete a response that may have been written by a different model/human. In option 1 (below), the prefix is ignored and the assistant answers the question. In option 2, the response is completed but worried if the model would be robust to this. Are there alternative approaches to doing this?
Thanks!
Option 1:
import openai
import os
message_list = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the capital of France?"},
]
response_so_far = "I am not sure, but"
if response_so_far:
message_list.append({"role": "assistant", "content": response_so_far})
openai_client = openai.OpenAI(
api_key=os.environ.get('OPENAI_API_KEY'),
)
# Pass `message_list` to the model
response_out = openai_client.chat.completions.create(
model="gpt-4",
messages=message_list,
max_tokens=1024, # Adjust as needed
temperature=0.7
)
print(response_out.choices[0].message.content)
Option 2:
import openai
import os
message_list = [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "What is the capital of France?"},
]
response_so_far = "I am not sure, but"
if response_so_far:
message_list.append({"role": "assistant", "content": response_so_far})
message_list.append({"role": "user", "content": "Finish the response above."})
openai_client = openai.OpenAI(
api_key=os.environ.get('OPENAI_API_KEY'),
)
# Pass `message_list` to the model
response_out = openai_client.chat.completions.create(
model="gpt-4",
messages=message_list,
max_tokens=1024, # Adjust as needed
temperature=0.7
)
print(response_out.choices[0].message.content)