Search

3,261 results found for ā€œopenaiā€ (1616ms)

Code
3,166

// @ts-ignore
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
import { Hono } from "npm:hono@4.4.12";
import { evaluate } from "npm:mathjs"; // Safe math evaluation library
// --- CORE LOGIC WITH TOOL SUPPORT (No changes) ---
async function callAgentWithTools<T>(
openai: OpenAI,
systemPrompt: string,
userContent: string,
];
const response = await openai.chat.completions.create({
model: "gpt-4o",
messages: messages,
}
const finalResponse = await openai.chat.completions.create({
model: "gpt-4o",
messages: messages,
}`;
const openai = new OpenAI();
const result = await callAgentWithTools(
openai,
agentConfig.systemPrompt,
agentInput,
// @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";
if (req.method === "POST" && action === "classify") {
try {
const openai = new OpenAI();
const body = await req.json();
}
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
// @ts-nocheck
import { Hono } from "npm:hono@4.4.12";
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
import { blob } from "https://esm.town/v/std/blob?v=11";
if (!rawGoal) return c.json({ error: "Goal content is required" }, 400);
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
if (allSubtasksComplete) {
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
know/agro/main.ts
3 matches
// @ts-ignore
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
import { Hono } from "npm:hono@4.4.12";
app.post("/api/analyze", async (c) => {
try {
const openai = new OpenAI();
const body = await c.req.json();
const { polygon, stage } = body;
}. The current vine growth stage is: "${stage}".`;
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
const REALTIME_BASE_URL = "https://api.openai.com/v1/realtime";
const OPENAI_API_KEY = Deno.env.get("OPENAI_API_KEY");
if (!OPENAI_API_KEY) {
throw new Error("šŸ”“ OpenAI API key not configured");
}
export function makeHeaders(contentType?: string) {
const obj: Record<string, string> = {
Authorization: `Bearer ${OPENAI_API_KEY}`,
};
if (contentType) obj["Content-Type"] = contentType;
sip.post("/", async (c) => {
// Verify the webhook.
const OPENAI_SIGNING_SECRET = Deno.env.get("OPENAI_SIGNING_SECRET");
if (!OPENAI_SIGNING_SECRET) {
console.error("šŸ”“ webhook secret not configured");
return c.text("Internal error", 500);
}
const webhook = new Webhook(OPENAI_SIGNING_SECRET);
const bodyStr = await c.req.text();
let callId: string | undefined;
# hello-realtime
**Hello Realtime** is a OpenAI Realtime app that supports both WebRTC and SIP
(telephone) users. You can access the app via WebRTC at
[hello-realtime.val.run](https://hello-realtime.val.run), or via SIP by calling
server-side websocket interface.
If you remix the app, you'll just need to pop in your own `OPENAI_API_KEY` (from
[platform.openai.com](https://platform.openai.com)), and if you want SIP, the
`OPENAI_SIGNING_SECRET`.
## Architecture
- Browser connects to frontend
- creates WebRTC offer
- `/rtc` endpoint handles SDP negotiation with OpenAI
- observer established to monitor session
2. **SIP Flow**:
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>OpenAI Realtime API Voice Agent</title>
<style>
:root {
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" },
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" },
…
6
…
Next