Allow type override in Responses.TextContext to allow creation of assistant messages. #421
-
|
Related to PR #420 . Hi there! I am currently making a project where a human user talks to an AI. OpenAI Responses is used to generate replies, and ElevenLabs is used to generate audio. Sometimes, I would like the AI to say a predetermined dialogue, so I need to create an assistant message to append to the conversation so the AI knows that it "said" it, even though it wasn't the one who came up with it. Currently, with OpenAI's recent changes, any assistant messages (or in this case, faked to look like it's an assistant message), must have the type output_text. Thank you. public async Task<Actor.Response> InsertFakeResponse(string message, CancellationToken cancellationToken) {
// Override the type of TextContent to output_text.
conversation.Add(new Message(OpenAI.Role.Assistant, new OpenAI.Responses.TextContent(message, ResponseContentType.OutputText)));
return new Actor.Response() {
message = message,
audioClip = await GetAudioClipAsync(message, cancellationToken) // Get AudioClip from ElevenLabs.
};
} |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
|
Ah I see, so you're trying to insert a fake response that might be from an assistant? |
Beta Was this translation helpful? Give feedback.
Ok, well in that case I specifically didn't allow for this in this library, but it is possible to "load" previous conversations via Json deserialization.
So if you want to pre populate data from a model, you'll need to do it this way sorry.