Skip to content

Partially Support updateChatCtx with Phonic plugin. - #1114

Merged
toubatbrian merged 16 commits into
livekit:mainfrom
Phonic-Co:qiong/update-chat-ctx-updates
Mar 10, 2026
Merged

Partially Support updateChatCtx with Phonic plugin. #1114
toubatbrian merged 16 commits into
livekit:mainfrom
Phonic-Co:qiong/update-chat-ctx-updates

Conversation

@qionghuang6

@qionghuang6 qionghuang6 commented Mar 9, 2026

Copy link
Copy Markdown
Contributor

Description

This PR adds additional support for updateChatCtx with the Phonic plugin.
There are 2 use cases in mind:

  • Rehydrating a conversation with chat history when a RealtimeSession begins: For this use case, in situations where the config message has not yet been sent to Phonic, we include the conversation history's text content along with the roles involved as part of the system_prompt appendum being sent over to Phonic.
  • Adding system or developer messages to the conversation history. If we detect that the chatCtx has been updated to include these messages, we can send them to Phonic using the add_system_message message. This will allow the user to steer the conversation without calling generateReply

Changes Made

  • Change updateChatCtx to add an appendum to the system_message if the chat context is not empty on initialization.
  • Use llm.computeChatCtxDiff to check if there are new items in the Chat context, and call sendAddSystemMessage if a system or developer message

Video Demo

https://drive.google.com/file/d/12-6KNPaw830kCm1wm9xv3CShOycsPDAm/view?usp=sharing

Pre-Review Checklist

  • Build passes: All builds (lint, typecheck, tests) pass locally
  • AI-generated code reviewed: Removed unnecessary comments and ensured code quality
  • Changes explained: All changes are properly documented and justified above
  • Scope appropriate: All changes relate to the PR title, or explanations provided for why they're included
  • Video demo: A small video demo showing changes works as expected and did not break any existing functionality using Agent Playground (if applicable)

Testing

  • Automated tests added/updated (if applicable)
  • All tests pass
  • Make sure both restaurant_agent.ts and realtime_agent.ts work properly (for major changes)

Additional Notes


Note to reviewers: Please ensure the pre-review checklist is completed before starting your review.

@changeset-bot

changeset-bot Bot commented Mar 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c8efe5c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 21 packages
Name Type
@livekit/agents-plugin-phonic Patch
@livekit/agents Patch
@livekit/agents-plugin-anam Patch
@livekit/agents-plugin-baseten Patch
@livekit/agents-plugin-bey Patch
@livekit/agents-plugin-cartesia Patch
@livekit/agents-plugin-deepgram Patch
@livekit/agents-plugin-elevenlabs Patch
@livekit/agents-plugin-google Patch
@livekit/agents-plugin-hedra Patch
@livekit/agents-plugin-inworld Patch
@livekit/agents-plugin-lemonslice Patch
@livekit/agents-plugin-livekit Patch
@livekit/agents-plugin-neuphonic Patch
@livekit/agents-plugin-openai Patch
@livekit/agents-plugin-resemble Patch
@livekit/agents-plugin-rime Patch
@livekit/agents-plugin-sarvam Patch
@livekit/agents-plugin-silero Patch
@livekit/agents-plugin-xai Patch
@livekit/agents-plugins-test Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@qionghuang6
qionghuang6 marked this pull request as ready for review March 9, 2026 21:20
devin-ai-integration[bot]

This comment was marked as resolved.

devin-ai-integration[bot]

This comment was marked as resolved.

@toubatbrian
toubatbrian merged commit 4e5b9e3 into livekit:main Mar 10, 2026
5 checks passed
@github-actions github-actions Bot mentioned this pull request Mar 10, 2026
qionghuang6 added a commit to Phonic-Co/livekit-agents-js that referenced this pull request Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants