Introduce new helper type for acting as a liason between rtvi messages and the llm

This somewhat parallels the helper system the RTVI clients have.
This commit is contained in:
mattie ruth backman
2025-04-14 17:08:57 -04:00
parent 005c0b55b6
commit 424c2a341b
4 changed files with 226 additions and 1 deletions

View File

@@ -16,7 +16,7 @@
* - Browser with WebRTC support
*/
import { RTVIClient, RTVIEvent } from '@pipecat-ai/client-js';
import { LLMHelper, RTVIClient, RTVIEvent } from '@pipecat-ai/client-js';
import { DailyTransport } from '@pipecat-ai/daily-transport';
/**
@@ -27,6 +27,7 @@ class ChatbotClient {
constructor() {
// Initialize client state
this.rtviClient = null;
this.llmHelper = null;
this.setupDOMElements();
this.setupEventListeners();
this.initializeClientAndTransport();
@@ -127,6 +128,13 @@ class ChatbotClient {
},
});
this.llmHelper = new LLMHelper({});
rtviClient.registerHelper('llm', this.llmHelper);
// Uncomment for debugging
// window.rtviClient = this.rtviClient;
// window.llmHelper = this.llmHelper;
// Set up listeners for media track events
this.setupTrackListeners();
}