OpenAI
OpenAI copied to clipboard
Add pathPrefix to Configuration
What
Add pathPrefix
to OpenAI.Configuration.
Why
This is needed for reverse proxy servers - for example, if the proxy server has the next path: some-proxy-server.com/api
, and it will be passed as host
- func buildURL(path: String) -> URL
method will crash because some-proxy-server.com/api
is not a valid host.
The fix for this issue is to add pathPrefix
, which will be added before each path
when building a URL. So in provided example, some-proxy-server.com/api
will be splitter to host: "some-proxy-server.com", pathPrefix: "/api"
Affected Areas
Added new property pathPrefix
to OpenAI.Configuration
Quality Gate passed
Issues
0 New issues
0 Accepted issues
Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code
Great addition, had to make the same changes to my own fork to support Groq endpoints like: https://api.groq.com/openai/v1/chat/completions
Hope your PR gets approved soon 🙏