Class AzureOpenAiChatChain

All Implemented Interfaces:
Chain<Map<String,​String>,​String>

public final class AzureOpenAiChatChain
extends OpenAiChatChain
OpenAiChatChain adopted for usage of Azure OpenAI Services
  • Constructor Details

    • AzureOpenAiChatChain

      public AzureOpenAiChatChain​(String resourceName, String deploymentName, String apiVersion, String promptTemplate, OpenAiChatParameters parameters, String apiKey, String systemTemplate, com.fasterxml.jackson.databind.ObjectMapper objectMapper, org.springframework.web.reactive.function.client.WebClient webClient)
      Parameters:
      resourceName - resourceName
      deploymentName - deploymentName
      apiVersion - apiVersion
      promptTemplate - The template which contains placeholders in the form ${myPlaceholder} that are replaced for input documents before creating a request to a LLM.
      parameters - The OpenAiChatParameters allows to finetune requests to the OpenAI API
      apiKey - The API-Key used for Authentication (passed using the "api-key" Header)
      systemTemplate - The template for the system role which contains placeholders in the form ${myPlaceholder} that are replaced for input documents before creating a request to a LLM.
      objectMapper - The ObjectMapper used for body serialization and deserialization
      webClient - The WebClient used for executing requests to the OpenAI API
    • AzureOpenAiChatChain

      public AzureOpenAiChatChain​(String resourceName, String deploymentName, String apiVersion, String promptTemplate, OpenAiChatParameters parameters, String apiKey, String systemTemplate)
      Parameters:
      resourceName - resourceName
      deploymentName - deploymentName
      apiVersion - apiVersion
      promptTemplate - The template which contains placeholders in the form ${myPlaceholder} that are replaced for input documents before creating a request to a LLM.
      parameters - The OpenAiChatParameters allows to finetune requests to the OpenAI API
      apiKey - The API-Key used for Authentication (passed using the "api-key" Header)
      systemTemplate - The template for the system role which contains placeholders in the form ${myPlaceholder} that are replaced for input documents before creating a request
    • AzureOpenAiChatChain

      public AzureOpenAiChatChain​(String resourceName, String deploymentName, String apiVersion, String promptTemplate, OpenAiChatParameters parameters, String apiKey)
      Parameters:
      resourceName - resourceName
      deploymentName - deploymentName
      apiVersion - apiVersion
      promptTemplate - The template which contains placeholders in the form ${myPlaceholder} that are replaced for input documents before creating a request to a LLM.
      parameters - The OpenAiChatParameters allows to finetune requests to the OpenAI API
      apiKey - The API-Key used for Authentication (passed using the "api-key" Header)
  • Method Details

    • createResponseSpec

      protected org.springframework.web.reactive.function.client.WebClient.ResponseSpec createResponseSpec​(OpenAiChatCompletionsRequest request, org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper)
      Description copied from class: OpenAiChatChain
      executes the request to the OpenAI API. Protected so that it may be overridden for other OpenAI API Providers.
      Overrides:
      createResponseSpec in class OpenAiChatChain
      Parameters:
      request - the OpenAiChatCompletionsRequest
      webClient - the WebClient to use for the request
      objectMapper - the ObjectMapper used for body serialization
      Returns:
      the WebClient.ResponseSpec