Skip to content

Commit 157dbaa

Browse files
committed
address comments
1 parent bbaada3 commit 157dbaa

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

plugins/openai/src/realtime/realtime_model.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -722,10 +722,12 @@ export class RealtimeSession extends llm.RealtimeSession {
722722
}
723723
}
724724

725+
const isLegacyAzure =
726+
this.oaiRealtimeModel._options.isAzure && !!this.oaiRealtimeModel._options.apiVersion;
725727
return {
726728
type: 'session.update',
727729
session: {
728-
type: 'realtime',
730+
...(!isLegacyAzure && { type: 'realtime' }),
729731
model: this.oaiRealtimeModel._options.model,
730732
tools: oaiTools,
731733
},
@@ -734,11 +736,13 @@ export class RealtimeSession extends llm.RealtimeSession {
734736
}
735737

736738
async updateInstructions(_instructions: string): Promise<void> {
739+
const isLegacyAzure =
740+
this.oaiRealtimeModel._options.isAzure && !!this.oaiRealtimeModel._options.apiVersion;
737741
const eventId = shortuuid('instructions_update_');
738742
this.sendEvent({
739743
type: 'session.update',
740744
session: {
741-
type: 'realtime',
745+
...(!isLegacyAzure && { type: 'realtime' }),
742746
instructions: _instructions,
743747
},
744748
event_id: eventId,
@@ -754,8 +758,10 @@ export class RealtimeSession extends llm.RealtimeSession {
754758
return;
755759
}
756760

761+
const isLegacyAzure =
762+
this.oaiRealtimeModel._options.isAzure && !!this.oaiRealtimeModel._options.apiVersion;
757763
const options: api_proto.SessionUpdateEvent['session'] = {
758-
type: 'realtime',
764+
...(!isLegacyAzure && { type: 'realtime' }),
759765
};
760766

761767
this.oaiRealtimeModel._options.toolChoice = toolChoice;
@@ -1876,7 +1882,7 @@ function openAIItemToLivekitItem(item: api_proto.ItemResource): llm.ChatItem {
18761882
// item.content can be a single object or an array; normalize to array
18771883
const contents = Array.isArray(item.content) ? item.content : [item.content];
18781884
for (const c of contents) {
1879-
if (c.type === 'text' || c.type === 'input_text') {
1885+
if (c.type === 'text' || c.type === 'input_text' || c.type === 'output_text') {
18801886
content.push(c.text);
18811887
} else if (c.type === 'input_image' && (c as api_proto.InputImageContent).image_url) {
18821888
content.push(

0 commit comments

Comments
 (0)