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

Did you just hardcode base url!? #482

Open
dims12 opened this issue Mar 24, 2024 · 1 comment
Open

Did you just hardcode base url!? #482

dims12 opened this issue Mar 24, 2024 · 1 comment

Comments

@dims12
Copy link

dims12 commented Mar 24, 2024

Really

https://github.com/TheoKanning/openai-java/blob/main/service/src/main/java/com/theokanning/openai/service/OpenAiService.java#L71

are you kidding?

@r59q
Copy link

r59q commented May 6, 2024

Use this to override the url

    OkHttpClient okHttpClient = OpenAiService.defaultClient(apiKeyProvider.getAPIKey(), Duration.ofSeconds(10));
    Retrofit retrofit = OpenAiService.defaultRetrofit(okHttpClient, OpenAiService.defaultObjectMapper()).newBuilder()
            .baseUrl("YOUR_BASE_URL")
            .build();

    OpenAiApi openAiApi = retrofit.create(OpenAiApi.class);
    OpenAiService serviceWithYourUrl = new OpenAiService(openAiApi, okHttpClient.dispatcher().executorService());

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