
Security News
PEP 810 Proposes Explicit Lazy Imports for Python 3.15
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
@pipecat-ai/openai-realtime-webrtc-transport
Advanced tools
A real-time websocket transport implementation for interacting with Google's Gemini Multimodal Live API, supporting bidirectional audio and unidirectional text communication.
npm install \
@pipecat-ai/client-js \
@pipecat-ai/openai-realtime-webrtc-transport
The OpenAIRealTimeWebRTCTransport
is a fully functional RTVI Transport
. It provides a framework for implementing real-time communication directly with the OpenAI Realtime API using WebRTC voice-to-voice service. It handles media device management, audio/video streams, and state management for the connection.
import { OpenAIRealTimeWebRTCTransport, OpenAIServiceOptions } from '@pipecat-ai/openai-realtime-webrtc-transport';
const options: OpenAIServiceOptions = {
api_key: 'YOUR_API_KEY',
session_config: {
instructions: 'you are a confused jellyfish',
}
};
const transport = new OpenAIRealTimeWebRTCTransport(options);
let RTVIConfig: RTVIClientOptions = {
transport,
...
};
/**********************************
* OpenAI-specific types
* types and comments below are based on:
* gpt-4o-realtime-preview-2024-12-17
**********************************/
type JSONSchema = { [key: string]: any };
export type OpenAIFunctionTool = {
type: "function";
name: string;
description: string;
parameters: JSONSchema;
};
export type OpenAIServerVad = {
type: "server_vad";
create_response?: boolean; // defaults to true
interrupt_response?: boolean; // defaults to true
prefix_padding_ms?: number; // defaults to 300ms
silence_duration_ms?: number; // defaults to 500ms
threshold?: number; // range (0.0, 1.0); defaults to 0.5
};
export type OpenAISemanticVAD = {
type: "semantic_vad";
eagerness?: "low" | "medium" | "high" | "auto"; // defaults to "auto", equivalent to "medium"
create_response?: boolean; // defaults to true
interrupt_response?: boolean; // defaults to true
};
export type OpenAISessionConfig = Partial<{
modalities?: string;
instructions?: string;
voice?:
| "alloy"
| "ash"
| "ballad"
| "coral"
| "echo"
| "sage"
| "shimmer"
| "verse";
input_audio_noise_reduction?: {
type: "near_field" | "far_field";
} | null; // defaults to null/off
input_audio_transcription?: {
model: "whisper-1" | "gpt-4o-transcribe" | "gpt-4o-mini-transcribe";
language?: string;
prompt?: string[] | string; // gpt-4o models take a string
} | null; // we default this to gpt-4o-transcribe
turn_detection?: OpenAIServerVad | OpenAISemanticVAD | null; // defaults to server_vad
temperature?: number;
max_tokens?: number | "inf";
tools?: Array<OpenAIFunctionTool>;
}>;
export interface OpenAIServiceOptions {
api_key: string;
model?: string;
initial_messages?: LLMContextMessage[];
settings?: OpenAISessionConfig;
}
// at setup time...
llmHelper = new LLMHelper({});
rtviClient.registerHelper("llm", llmHelper);
// the 'llm' name in this call above isn't used.
//that value is specific to working with a pipecat pipeline
// at time of sending message...
// Send text prompt message
llmHelper.appendToMessages({ role: "user", content: 'Hello OpenAI!' });
The transport implements the various RTVI event handlers. Check out the docs or samples for more info.
transport.updateSessionConfig({
instructions: 'you are a an over-sharing neighbor',
input_audio_noise_reduction: {
type: 'near_field'
}
});
initialize()
: Set up the transport and establish connectionsendMessage(message)
: Send a text messagehandleUserAudioStream(data)
: Stream audio data to the modeldisconnectLLM()
: Close the connectionsendReadyMessage()
: Signal ready stateThe transport can be in one of the following states:
The transport includes comprehensive error handling for:
BSD-2 Clause
FAQs
Pipecat OpenAI RealTime Transport Package
The npm package @pipecat-ai/openai-realtime-webrtc-transport receives a total of 94 weekly downloads. As such, @pipecat-ai/openai-realtime-webrtc-transport popularity was classified as not popular.
We found that @pipecat-ai/openai-realtime-webrtc-transport demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 7 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
An opt-in lazy import keyword aims to speed up Python startups, especially CLIs, without the ecosystem-wide risks that sank PEP 690.
Security News
Socket CEO Feross Aboukhadijeh discusses the recent npm supply chain attacks on PodRocket, covering novel attack vectors and how developers can protect themselves.
Security News
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.