upgrade to gpt-realtime-1.5
This commit is contained in:
parent
aa5d0f7403
commit
d6b79825ba
5 changed files with 6 additions and 6 deletions
|
|
@ -161,7 +161,7 @@ export async function GET(request: NextRequest) {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
},
|
},
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
model: "gpt-4o-mini-realtime-preview-2024-12-17",
|
model: "gpt-realtime-1.5",
|
||||||
instructions: systemPrompt,
|
instructions: systemPrompt,
|
||||||
voice: dbUser.personality?.oai_voice ?? "ballad",
|
voice: dbUser.personality?.oai_voice ?? "ballad",
|
||||||
}),
|
}),
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@ export async function createRealtimeConnection(
|
||||||
await pc.setLocalDescription(offer);
|
await pc.setLocalDescription(offer);
|
||||||
|
|
||||||
const baseUrl = "https://api.openai.com/v1/realtime";
|
const baseUrl = "https://api.openai.com/v1/realtime";
|
||||||
const model = "gpt-4o-realtime-preview-2024-12-17";
|
const model = "gpt-realtime-1.5";
|
||||||
|
|
||||||
const sdpResponse = await fetch(`${baseUrl}?model=${model}`, {
|
const sdpResponse = await fetch(`${baseUrl}?model=${model}`, {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
|
|
|
||||||
|
|
@ -308,7 +308,7 @@ export const connectToOpenAI = async ({
|
||||||
try {
|
try {
|
||||||
console.log(`Connecting to OpenAI...`);
|
console.log(`Connecting to OpenAI...`);
|
||||||
const sessionOptions = {
|
const sessionOptions = {
|
||||||
model: "gpt-4o-mini-realtime-preview-2024-12-17",
|
model: "gpt-realtime-1.5",
|
||||||
turn_detection: {
|
turn_detection: {
|
||||||
type: "server_vad",
|
type: "server_vad",
|
||||||
threshold: 0.4,
|
threshold: 0.4,
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ export class RealtimeAPI extends RealtimeEventHandler {
|
||||||
* @param {{model?: string}} [settings]
|
* @param {{model?: string}} [settings]
|
||||||
* @returns {Promise<true>}
|
* @returns {Promise<true>}
|
||||||
*/
|
*/
|
||||||
async connect({ model } = { model: 'gpt-4o-realtime-preview-2024-10-01' }) {
|
async connect({ model } = { model: 'gpt-realtime-1.5' }) {
|
||||||
if (!this.apiKey && this.url === this.defaultUrl) {
|
if (!this.apiKey && this.url === this.defaultUrl) {
|
||||||
console.warn(`No apiKey provided for connection to "${this.url}"`);
|
console.warn(`No apiKey provided for connection to "${this.url}"`);
|
||||||
}
|
}
|
||||||
|
|
@ -113,7 +113,7 @@ export class RealtimeAPI extends RealtimeEventHandler {
|
||||||
const wsModule = await import(/* webpackIgnore: true */ moduleName);
|
const wsModule = await import(/* webpackIgnore: true */ moduleName);
|
||||||
const WebSocket = wsModule.default;
|
const WebSocket = wsModule.default;
|
||||||
const ws = new WebSocket(
|
const ws = new WebSocket(
|
||||||
'wss://api.openai.com/v1/realtime?model=gpt-4o-realtime-preview-2024-10-01',
|
'wss://api.openai.com/v1/realtime?model=gpt-realtime-1.5',
|
||||||
[],
|
[],
|
||||||
{
|
{
|
||||||
finishRequest: (request) => {
|
finishRequest: (request) => {
|
||||||
|
|
|
||||||
|
|
@ -391,7 +391,7 @@ export class RealtimeClient extends RealtimeEventHandler {
|
||||||
* @returns {Promise<true>}
|
* @returns {Promise<true>}
|
||||||
*/
|
*/
|
||||||
async connect({
|
async connect({
|
||||||
model = 'gpt-4o-mini-realtime-preview-2024-12-17',
|
model = 'gpt-realtime-1.5',
|
||||||
turn_detection = null,
|
turn_detection = null,
|
||||||
voice,
|
voice,
|
||||||
instructions,
|
instructions,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue