This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { customsearch } from '@googleapis/customsearch'; | |
| const API_KEY = process.env.CSE_API_KEY ?? ''; | |
| const ENGINE_ID = process.env.CSE_ENGINE_ID ?? ''; | |
| export async function webSearch({ query }: { query: string }) { | |
| console.log('Web Search:', query); | |
| const api = customsearch({ | |
| auth: API_KEY, | |
| version: 'v1' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import WebSocket from 'ws'; | |
| import { spawn } from 'child_process'; | |
| const url = 'wss://api.openai.com/v1/realtime?model=gpt-4o-realtime-preview-2024-10-01'; | |
| const ws = new WebSocket(url, { | |
| headers: { | |
| 'Authorization': 'Bearer ' + process.env.OPENAI_API_KEY, | |
| 'OpenAI-Beta': 'realtime=v1' | |
| } | |
| }); |