Class OpenrouterPuppyChatter
java.lang.Object
rocks.imsofa.ai.puppychatter.AbstractPuppyChatter<PromptParameters,Response>
rocks.imsofa.ai.puppychatter.openrouter.OpenrouterPuppyChatter
- All Implemented Interfaces:
PuppyChatter<PromptParameters,Response>
an implementation of PuppyChatter based on Open Router
usage:
PuppyChatter<PromptParameters, Response> chatter=new OpenrouterPuppyChatter("open router key");
String session=chatter.createSession();
Response response=chatter.bark(session, "你好", new PromptParameters("user"));
System.out.println(response.getMessage());
chatter.closeSession(session);
when issuing prompt, a leading model:xxx can be used to specify the model to use
PuppyChatter<PromptParameters, Response> chatter=new OpenrouterPuppyChatter("open router key");
String session=chatter.createSession();
Response response=chatter.bark(session, "你好", new PromptParameters("user"));
System.out.println(response.getMessage());
chatter.closeSession(session);
when issuing prompt, a leading model:xxx can be used to specify the model to use
- Author:
- lendle
-
Field Summary
Fields inherited from class rocks.imsofa.ai.puppychatter.AbstractPuppyChatter
cacheService, replyRole, sessionHistory -
Constructor Summary
ConstructorsConstructorDescriptionOpenrouterPuppyChatter(String apiKey) OpenrouterPuppyChatter(String apiKey, String defaultModel, CacheService cacheService) OpenrouterPuppyChatter(String apiKey, CacheService cacheService) -
Method Summary
Modifier and TypeMethodDescriptionprotected Response_bark(String sessionId, List<Conversation> messages, PromptParameters parameters) protected void_bark(String sessionId, List<Conversation> messages, PromptParameters parameters, BarkCallback callback) protected PromptParametersprotected ResponsecreateResponseFromConversation(Conversation conversation) static voidMethods inherited from class rocks.imsofa.ai.puppychatter.AbstractPuppyChatter
bark, bark, bark, bark, bark, bark, closeSession, createSession
-
Constructor Details
-
OpenrouterPuppyChatter
-
OpenrouterPuppyChatter
-
OpenrouterPuppyChatter
-
-
Method Details
-
_bark
protected void _bark(String sessionId, List<Conversation> messages, PromptParameters parameters, BarkCallback callback) throws Exception - Specified by:
_barkin classAbstractPuppyChatter<PromptParameters,Response> - Throws:
Exception
-
_bark
protected Response _bark(String sessionId, List<Conversation> messages, PromptParameters parameters) throws Exception - Specified by:
_barkin classAbstractPuppyChatter<PromptParameters,Response> - Throws:
Exception
-
createResponseFromConversation
- Specified by:
createResponseFromConversationin classAbstractPuppyChatter<PromptParameters,Response>
-
main
- Throws:
Exception
-
createDefaultPromptParameter
- Specified by:
createDefaultPromptParameterin classAbstractPuppyChatter<PromptParameters,Response>
-