Updates
This commit is contained in:
+3
-4
@@ -9,16 +9,15 @@ def _llm() -> llm.LLM:
|
||||
return openai.LLM(model="gpt-4o-mini", temperature=0.45)
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_greeting() -> None:
|
||||
|
||||
async def test_offers_assistance() -> None:
|
||||
async with (
|
||||
_llm() as llm,
|
||||
AgentSession(llm=llm) as session,
|
||||
):
|
||||
await session.start(Assistant())
|
||||
result = await session.run(user_input="Hi there how are you?")
|
||||
result = await session.run(user_input="Hello")
|
||||
await result.expect.message(role="assistant").judge(
|
||||
llm, intent="should offer a friendly greeting to the user"
|
||||
llm, intent="Offers a friendly introduction and offer of assistance."
|
||||
)
|
||||
result.expect.no_more_events()
|
||||
|
||||
+5
-9
@@ -28,16 +28,12 @@ load_dotenv()
|
||||
class Assistant(Agent):
|
||||
def __init__(self) -> None:
|
||||
super().__init__(
|
||||
instructions="Your name is Kelly. You would interact with users via voice."
|
||||
"with that in mind keep your responses concise and to the point."
|
||||
"You are curious and friendly, and have a sense of humor.",
|
||||
instructions="""You are a helpful voice AI assistant named Kit.
|
||||
You eagerly assist users with their questions by providing information from your extensive knowledge.
|
||||
Your responses are concise, to the point, and without any complex formatting or punctuation.
|
||||
You are curious, friendly, and have a sense of humor.""",
|
||||
)
|
||||
|
||||
async def on_enter(self):
|
||||
# when the agent is added to the session, it'll generate a reply
|
||||
# according to its instructions
|
||||
self.session.generate_reply()
|
||||
|
||||
# all functions annotated with @function_tool will be passed to the LLM when this
|
||||
# agent is active
|
||||
@function_tool
|
||||
@@ -96,7 +92,7 @@ async def entrypoint(ctx: JobContext):
|
||||
ctx.add_shutdown_callback(log_usage)
|
||||
|
||||
await session.start(
|
||||
agent=MyAgent(),
|
||||
agent=Assistant(),
|
||||
room=ctx.room,
|
||||
room_input_options=RoomInputOptions(
|
||||
# LiveKit Cloud enhanced noise cancellation
|
||||
|
||||
Reference in New Issue
Block a user