Class OpenAiChatModel

All Implemented Interfaces:
ChatModel, StreamingChatModel, Model<Prompt,ChatResponse>, StreamingModel<Prompt,ChatResponse>

public class OpenAiChatModel extends AbstractToolCallSupport implements ChatModel
ChatModel and StreamingChatModel implementation for OpenAI backed by OpenAiApi.
Author:
Mark Pollack, Christian Tzolov, Ueibin Kim, John Blum, Josh Long, Jemin Huh, Grogdunn, Hyunjoon Choi, Mariusz Bernacki, luocongqiu, Thomas Vitale, Ilayaperumal Gopinathan, Alexandros Pappas
See Also:
  • Constructor Details

    • OpenAiChatModel

      public OpenAiChatModel(OpenAiApi openAiApi)
      Creates an instance of the OpenAiChatModel.
      Parameters:
      openAiApi - The OpenAiApi instance to be used for interacting with the OpenAI Chat API.
      Throws:
      IllegalArgumentException - if openAiApi is null
    • OpenAiChatModel

      public OpenAiChatModel(OpenAiApi openAiApi, OpenAiChatOptions options)
      Initializes an instance of the OpenAiChatModel.
      Parameters:
      openAiApi - The OpenAiApi instance to be used for interacting with the OpenAI Chat API.
      options - The OpenAiChatOptions to configure the chat model.
    • OpenAiChatModel

      public OpenAiChatModel(OpenAiApi openAiApi, OpenAiChatOptions options, FunctionCallbackResolver functionCallbackResolver, org.springframework.retry.support.RetryTemplate retryTemplate)
      Initializes a new instance of the OpenAiChatModel.
      Parameters:
      openAiApi - The OpenAiApi instance to be used for interacting with the OpenAI Chat API.
      options - The OpenAiChatOptions to configure the chat model.
      functionCallbackResolver - The function callback resolver.
      retryTemplate - The retry template.
    • OpenAiChatModel

      public OpenAiChatModel(OpenAiApi openAiApi, OpenAiChatOptions options, FunctionCallbackResolver functionCallbackResolver, List<FunctionCallback> toolFunctionCallbacks, org.springframework.retry.support.RetryTemplate retryTemplate)
      Initializes a new instance of the OpenAiChatModel.
      Parameters:
      openAiApi - The OpenAiApi instance to be used for interacting with the OpenAI Chat API.
      options - The OpenAiChatOptions to configure the chat model.
      functionCallbackResolver - The function callback resolver.
      toolFunctionCallbacks - The tool function callbacks.
      retryTemplate - The retry template.
    • OpenAiChatModel

      public OpenAiChatModel(OpenAiApi openAiApi, OpenAiChatOptions options, FunctionCallbackResolver functionCallbackResolver, List<FunctionCallback> toolFunctionCallbacks, org.springframework.retry.support.RetryTemplate retryTemplate, io.micrometer.observation.ObservationRegistry observationRegistry)
      Initializes a new instance of the OpenAiChatModel.
      Parameters:
      openAiApi - The OpenAiApi instance to be used for interacting with the OpenAI Chat API.
      options - The OpenAiChatOptions to configure the chat model.
      functionCallbackResolver - The function callback resolver.
      toolFunctionCallbacks - The tool function callbacks.
      retryTemplate - The retry template.
      observationRegistry - The ObservationRegistry used for instrumentation.
  • Method Details