Skip to content
This repository has been archived by the owner on Jun 6, 2024. It is now read-only.

Base URL with path segments is not supported #471

Open
Vasniktel opened this issue Feb 20, 2024 · 1 comment
Open

Base URL with path segments is not supported #471

Vasniktel opened this issue Feb 20, 2024 · 1 comment

Comments

@Vasniktel
Copy link

It is possible to specify a base URL with retrofit as follows:

var retrofit = OpenAiService.defaultRetrofit(client, om)
            .newBuilder()
            .baseUrl("https://api.groq.com/openai/")
            .build();

However, if baseUrl contains any path segments (e.g. /openai/ above) - they will be ignored because some OpenAiApi methods define absolute paths:

A fix would be to remove all heading / to make v1/chat/completions.

Additionally, the behaviour of heading / is inconsistent:

A temporary solution for now is to use a custom interceptor to manually insert missing path segments into every request.

@Vasniktel Vasniktel changed the title Base URL with path segments are not supported Base URL with path segments is not supported Feb 20, 2024
@wufg2002
Copy link

change @post("/v1/completions") to @post("v1/completions")

interface HxOpenAiApi : OpenAiApi {
@streaming
@post("v1/completions")
override fun createCompletionStream(@Body request: CompletionRequest?): Call<ResponseBody?>?

}

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants