Package ai.picovoice.picollm
Class PicoLLMDialog
java.lang.Object
ai.picovoice.picollm.PicoLLMDialog
- Direct Known Subclasses:
GemmaChatDialog,Llama2ChatDialog,Llama3ChatDialog,MistralChatDialog,Phi2Dialog,Phi3ChatDialog
`PicoLLMDialog` is a helper class that stores a chat dialog and formats it according
to an instruction-tuned LLM's chat template. `PicoLLMDialog` is the base class.
Each supported instruction-tuned LLM has an accompanying concrete subclass.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class for constructing instances of PicoLLMDialog. -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPicoLLMDialog(Integer history, String system) Constructs a new instance of PicoLLMDialog with the specified history and system settings. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddHumanRequest(String content) Adds a human request to the dialog.voidaddLLMResponse(String content) Adds an LLM response to the dialog.Creates a prompt string given parameters passed the constructor and dialog's content.
-
Field Details
-
history
-
system
-
humanRequests
-
llmResponses
-
-
Constructor Details
-
PicoLLMDialog
Constructs a new instance of PicoLLMDialog with the specified history and system settings.- Parameters:
history- The history length for the dialog.system- The system instruction for configuring the model's responses.
-
-
Method Details
-
addHumanRequest
Adds a human request to the dialog.- Parameters:
content- The human request to add.- Throws:
PicoLLMInvalidStateException- if adding a human request without a corresponding LLM response.
-
addLLMResponse
Adds an LLM response to the dialog.- Parameters:
content- The LLM response to add.- Throws:
PicoLLMInvalidStateException- if adding an LLM response without a corresponding human request.
-
getPrompt
Creates a prompt string given parameters passed the constructor and dialog's content.- Returns:
- Formatted prompt.
- Throws:
PicoLLMException- if called from the base PicoLLMDialog class.
-