Is it possible to do text completion with GPT-4o?

Hello,

I was wondering if it’s possible with the current APIs and models to do chat completion, in the sense that the assistant should complete a partial answer. For example, suppose I have an incomplete answer in a conversation:

messages=[
    {"role": "system", "content": "You are a helpful assistant."},
    ...
    {"role": "user", "content": "Do you think that was a good idea?"},
    {"role": "assistant", "content": "Yes but"}
  ]

Then I want GPT to complete the answer.

Thank you very much in advance for your answer!

You can’t achieve this with chat completion, but you can with the completion endpoint.

As follows:

response = client.completions.create(
  model="gpt-3.5-turbo-instruct",
  prompt="You are a helpful assistant. Do you think that was a good idea? Yes but",
  max_tokens=20,
  temperature=0
)

You can use models like GPT-3.5-instruct for this.
But you can’t use GPT-4 or GPT-4o for completion.

print(response.choices[0].text)

it ultimately depends on the specific situation

https://platform.openai.com/docs/api-reference/completions

1 Like

You can approximate the behavior of completions with chat completions if you instruct the model through the system message to complete the text provided by the user.

I made this custom GPT which does the same and has been working well enough for me for a couple of weeks:

2 Likes