Update 05- sample, sticking with generators here because they give us a lot more control over the order that things get queued.

This commit is contained in:
Moishe Lettvin
2024-01-12 10:47:03 -05:00
parent ec1f2362c5
commit ad427bea3a
4 changed files with 30 additions and 18 deletions

View File

@@ -32,6 +32,10 @@ async def main(room_url:str):
# queue two pieces of speech: one specified as a text literal,
# and one generated by an llm. We'll kick off the llm first, and let
# it generate a response while we're speaking the literal string.
#
# Note that in this case, we don't use `run_llm_async` because we're
# taking advantage of the time spent speaking the first phrase to generate
# the entire LLM response, and this happens asynchronously in a task.
llm_response_task = asyncio.create_task(llm.run_llm(
[{"role": "system", "content": "tell the user a joke about llamas"}]
))