Search

4,005 results found for openai (8645ms)

Code
3,901

<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>OpenAI Realtime API Voice Agent</title>
<style>
:root {
const NR_TYPE = "near_field";
const INSTRUCTIONS = `
the user in English and tell them that they're using the OpenAI Realtime API, powered by the {{
Give them a very brief summary of the benefits of the Realtime API based on the headline below
and then ask if they have any questions.
- higher audio quality
- improved handling of alphanumerics (eg, properly understanding credit card and phone numbers
- support for the OpenAI Prompts API
- support for MCP-based tools
- auto-truncation to reduce context size
// @ts-ignore
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
// --- TYPE DEFINITIONS ---
<div id="start-overlay" class="fixed inset-0 bg-gray-900/80 backdrop-blur-sm z-20 flex flex-
<h1 class="text-4xl font-bold mb-4">✨ AI & Gesture Controlled Robotic Arm ✨</h1>
his demo uses your webcam for real-time hand tracking and OpenAI for autonomous control. Please
<button id="start-camera-btn" class="px-8 py-4 bg-pink-600 text-white font-bold rounded-
<p class="text-sm text-gray-500 mt-6">Powered by Val Town, Three.js & MediaPipe</p>
if (req.method === "POST" && action === "choreograph") {
try {
const openai = new OpenAI();
const body = await req.json();
const goal = body.goal;
];
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: messages,
// @ts-ignore
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
// @ts-ignore
import { blob } from "https://esm.town/v/std/blob?v=11";
const MAX_DEPTH = 4;
const CROSS_EXAMINE_DEPTH_INTERVAL = 2;
const openai = new OpenAI();
const INDEX_KEY = "totem_index";
}
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
<script>
console.log(window.openai);
debugger;
const bEl = document.getElementById("bEl");
window.addEventListener("openai:set_globals", (event) => {
const value = event.detail.globals['toolOutput'];
console.log('set_globals', event.detail.globals);
}
const { a, b, answer} = window.openai.toolOutput;
const answerEl = document.getElementById("answerEl");
aEl.value = a;
button.onclick = async () => {
// don't add them in JS, call the tool.
const response = await window.openai.callTool('add', {a: Number(aEl.value), b: Number(bEl.value
console.log(response);
const { a, b, answer} = response.structuredContent;
"Adds two numbers together (a and b) and stores them in the 'answer' field.",
_meta: {
"openai/outputTemplate": "ui://widget/add.html",
"openai/toolInvocation/invoking": "Displaying the adder",
"openai/toolInvocation/invoked": "Displayed the adder",
"openai/widgetAccessible": true,
},
inputSchema: { a: z.number(), b: z.number() },
apiKeyInput: '',
// Model selection
selectedModel: 'openai/gpt-oss-120b',
// Browser search tool toggle
useBrowserSearch: true,
model: this.selectedModel,
reasoning_effort: this.reasoningEffort,
= !!(this.selectedModel && this.selectedModel.startsWith('openai/gpt-oss')); if (isOss) { if (th
temperature: this.temperature,
...(this.maxTokens ? { max_tokens: this.maxTokens } : {}),
model: this.selectedModel,
reasoning_effort: this.reasoningEffort,
= !!(this.selectedModel && this.selectedModel.startsWith('openai/gpt-oss')); if (isOss) { if (th
temperature: this.temperature,
...(this.maxTokens ? { max_tokens: this.maxTokens } : {}),
<div class="relative">
<select id="preset-model-new" x-model="newPresetSettings.selectedModel" class=
<option value="openai/gpt-oss-120b">openai/gpt-oss-120b</option>
<option value="openai/gpt-oss-20b">openai/gpt-oss-20b</option>
<option value="llama-3.1-8b-instant">llama-3.1-8b-instant</option>
<option value="llama-3.3-70b-versatile">llama-3.3-70b-versatile</option>
<div class="relative">
<select id="preset-model-select" x-model="editingPresetSettings.selected
<option value="openai/gpt-oss-120b">openai/gpt-oss-120b</option>
<option value="openai/gpt-oss-20b">openai/gpt-oss-20b</option>
<option value="llama-3.1-8b-instant">llama-3.1-8b-instant</option>
<option value="llama-3.3-70b-versatile">llama-3.3-70b-versatile</optio
<div class="relative">
<select x-model="selectedModel" @change="onModelChange()" class="px-2 py-1 pr-8
<option value="openai/gpt-oss-120b">openai/gpt-oss-120b</option>
<option value="openai/gpt-oss-20b">openai/gpt-oss-20b</option>
<option value="llama-3.1-8b-instant">llama-3.1-8b-instant</option>
<option value="llama-3.3-70b-versatile">llama-3.3-70b-versatile</option>
<span>JSON mode</span>
</label>
y-300" x-show="selectedModel && selectedModel.startsWith('openai/gpt-oss')">
<input type="checkbox" x-model="useBrowserSearch" @change="onUseBrowserSearchCha
<span>browser search</span>
</label>
y-300" x-show="selectedModel && selectedModel.startsWith('openai/gpt-oss')">
<input type="checkbox" x-model="useCodeInterpreter" @change="onUseCodeInterprete
<span>code interpreter</span>
<div class="relative">
<select x-model="selectedModel" @change="onModelChange()" class="px-2 py-1 pr-8
<option value="openai/gpt-oss-120b">openai/gpt-oss-120b</option>
<option value="openai/gpt-oss-20b">openai/gpt-oss-20b</option>
<option value="llama-3.1-8b-instant">llama-3.1-8b-instant</option>
<option value="llama-3.3-70b-versatile">llama-3.3-70b-versatile</option>
<span>JSON mode</span>
</label>
xt-xs" x-show="selectedModel && selectedModel.startsWith('openai/gpt-oss')">
<input type="checkbox" x-model="useBrowserSearch" @change="onUseBrowserSearchCha
<span>browser search</span>
</label>
xt-xs" x-show="selectedModel && selectedModel.startsWith('openai/gpt-oss')">
<input type="checkbox" x-model="useCodeInterpreter" @change="onUseCodeInterprete
<span>code interpreter</span>
Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to cre
### OpenAI
```ts
import { OpenAI } from "https://esm.town/v/std/openai";
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
messages: [
{ role: "user", content: "Say hello in a creative way" },