Class BasicLLMServiceProvider

java.lang.Object
edu.tufts.hrilab.diarc.DiarcComponent
edu.tufts.hrilab.llm.LLMServiceProvider
edu.tufts.hrilab.llm.serviceproviders.BasicLLMServiceProvider
Direct Known Subclasses:
TRLLMServiceProvider

public abstract class BasicLLMServiceProvider extends LLMServiceProvider
  • Constructor Details

    • BasicLLMServiceProvider

      public BasicLLMServiceProvider()
  • Method Details

    • generateNLGChat

      protected abstract Chat generateNLGChat(Utterance utterance)
      Generate a Chat object to call LLM's chatCompletion service with for the generation task. Practically entails generating a system and user message for an NLG request of the supplied utterance.
      Parameters:
      utterance - outgoing utterance to perform NLG for
      Returns:
      Fully updated Chat object to pass to an LLM's chatCompletion service for NLG
    • generateNLUChat

      protected abstract Chat generateNLUChat(Utterance utterance)
      Generate a Chat object to call LLM's chatCompletion service with for the parsing task. Practically entails creating a new or updating an existing Chat object to contain the proper system, user, and assistant messages to come up with a proper parse of the supplied utterance.
      Parameters:
      utterance - incoming utterance to be parsed
      Returns:
      Fully updated Chat object to pass to an LLM's chatCompletion service for parsing
    • parseNLUCompletionResponse

      protected abstract Utterance parseNLUCompletionResponse(Utterance incomingUtterance, Completion llmResponse)
      Postprocessing of LLM's chatCompletion return value for the NLU task.
      Returns:
      The fully populated Utterance to return from parseUtterance
    • parseNLGCompletionResponse

      protected abstract Utterance parseNLGCompletionResponse(Utterance outgoingUtterance, Completion llmResponse)
      Postprocessing of LLM's chatCompletion return value for the NLG task.
      Returns:
      The fully populated Utterance to return convertSemanticsToText.
    • inExtendedParseLoop

      public boolean inExtendedParseLoop(Symbol user, Symbol agentTeam)
      Specified by:
      inExtendedParseLoop in class LLMServiceProvider
    • parseUtteranceLLMService

      public Utterance parseUtteranceLLMService(Utterance utterance)
      Specified by:
      parseUtteranceLLMService in class LLMServiceProvider
    • convertSemanticsToTextLLMService

      public Utterance convertSemanticsToTextLLMService(Utterance u)
      Specified by:
      convertSemanticsToTextLLMService in class LLMServiceProvider
    • convertSemanticsToTextLLMService

      public Utterance convertSemanticsToTextLLMService(Utterance utterance, boolean streamingGeneration)
      Specified by:
      convertSemanticsToTextLLMService in class LLMServiceProvider
    • parseUtteranceLLMService

      public Utterance parseUtteranceLLMService(Utterance utterance, boolean streamingGeneration)
      Specified by:
      parseUtteranceLLMService in class LLMServiceProvider
    • llmChatCompletionHelper

      protected Utterance llmChatCompletionHelper(Utterance utterance, boolean parsing)