Texture2D Submission Throwing 404? #259
Answered
by
taylorbrown2686
taylorbrown2686
asked this question in
Q&A
-
When I submit an image-based request: public async Task<string> GetImageBasedReply(string prompt, Texture2D image)
{
ChatSession.chatMessages.Add(new Message(Role.System, new List<Content> {
new Content(ContentType.Text, "Use this image for context to the prompt."),
image
}));
ChatSession.chatMessages.Add(new Message(Role.User, prompt));
ChatRequest request = new ChatRequest(ChatSession.chatMessages, model: "gpt-4-vision-preview", maxTokens: 200);
ChatResponse response = await ChatSession.client.ChatEndpoint.GetCompletionAsync(request);
if (response.Choices is not null && response.Choices.Count > 0)
{
var gptMessage = response.Choices[0].Message;
print("GPT Response: " + gptMessage.Content.ToString());
ChatSession.chatMessages.Add(gptMessage);
return gptMessage.Content.ToString();
}
else
{
return null;
}
} It throws a [POST:404] RestException, simply saying it 'Failed' with no additional information. The error itself shows the preprompt given along with a long string (Base64 assumed?) that is truncated for length. What exactly is the '404' referring to, and how can I resolve it? |
Beta Was this translation helpful? Give feedback.
Answered by
taylorbrown2686
Jul 10, 2024
Replies: 1 comment 9 replies
-
Also if you could provide the full response output that would also be helpful. |
Beta Was this translation helpful? Give feedback.
9 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hmm, I've never had to do that for a log message before. I didn't even know that option existed!
The B64 string was hiding the full message for the '400' error, which specifies that image queries need to be sent under the 'User' role and not the 'System' role. Changing this fixed my problem.
Thanks for the help!