Class OpenRouterService
java.lang.Object
sk.iway.iwcm.components.ai.providers.SupportLogic
sk.iway.iwcm.components.ai.providers.openrouter.OpenRouterSupportService
sk.iway.iwcm.components.ai.providers.openrouter.OpenRouterService
- All Implemented Interfaces:
AiInterface
,SupportLogicInterface
Service for OpenRouter API - https://openrouter.ai/
-
Field Summary
Fields inherited from class sk.iway.iwcm.components.ai.providers.openrouter.OpenRouterSupportService
MAPPER
Fields inherited from class sk.iway.iwcm.components.ai.providers.SupportLogic
AUDIT_AI_RESPONSE_KEY
Fields inherited from interface sk.iway.iwcm.components.ai.providers.AiInterface
GENERATE_FILE_NAME_KEY
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
addUsageAndReturnTotal
(StringBuilder sb, int addToken, com.fasterxml.jackson.databind.JsonNode root) extractModels
(com.fasterxml.jackson.databind.JsonNode root) extractResponseText
(com.fasterxml.jackson.databind.JsonNode jsonNodeRes) getBonusHtml
(AssistantDefinitionEntity assistant, Prop prop) getFinishError
(com.fasterxml.jackson.databind.JsonNode jsonNodeRes) getImageBase64
(com.fasterxml.jackson.databind.JsonNode jsonNodeRes, com.fasterxml.jackson.databind.JsonNode jsonImage) getImageFormat
(com.fasterxml.jackson.databind.JsonNode jsonNodeRes, com.fasterxml.jackson.databind.JsonNode jsonImage) org.apache.http.client.methods.HttpRequestBase
getImageResponseRequest
(String instructions, InputDataDTO inputData, AssistantDefinitionEntity assistant, javax.servlet.http.HttpServletRequest request, Prop prop) com.fasterxml.jackson.databind.node.ArrayNode
getImages
(com.fasterxml.jackson.databind.JsonNode jsonNodeRes) org.apache.http.client.methods.HttpRequestBase
getModelsRequest
(javax.servlet.http.HttpServletRequest request) org.apache.http.client.methods.HttpRequestBase
getResponseRequest
(String instructions, InputDataDTO inputData, AssistantDefinitionEntity assistant, javax.servlet.http.HttpServletRequest request) org.apache.http.client.methods.HttpRequestBase
getStremResponseRequest
(String instructions, InputDataDTO inputData, AssistantDefinitionEntity assistant, javax.servlet.http.HttpServletRequest request) com.fasterxml.jackson.databind.JsonNode
handleBufferedReader
(BufferedReader reader, BufferedWriter writer, Map<Integer, String> replacedIncludes) boolean
isInit()
Methods inherited from class sk.iway.iwcm.components.ai.providers.openrouter.OpenRouterSupportService
addMessage, addMessageWithImage, getApiKey, getBaseMainObject, getRequestBody, getServiceName, handleFinishReasonValue, setHeaders
Methods inherited from class sk.iway.iwcm.components.ai.providers.SupportLogic
getAiImageResponse, getAiResponse, getAiStreamResponse, getSupportedModels, handleErrorMessage, handleErrorMessage
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface sk.iway.iwcm.components.ai.providers.AiInterface
getAiImageResponse, getAiResponse, getAiStreamResponse, getRequestBody, getSupportedModels
Methods inherited from interface sk.iway.iwcm.components.ai.providers.SupportLogicInterface
getStreamEncoding
-
Constructor Details
-
OpenRouterService
public OpenRouterService()
-
-
Method Details
-
getProviderId
- Specified by:
getProviderId
in interfaceAiInterface
-
getTitleKey
- Specified by:
getTitleKey
in interfaceAiInterface
-
isInit
public boolean isInit()- Specified by:
isInit
in interfaceAiInterface
-
addUsageAndReturnTotal
public int addUsageAndReturnTotal(StringBuilder sb, int addToken, com.fasterxml.jackson.databind.JsonNode root) - Specified by:
addUsageAndReturnTotal
in interfaceSupportLogicInterface
-
getModelsRequest
public org.apache.http.client.methods.HttpRequestBase getModelsRequest(javax.servlet.http.HttpServletRequest request) - Specified by:
getModelsRequest
in interfaceSupportLogicInterface
-
extractModels
- Specified by:
extractModels
in interfaceSupportLogicInterface
-
getResponseRequest
public org.apache.http.client.methods.HttpRequestBase getResponseRequest(String instructions, InputDataDTO inputData, AssistantDefinitionEntity assistant, javax.servlet.http.HttpServletRequest request) - Specified by:
getResponseRequest
in interfaceSupportLogicInterface
-
extractResponseText
- Specified by:
extractResponseText
in interfaceSupportLogicInterface
-
getStremResponseRequest
public org.apache.http.client.methods.HttpRequestBase getStremResponseRequest(String instructions, InputDataDTO inputData, AssistantDefinitionEntity assistant, javax.servlet.http.HttpServletRequest request) - Specified by:
getStremResponseRequest
in interfaceSupportLogicInterface
-
handleBufferedReader
public com.fasterxml.jackson.databind.JsonNode handleBufferedReader(BufferedReader reader, BufferedWriter writer, Map<Integer, String> replacedIncludes) throws IOException- Specified by:
handleBufferedReader
in interfaceSupportLogicInterface
- Throws:
IOException
-
getImageResponseRequest
public org.apache.http.client.methods.HttpRequestBase getImageResponseRequest(String instructions, InputDataDTO inputData, AssistantDefinitionEntity assistant, javax.servlet.http.HttpServletRequest request, Prop prop) throws IOException - Specified by:
getImageResponseRequest
in interfaceSupportLogicInterface
- Throws:
IOException
-
getFinishError
- Specified by:
getFinishError
in interfaceSupportLogicInterface
-
getImages
public com.fasterxml.jackson.databind.node.ArrayNode getImages(com.fasterxml.jackson.databind.JsonNode jsonNodeRes) - Specified by:
getImages
in interfaceSupportLogicInterface
-
getImageFormat
public String getImageFormat(com.fasterxml.jackson.databind.JsonNode jsonNodeRes, com.fasterxml.jackson.databind.JsonNode jsonImage) - Specified by:
getImageFormat
in interfaceSupportLogicInterface
-
getImageBase64
public String getImageBase64(com.fasterxml.jackson.databind.JsonNode jsonNodeRes, com.fasterxml.jackson.databind.JsonNode jsonImage) - Specified by:
getImageBase64
in interfaceSupportLogicInterface
-
getModelForImageNameGeneration
- Specified by:
getModelForImageNameGeneration
in interfaceSupportLogicInterface
-
getBonusHtml
- Specified by:
getBonusHtml
in interfaceAiInterface
-