Class OpenAIChat

java.lang.Object
com.hw.langchain.llms.base.BaseLLM
com.hw.langchain.llms.openai.OpenAIChat
All Implemented Interfaces:
BaseLanguageModel

public class OpenAIChat extends BaseLLM
Wrapper around OpenAI Chat large language models.
Author:
HamaWhite
  • Field Details

    • client

      protected OpenAiClient client
    • model

      protected String model
      Model name to use.
    • temperature

      protected float temperature
      What sampling temperature to use.
    • maxTokens

      protected int maxTokens
      The maximum number of tokens to generate in the completion. -1 returns as many tokens as possible given the prompt and the model's maximal context size.
    • topP

      protected float topP
      Total probability mass of tokens to consider at each step.
    • frequencyPenalty

      protected float frequencyPenalty
      Penalizes repeated tokens according to frequency.
    • presencePenalty

      protected float presencePenalty
      Penalizes repeated tokens.
    • n

      protected int n
      How many completions to generate for each prompt.
    • openaiApiKey

      protected String openaiApiKey
      API key for OpenAI.
    • openaiApiBase

      protected String openaiApiBase
      Base URL for OpenAI API.
    • openaiApiType

      protected OpenaiApiType openaiApiType
      Api type for Azure OpenAI API.
    • openaiApiVersion

      protected String openaiApiVersion
      Api version for Azure OpenAI API.
    • openaiOrganization

      protected String openaiOrganization
      Organization ID for OpenAI.
    • openaiProxy

      protected String openaiProxy
      Support explicit proxy for OpenAI
    • maxRetries

      protected int maxRetries
      Maximum number of retries to make when generating.
    • requestTimeout

      protected long requestTimeout
      Timeout for requests to OpenAI completion API. Default is 16 seconds.
    • logitBias

      protected Map<String,Float> logitBias
      Adjust the probability of specific tokens being generated.
    • stream

      protected boolean stream
      Whether to stream the results or not.
  • Constructor Details

    • OpenAIChat

      public OpenAIChat()
  • Method Details