All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.hakenadu.javalangchains.chains.llm.openai.chat.OpenAiChatCompletionsParameters Maven / Gradle / Ivy

package com.github.hakenadu.javalangchains.chains.llm.openai.chat;

import java.util.Map;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.github.hakenadu.javalangchains.chains.llm.openai.OpenAiParameters;

/**
 * Parameters for calling an OpenAI Chat Model
 * 
 * https://platform.openai.com/docs/api-reference/chat/create
 */
public class OpenAiChatCompletionsParameters extends OpenAiParameters {

	/**
	 * 

From * https://github.com/openai/openai-openapi/blob/master/openapi.yaml

* * Number between -2.0 and 2.0. Positive values penalize new tokens based on * their existing frequency in the text so far, decreasing the model's * likelihood to repeat the same line verbatim. */ @JsonProperty("frequence_penalty") private Double frequencePenalty; /** *

From * https://github.com/openai/openai-openapi/blob/master/openapi.yaml

* * Modify the likelihood of specified tokens appearing in the completion. * Accepts a json object that maps tokens (specified by their token ID in the * tokenizer) to an associated bias value from -100 to 100. Mathematically, the * bias is added to the logits generated by the model prior to sampling. The * exact effect will vary per model, but values between -1 and 1 should decrease * or increase likelihood of selection; values like -100 or 100 should result in * a ban or exclusive selection of the relevant token. */ private Map logitBias; /** *

From * https://github.com/openai/openai-openapi/blob/master/openapi.yaml

* * Number between -2.0 and 2.0. Positive values penalize new tokens based on * whether they appear in the text so far, increasing the model's likelihood to * talk about new topics. */ @JsonProperty("precence_penalty") private Double presencePenalty; /** * creates an instance of {@link OpenAiChatCompletionsParameters} */ public OpenAiChatCompletionsParameters() { super(OpenAiChatCompletionsParameters.class); } /** * @return {@link #frequencePenalty} */ public Double getFrequencePenalty() { return frequencePenalty; } /** * @param frequencePenalty {@link #frequencePenalty} */ public void setFrequencePenalty(final Double frequencePenalty) { this.frequencePenalty = frequencePenalty; } /** * @param frequencePenalty {@link #frequencePenalty} * @return this */ public OpenAiChatCompletionsParameters frequencePenalty(final Double frequencePenalty) { this.setFrequencePenalty(frequencePenalty); return this; } /** * @return {@link #logitBias} */ public Map getLogitBias() { return logitBias; } /** * @param logitBias {@link #logitBias} */ public void setLogitBias(final Map logitBias) { this.logitBias = logitBias; } /** * @param logitBias {@link #logitBias} * @return this */ public OpenAiChatCompletionsParameters logitBias(final Map logitBias) { setLogitBias(logitBias); return this; } /** * @return {@link #presencePenalty} */ public Double getPresencePenalty() { return presencePenalty; } /** * @param presencePenalty {@link #presencePenalty} */ public void setPresencePenalty(final Double presencePenalty) { this.presencePenalty = presencePenalty; } /** * @param presencePenalty {@link #presencePenalty} * @return this */ public OpenAiChatCompletionsParameters presencePenalty(final Double presencePenalty) { this.setPresencePenalty(presencePenalty); return this; } /** * copies parameter values from another instance of {@link OpenAiChatCompletionsParameters} * * @param parameters the source {@link OpenAiChatCompletionsParameters} */ @Override public void copyFrom(final OpenAiChatCompletionsParameters parameters) { super.copyFrom(parameters); this.setFrequencePenalty(parameters.getFrequencePenalty()); this.setLogitBias(parameters.getLogitBias()); this.setPresencePenalty(parameters.getPresencePenalty()); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy