From 9b06923298a22df44de681b228eb267132d28ea3 Mon Sep 17 00:00:00 2001 From: Oliver Lazoroski Date: Mon, 10 Mar 2025 12:30:51 +0100 Subject: [PATCH 1/3] fix: support realtime AI model overrides --- package.json | 4 ++-- src/StreamVideoClient.ts | 6 ++++-- yarn.lock | 8 ++++---- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index d3cf2bd..97ccf80 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "@openapitools/openapi-generator-cli": "^2.7.0", "@rollup/plugin-replace": "^5.0.2", "@rollup/plugin-typescript": "^11.1.4", - "@stream-io/openai-realtime-api": "~0.1.0", + "@stream-io/openai-realtime-api": "~0.1.1", "@types/uuid": "^9.0.4", "@typescript-eslint/eslint-plugin": "^6.4.0", "dotenv": "^16.3.1", @@ -76,7 +76,7 @@ "uuid": "^9.0.1" }, "peerDependencies": { - "@stream-io/openai-realtime-api": "~0.1.0" + "@stream-io/openai-realtime-api": "~0.1.1" }, "peerDependenciesMeta": { "@stream-io/openai-realtime-api": { diff --git a/src/StreamVideoClient.ts b/src/StreamVideoClient.ts index 8399802..12ecb28 100644 --- a/src/StreamVideoClient.ts +++ b/src/StreamVideoClient.ts @@ -3,8 +3,8 @@ import { StreamCall } from './StreamCall'; import type { StreamClient } from './StreamClient'; import type { ApiConfig } from './types'; import type { - RealtimeClient, createRealtimeClient, + RealtimeClient, } from '@stream-io/openai-realtime-api'; export class StreamVideoClient extends VideoApi { @@ -26,7 +26,8 @@ export class StreamVideoClient extends VideoApi { call: StreamCall; agentUserId: string; openAiApiKey: string; - validityInSeconds: number; + model?: Parameters[0]['model']; + validityInSeconds?: number; }): Promise => { let doCreateRealtimeClient: typeof createRealtimeClient; @@ -55,6 +56,7 @@ export class StreamVideoClient extends VideoApi { streamApiKey: this.apiConfig.apiKey, streamUserToken: token, openAiApiKey: options.openAiApiKey, + model: options.model, }); await realtimeClient.connect(); diff --git a/yarn.lock b/yarn.lock index ccba999..b746b22 100644 --- a/yarn.lock +++ b/yarn.lock @@ -488,10 +488,10 @@ resolved "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz" integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== -"@stream-io/openai-realtime-api@~0.1.0": - version "0.1.0" - resolved "https://registry.yarnpkg.com/@stream-io/openai-realtime-api/-/openai-realtime-api-0.1.0.tgz#d14db921e96dbbb5e3a71c566f920f8040ca5b55" - integrity sha512-oT6lvxH0rl+lwQLSLFz3UJRFjh/JoqbpE6GCDvOf8Jw05wmslPhrozSqdt8VkCUap+fkPI8LUPfRCWc+HgJp9Q== +"@stream-io/openai-realtime-api@~0.1.1": + version "0.1.1" + resolved "https://registry.yarnpkg.com/@stream-io/openai-realtime-api/-/openai-realtime-api-0.1.1.tgz#fe9e7404d2efa2e88bbb8dc9b8c7f52d50254d9f" + integrity sha512-gmfcy+bcPDTn78R3CHi66XLL0YbZjZP2eD8Ja/AlGiRHM3S7IP4bjeFrFBPnOngTOMYwMuSU4xOehhMwCBuh6w== dependencies: "@openai/realtime-api-beta" openai/openai-realtime-api-beta#a5cb94824f625423858ebacb9f769226ca98945f ws "^8.18.0" From 87709f01dd5f40b39991b103a0d4219a5d1a6c30 Mon Sep 17 00:00:00 2001 From: Oliver Lazoroski Date: Mon, 10 Mar 2025 12:48:22 +0100 Subject: [PATCH 2/3] fix: support realtime AI model overrides --- package.json | 4 ++-- src/StreamVideoClient.ts | 3 ++- yarn.lock | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 97ccf80..bd6f0ea 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "@openapitools/openapi-generator-cli": "^2.7.0", "@rollup/plugin-replace": "^5.0.2", "@rollup/plugin-typescript": "^11.1.4", - "@stream-io/openai-realtime-api": "~0.1.1", + "@stream-io/openai-realtime-api": "~0.1.3", "@types/uuid": "^9.0.4", "@typescript-eslint/eslint-plugin": "^6.4.0", "dotenv": "^16.3.1", @@ -76,7 +76,7 @@ "uuid": "^9.0.1" }, "peerDependencies": { - "@stream-io/openai-realtime-api": "~0.1.1" + "@stream-io/openai-realtime-api": "~0.1.3" }, "peerDependenciesMeta": { "@stream-io/openai-realtime-api": { diff --git a/src/StreamVideoClient.ts b/src/StreamVideoClient.ts index 12ecb28..1a42f40 100644 --- a/src/StreamVideoClient.ts +++ b/src/StreamVideoClient.ts @@ -4,6 +4,7 @@ import type { StreamClient } from './StreamClient'; import type { ApiConfig } from './types'; import type { createRealtimeClient, + RealtimeAPIModel, RealtimeClient, } from '@stream-io/openai-realtime-api'; @@ -26,7 +27,7 @@ export class StreamVideoClient extends VideoApi { call: StreamCall; agentUserId: string; openAiApiKey: string; - model?: Parameters[0]['model']; + model?: RealtimeAPIModel; validityInSeconds?: number; }): Promise => { let doCreateRealtimeClient: typeof createRealtimeClient; diff --git a/yarn.lock b/yarn.lock index b746b22..019f145 100644 --- a/yarn.lock +++ b/yarn.lock @@ -488,10 +488,10 @@ resolved "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz" integrity sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA== -"@stream-io/openai-realtime-api@~0.1.1": - version "0.1.1" - resolved "https://registry.yarnpkg.com/@stream-io/openai-realtime-api/-/openai-realtime-api-0.1.1.tgz#fe9e7404d2efa2e88bbb8dc9b8c7f52d50254d9f" - integrity sha512-gmfcy+bcPDTn78R3CHi66XLL0YbZjZP2eD8Ja/AlGiRHM3S7IP4bjeFrFBPnOngTOMYwMuSU4xOehhMwCBuh6w== +"@stream-io/openai-realtime-api@~0.1.3": + version "0.1.3" + resolved "https://registry.yarnpkg.com/@stream-io/openai-realtime-api/-/openai-realtime-api-0.1.3.tgz#4a77eac5e58b4d7980958820690687a0edf3986d" + integrity sha512-kB3BMW2CYAHF+SrswUvaJmwVlOOK3MZYBW9oR4Q9HGpzS0gEGP/feGsqt5M37/0gJ6A5mOoBA26TcnHmaA39dA== dependencies: "@openai/realtime-api-beta" openai/openai-realtime-api-beta#a5cb94824f625423858ebacb9f769226ca98945f ws "^8.18.0" From 26b90f8ee2a042167167814ee34421ff925eae3e Mon Sep 17 00:00:00 2001 From: Oliver Lazoroski Date: Mon, 10 Mar 2025 13:22:41 +0100 Subject: [PATCH 3/3] chore: adjust test assertion --- __tests__/call.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/__tests__/call.test.ts b/__tests__/call.test.ts index 3b0749f..96d7efb 100644 --- a/__tests__/call.test.ts +++ b/__tests__/call.test.ts @@ -144,7 +144,7 @@ describe('call API', () => { session: '', }), ).rejects.toThrowError( - `Stream error code 16: GetCallStats failed with error: "call report not found for cid:default:${callId} session_id:"`, + `Stream error code 16: GetCallStats failed with error: "call session not found"`, ); });