Class AzureOpenAiChatChain
java.lang.Object
com.github.hakenadu.javalangchains.chains.llm.LargeLanguageModelChain
com.github.hakenadu.javalangchains.chains.llm.openai.OpenAiChatChain
com.github.hakenadu.javalangchains.chains.llm.azure.AzureOpenAiChatChain
public final class AzureOpenAiChatChain extends OpenAiChatChain
OpenAiChatChain adopted for usage of Azure OpenAI Services-
Field Summary
-
Constructor Summary
Constructors Constructor Description AzureOpenAiChatChain(String resourceName, String deploymentName, String apiVersion, String promptTemplate, OpenAiChatParameters parameters, String apiKey)AzureOpenAiChatChain(String resourceName, String deploymentName, String apiVersion, String promptTemplate, OpenAiChatParameters parameters, String apiKey, String systemTemplate)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) -
Method Summary
Modifier and Type Method Description protected org.springframework.web.reactive.function.client.WebClient.ResponseSpeccreateResponseSpec(OpenAiChatCompletionsRequest request, org.springframework.web.reactive.function.client.WebClient webClient, com.fasterxml.jackson.databind.ObjectMapper objectMapper)executes the request to the OpenAI API.Methods inherited from class com.github.hakenadu.javalangchains.chains.llm.openai.OpenAiChatChain
createDefaultObjectMapper, createDefaultWebClient, getApiKey, requestToBody, runMethods inherited from class com.github.hakenadu.javalangchains.chains.llm.LargeLanguageModelChain
getPromptTemplate
-
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-resourceNamedeploymentName-deploymentNameapiVersion-apiVersionpromptTemplate- The template which contains placeholders in the form ${myPlaceholder} that are replaced for input documents before creating a request to a LLM.parameters- TheOpenAiChatParametersallows to finetune requests to the OpenAI APIapiKey- 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- TheObjectMapperused for body serialization and deserializationwebClient- TheWebClientused 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-resourceNamedeploymentName-deploymentNameapiVersion-apiVersionpromptTemplate- The template which contains placeholders in the form ${myPlaceholder} that are replaced for input documents before creating a request to a LLM.parameters- TheOpenAiChatParametersallows to finetune requests to the OpenAI APIapiKey- 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-resourceNamedeploymentName-deploymentNameapiVersion-apiVersionpromptTemplate- The template which contains placeholders in the form ${myPlaceholder} that are replaced for input documents before creating a request to a LLM.parameters- TheOpenAiChatParametersallows to finetune requests to the OpenAI APIapiKey- 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:OpenAiChatChainexecutes the request to the OpenAI API. Protected so that it may be overridden for other OpenAI API Providers.- Overrides:
createResponseSpecin classOpenAiChatChain- Parameters:
request- theOpenAiChatCompletionsRequestwebClient- theWebClientto use for the requestobjectMapper- theObjectMapperused for body serialization- Returns:
- the
WebClient.ResponseSpec
-