Class AzureOpenAiChatCompletionsChain
java.lang.Object
com.github.hakenadu.javalangchains.chains.llm.LargeLanguageModelChain
com.github.hakenadu.javalangchains.chains.llm.openai.OpenAiChain<OpenAiChatCompletionsParameters,OpenAiChatCompletionsRequest,OpenAiChatCompletionsResponse>
com.github.hakenadu.javalangchains.chains.llm.openai.chat.OpenAiChatCompletionsChain
com.github.hakenadu.javalangchains.chains.llm.azure.chat.AzureOpenAiChatCompletionsChain
public final class AzureOpenAiChatCompletionsChain extends OpenAiChatCompletionsChain
OpenAiChatCompletionsChain adopted for usage of Azure OpenAI Services-
Field Summary
-
Constructor Summary
Constructors Constructor Description AzureOpenAiChatCompletionsChain(String resourceName, String deploymentName, String apiVersion, String promptTemplate, OpenAiChatCompletionsParameters parameters, String apiKey)AzureOpenAiChatCompletionsChain(String resourceName, String deploymentName, String apiVersion, String promptTemplate, OpenAiChatCompletionsParameters parameters, String apiKey, String systemTemplate)AzureOpenAiChatCompletionsChain(String resourceName, String deploymentName, String apiVersion, String promptTemplate, OpenAiChatCompletionsParameters 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.chat.OpenAiChatCompletionsChain
createOutput, createRequestMethods inherited from class com.github.hakenadu.javalangchains.chains.llm.openai.OpenAiChain
createDefaultObjectMapper, createDefaultWebClient, getApiKey, requestToBody, runMethods inherited from class com.github.hakenadu.javalangchains.chains.llm.LargeLanguageModelChain
getPromptTemplate
-
Constructor Details
-
AzureOpenAiChatCompletionsChain
public AzureOpenAiChatCompletionsChain(String resourceName, String deploymentName, String apiVersion, String promptTemplate, OpenAiChatCompletionsParameters parameters, String apiKey, String systemTemplate, com.fasterxml.jackson.databind.ObjectMapper objectMapper, org.springframework.web.reactive.function.client.WebClient webClient)- Parameters:
resourceName- Name of the azure resourcedeploymentName- Name of the azure openai service deploymentapiVersion- The target API VersionpromptTemplate- The template which contains placeholders in the form ${myPlaceholder} that are replaced for input documents before creating a request to a LLM.parameters- TheOpenAiChatCompletionsParametersallows 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
-
AzureOpenAiChatCompletionsChain
public AzureOpenAiChatCompletionsChain(String resourceName, String deploymentName, String apiVersion, String promptTemplate, OpenAiChatCompletionsParameters parameters, String apiKey, String systemTemplate)- Parameters:
resourceName- Name of the azure resourcedeploymentName- Name of the azure openai service deploymentapiVersion- The target API VersionpromptTemplate- The template which contains placeholders in the form ${myPlaceholder} that are replaced for input documents before creating a request to a LLM.parameters- TheOpenAiChatCompletionsParametersallows 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
-
AzureOpenAiChatCompletionsChain
public AzureOpenAiChatCompletionsChain(String resourceName, String deploymentName, String apiVersion, String promptTemplate, OpenAiChatCompletionsParameters parameters, String apiKey)- Parameters:
resourceName- Name of the azure resourcedeploymentName- Name of the azure openai service deploymentapiVersion- The target API VersionpromptTemplate- The template which contains placeholders in the form ${myPlaceholder} that are replaced for input documents before creating a request to a LLM.parameters- TheOpenAiChatCompletionsParametersallows 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:OpenAiChainexecutes the request to the OpenAI API. Protected so that it may be overridden for other OpenAI API Providers.- Overrides:
createResponseSpecin classOpenAiChain<OpenAiChatCompletionsParameters,OpenAiChatCompletionsRequest,OpenAiChatCompletionsResponse>- Parameters:
request- the request entitywebClient- theWebClientto use for the requestobjectMapper- theObjectMapperused for body serialization- Returns:
- the
WebClient.ResponseSpec
-