Open Vasniktel opened 4 months ago
change @POST("/v1/completions") to @POST("v1/completions")
interface HxOpenAiApi : OpenAiApi {
@Streaming
@POST("v1/completions")
override fun createCompletionStream(@Body request: CompletionRequest?): Call<ResponseBody?>?
}
It is possible to specify a base URL with retrofit as follows:
However, if
baseUrl
contains any path segments (e.g./openai/
above) - they will be ignored because someOpenAiApi
methods define absolute paths:https://github.com/TheoKanning/openai-java/blob/e7de81c29319d605703a874c3f1fa56f61122e8b/client/src/main/java/com/theokanning/openai/client/OpenAiApi.java#L69 A fix would be to remove all heading/
to makev1/chat/completions
.Additionally, the behaviour of heading
/
is inconsistent: https://github.com/TheoKanning/openai-java/blob/e7de81c29319d605703a874c3f1fa56f61122e8b/client/src/main/java/com/theokanning/openai/client/OpenAiApi.java#L56A temporary solution for now is to use a custom interceptor to manually insert missing path segments into every request.