I published a prompt in the OpenAI dashboard and got a Prompt ID with version. I’m trying to call this prompt from my C# WinForms app using the openai-dotnet SDK (Responses API), but i’m getting this exception:
System.InvalidOperationException: The requested operation requires an element of type 'String', but the target element has type 'Array'.
In the OpenAI dashboard logs, the request works and a response is created successfully (I can see same prompt id, version, output).
private async Task<string> GetChatCompletionAsync(string userInput)
{
List<ResponseItem> inputItems =
[
ResponseItem.CreateUserMessageItem(userInput),
];
var options = new CreateResponseOptions(inputItems);
options.Patch.Set("$.prompt.id"u8, promptId);
options.Patch.Set("$.prompt.version"u8, promptVersion);
ResponseResult response = await responsesClient.CreateResponseAsync(options); // <-- exception happens here
string text = response.GetOutputText();
return text;
}
}
I couldn’t find any C# example for using a published Prompt ID
Thanks!