Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenAI error: Post "/chat/completions": unsupported protocol scheme #161

Closed
dsent opened this issue Oct 26, 2024 · 4 comments
Closed

OpenAI error: Post "/chat/completions": unsupported protocol scheme #161

dsent opened this issue Oct 26, 2024 · 4 comments

Comments

@dsent
Copy link

dsent commented Oct 26, 2024

After updating to the latest release and trying to set a custom OpenAI prompt, I see all OpenAI checks failing 100% of the time with the error OpenAI error: Post "/chat/completions": unsupported protocol scheme.
The same happens even if I copy the default prompt verbatim.
The env variable is set correctly for the container.
Studying debug output hints in the direction of quote escaping happening when handling env variables.
This is the debug output if I set the OPENAI_PROMPT to the default prompt:

[DEBUG] {app/main.go:438 main.makeDetector} openai  config: {MaxTokensResponse:1024 MaxTokensRequest:2048 MaxSymbolsRequest:16000 Model:gpt-4o SystemPrompt:I'll give you a text from the messaging application and you will return me a json with three fields: {\"spam\": true/false, \"reason\":\"why this is spam\", \"confidence\":1-100}. Set spam:true only of confidence above 80

As we can see, all double quotes get escaped.

@dsent
Copy link
Author

dsent commented Oct 26, 2024

I've tried to replace double quotes to single quotes in different ways. They don't seem to be escaped in the logs, but the error is still the same: unsupported protocol scheme.

Maybe something else is going on, like curly braces being interpreted or something.

@dsent
Copy link
Author

dsent commented Oct 26, 2024

Okay, it seems that the problem might not be with the custom OpenAI prompt.
After removing OPENAI_PROMPT from the env completely, I see the same problem happening.
Might be a bug introduced in the latest release.

@dsent dsent changed the title Can't set a custom OpenAI prompt: unsupported protocol scheme OpenAI error: Post "/chat/completions": unsupported protocol scheme Oct 26, 2024
umputun added a commit that referenced this issue Oct 26, 2024
@umputun
Copy link
Owner

umputun commented Oct 26, 2024

This was a regression introduced by incorrect handling of a custom API endpoint. It should be fixed on master. Please give it a try and let me know. If all is good, I'll release a quick-fix version right away.

@dsent
Copy link
Author

dsent commented Oct 26, 2024

Yep, the issue is fixed. Custom prompting works too!

@umputun umputun closed this as completed Oct 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants