Skip to content

Commit

Permalink
fake streaming default method
Browse files Browse the repository at this point in the history
  • Loading branch information
JarbasAl committed Feb 13, 2024
1 parent dff0cda commit e6618b9
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions ovos_plugin_manager/templates/solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def __init__(self, config=None, translator=None, *args, **kwargs):
self.translator = translator or OVOSLangTranslationFactory.create()

@staticmethod
def sentence_split(text: str, max_sentences=25):
def sentence_split(text: str, max_sentences: int=25):
return sentence_tokenize(text)[:max_sentences]

def _get_user_lang(self, context: Optional[dict] = None,
Expand Down Expand Up @@ -137,7 +137,9 @@ def stream_utterances(self, query: str,
"""streaming api, yields utterances as they become available
each utterance can be sent to TTS before we have a full answer
this is particularly helpful with LLMs"""
yield self.get_spoken_answer(query, context)
ans = self.get_spoken_answer(query, context)
for utt in self.sentence_split(ans):
yield utt

def get_data(self, query: str,
context: Optional[dict] = None) -> dict:
Expand Down

0 comments on commit e6618b9

Please sign in to comment.