private ChatCompletionCreateParams getChatCompletionCreateParams(InferenceParameters parameters, Prompt prompt) {
        ChatCompletionCreateParams.Builder builder = ChatCompletionCreateParams.builder()
            .model(ChatModel.of(parameters.get(InferenceParameters.OPTION_MODEL).map(Object::toString).orElse(DEFAULT_MODEL)))
            .addUserMessage(prompt.toString());
        parameters.getInt(InferenceParameters.OPTION_MAX_TOKENS).ifPresent(builder::maxCompletionTokens);
        parameters.getDouble(InferenceParameters.OPTION_TEMPERATURE).ifPresent(builder::temperature);
        parameters.getDouble(InferenceParameters.OPTION_TOP_P).ifPresent(builder::topP);
        parameters.getLong(InferenceParameters.OPTION_SEED).ifPresent(builder::seed);
        parameters.getInt(InferenceParameters.OPTION_N_PREDICT).ifPresent(builder::n);
        parameters.getDouble(InferenceParameters.OPTION_FREQUENCY_PENALTY).ifPresent(builder::frequencyPenalty);
        parameters.getDouble(InferenceParameters.OPTION_PRESENCE_PENALTY).ifPresent(builder::presencePenalty);
        // Add JSON schema if specified
        addResponseFormat(parameters, builder);
        
        return builder.build();
    }
A configurable OpenAI client that extends the {@link ConfigurableLanguageModel} class.
Uses Official OpenAI java client (https://github.com/openai/openai-java)
Supports basic completion and structured JSON output. Extensible to support Embedding, Tool Calling and Moderations.
Will reuse clients for Completions using same endpoint and API key to reduce connection overhead for multiple requests to the same endpoint with the same API key.
@author lesters
@author glebashnik
@author thomasht86
model-integration/src/main/java/ai/vespa/llm/clients/OpenAI.java