Assistant prompt is ignored when generating completions

I am trying to provide a completion engine with a starting sequence in my prompt, here is the messages structure:

  role: "system",
  content: `You are a software engineer. Given the user input, provide the React app code that solves the task. Example:
export default function App() {
  return (
}, {
  role: "user",
  content: "a simple todo app",
}, {
  role: "assistant",
  content: "<"

But the answer always starts from an empty string, the followed by “<” and then goes the actual code. And no matter what starting sequence I provide it seems to be ignored or included in the answer.
I use streaming and model “gpt-4o”

You cannot provide an assistant message as a prompt, only as past responses as a history.

Chat Completions already adds an unseen assistant prompt, and it does not have a method to continue upon text you provide.

1 Like

Hmm, is there a way to extend the output context?
I was using this approach with Anthropic to extend the output context limit - I would append the previous answer as an “assistant” answer in a chain of calls if the answer was stopped during to context limitation

OpenAI has not offered continuation within an assistant response. Anthropic apparently knows that there are several uses for such a feature and allows further exploration and capabilities.

1 Like