aloof-scooter-47164
09/11/2025, 8:09 PMtall-airline-16756
09/11/2025, 8:09 PMtall-airline-16756
09/11/2025, 8:09 PMsession.history
property to access the full conversation history during a session. This gives you a complete record of the chat, which is really handy.
• OpenAI Realtime API: When the conversation.created
event occurs, it includes a ConversationResource
object with an id
field. This ID is your conversation ID, making it easy to track.
• Azure OpenAI Realtime API: Just like with OpenAI, the conversation.created
event provides a ConversationResource
that contains the conversation ID.
To keep everything safe and accessible, I recommend saving the conversation ID and history during session shutdown using callbacks. If you'd like, I can walk you through how to implement any of these methods—just let me know!aloof-scooter-47164
09/11/2025, 8:11 PMtall-airline-16756
09/11/2025, 8:12 PMconversation.created
event and save the conversation ID. Here's a simple way to do it:
1. First, set up an event listener in your application for the conversation.created
event. This event fires whenever a new conversation is created.
2. When this event happens, you'll receive a ConversationResource
object. Inside this object, you'll find the id
field—that's the conversation ID you want to save.
3. Next, save this id
to your preferred storage, like a database or a file, so you can easily access it later.
If you'd like, I can provide some specific code examples or guide you through the implementation. Just let me know which platform you're working with—whether it's LiveKit, OpenAI, or Azure OpenAI—and I'll be glad to assist you further!tall-airline-16756
09/11/2025, 8:12 PMconversation.created
event and save the conversation ID, you can set up an event listener in your application. Let me guide you through it step-by-step:
Python Example:
from livekit import agents
from livekit.plugins import openai
# Create a RealtimeModel instance with your OpenAI API key
oai_model = openai.realtime.RealtimeModel(api_key="your_openai_api_key")
# Create a session
session = oai_model.session()
# Define the event listener for server events
@session.on("openai_server_event_received")
def on_server_event_received(event):
# Check if the event is conversation.created
if event["type"] == "conversation.created":
conversation = event["conversation"]
print(f"Conversation created: {conversation['id']}")
Node.js Example:
import { RealtimeModel } from '@livekit/agents-js/plugins/openai';
// Create a RealtimeModel instance with your OpenAI API key
const oaiModel = new RealtimeModel({ apiKey: "your_openai_api_key" });
// Create a session
const session = oaiModel.session();
// Define the event listener for server events
session.on('openai_server_event_received', (event) => {
// Check if the event is conversation.created
if (event.type === 'conversation.created') {
const conversation = event.conversation;
console.log(`Conversation created: ${conversation.id}`);
}
});
Just a quick reminder to replace your_openai_api_key
with your actual API key. If you run into any questions or need a hand with this setup, please don’t hesitate to reach out—I’m here to help!
Sources: livekit-plugins/livekit-plugins-google/livekit/plugins/google/beta/realtime... | OpenAI Realtime API integration guide | LiveKit Docs | Azure OpenAI Realtime API and LiveKit | LiveKit Docs | plugins/openai/src/realtime/realtime_model.tsaloof-scooter-47164
09/11/2025, 8:41 PMtall-airline-16756
09/11/2025, 8:42 PM