-
Notifications
You must be signed in to change notification settings - Fork 1.3k
brianyin/agt-1946-built-in-dtmf-support #3490
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
from livekit.agents.llm import function_tool | ||
|
||
|
||
class DtmfEvent(str, Enum): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use enum to have strict tool schema instead of raw string
|
||
|
||
@function_tool | ||
async def send_dtmf_events( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For now I'll wait for ToolSet
class: https://github.com/livekit/agents/pull/3296/files#diff-f443ca72981c01a0780b2742eef4232b4a313c99d36f462900034b138df2c016. And convert those function_tool into ToolSet
class once done.
But the general idea is that we expose 2 tools in the toolsets, one allows pressing a single digit and the other one allows pressing a sequence (which may be a usage pattern so agent only need one tool call to handle multiple dtmf events)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need 2 tools? The LLM could also just use a single element list?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I think that also work
for event in events: | ||
try: | ||
code = dtmf_event_to_code(event) | ||
await job_ctx.room.local_participant.publish_dtmf(code=code, digit=event.value) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For sending a sequence, not sure if we want to add a sleep between each. @theomonnom
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I don’t think we need to sleep
class DtmfAgent(Agent): | ||
def __init__(self) -> None: | ||
super().__init__( | ||
instructions="You are a voice assistant that can press number on the phone to interact with the user or a IVR system.", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will improving the system message
No description provided.