Class AzureOpenAiCompletionsChain
java.lang.Object
com.github.hakenadu.javalangchains.chains.llm.LargeLanguageModelChain
com.github.hakenadu.javalangchains.chains.llm.openai.OpenAiChain<OpenAiCompletionsParameters,OpenAiCompletionsRequest,OpenAiCompletionsResponse>
com.github.hakenadu.javalangchains.chains.llm.openai.completions.OpenAiCompletionsChain
com.github.hakenadu.javalangchains.chains.llm.azure.completions.AzureOpenAiCompletionsChain
public final class AzureOpenAiCompletionsChain extends OpenAiCompletionsChain
OpenAiCompletionsChain adopted for usage of Azure OpenAI Services-
Field Summary
-
Constructor Summary
Constructors Constructor Description AzureOpenAiCompletionsChain(String resourceName, String deploymentName, String apiVersion, String promptTemplate, OpenAiCompletionsParameters parameters, String apiKey)AzureOpenAiCompletionsChain(String resourceName, String deploymentName, String apiVersion, String promptTemplate, OpenAiCompletionsParameters parameters, String apiKey, 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(OpenAiCompletionsRequest 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.completions.OpenAiCompletionsChain
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
-
AzureOpenAiCompletionsChain
public AzureOpenAiCompletionsChain(String resourceName, String deploymentName, String apiVersion, String promptTemplate, OpenAiCompletionsParameters parameters, String apiKey, 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)objectMapper- TheObjectMapperused for body serialization and deserializationwebClient- TheWebClientused for executing requests to the OpenAI API
-
AzureOpenAiCompletionsChain
public AzureOpenAiCompletionsChain(String resourceName, String deploymentName, String apiVersion, String promptTemplate, OpenAiCompletionsParameters 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(OpenAiCompletionsRequest 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<OpenAiCompletionsParameters,OpenAiCompletionsRequest,OpenAiCompletionsResponse>- Parameters:
request- the request entitywebClient- theWebClientto use for the requestobjectMapper- theObjectMapperused for body serialization- Returns:
- the
WebClient.ResponseSpec
-