equitableMaroonCrabmain.tsx3 matches
1export default async function (e: Email) {
2const { OpenAI } = await import("https://esm.town/v/std/openai");
3const openai = new OpenAI();
45const skinkDescription = await openai.chat.completions.create({
6messages: [
7{
OpenTowniesystem_prompt.txt4 matches
137Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.
138139### OpenAI
140```ts
141import { OpenAI } from "https://esm.town/v/std/openai";
142const openai = new OpenAI();
143const completion = await openai.chat.completions.create({
144messages: [
145{ role: "user", content: "Say hello in a creative way" },
confidentWhiteOxmain.tsx3 matches
1import { OpenAI } from "https://esm.town/v/std/openai";
23const openai = new OpenAI();
45const completion = await openai.chat.completions.create({
6messages: [
7{
rousingBronzeMandrillmain.tsx4 matches
112113try {
114const { OpenAI } = await import("https://esm.town/v/std/openai");
115const openai = new OpenAI();
116117const parseResponse = await openai.chat.completions.create({
118messages: [{
119role: "system",
128129const parsedQuery = parseResponse.choices[0].message.content || '';
130Logger.log('OpenAI parsed query', { parsedQuery });
131132const [rootNode, context] = parsedQuery.split('|').map(s => s.trim());
EchoPromptermain.tsx9 matches
936if (typeof document !== "undefined") { client(); }
937export default async function server(request: Request): Promise<Response> {
938const { OpenAI } = await import("https://esm.town/v/std/openai");
939const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
940const openai = new OpenAI();
941942// Use the val's URL as a unique key for database tables
1039const echoPrompt = getEchoPrompt();
10401041const completion = await openai.chat.completions.create({
1042messages: [
1043{
10951096// First, generate the agent prompt
1097const completion2 = await openai.chat.completions.create({
1098messages: [
1099{
11211122// Then, generate commands for the agent based on its purpose and description
1123const commandsCompletion = await openai.chat.completions.create({
1124messages: [
1125{
1227}
12281229// Format the history into OpenAI message format
1230const messages = [
1231{
1237// Add conversation history if it exists
1238if (history && history.length > 0) {
1239// Filter out system messages and map to OpenAI format
1240history.forEach(msg => {
1241if (msg.role !== "system") {
12551256// Chat with the agent using the stored prompt and history
1257const completion = await openai.chat.completions.create({
1258messages: messages,
1259model: "gpt-4o-mini",
13741375// Execute the command with the AI
1376const completion = await openai.chat.completions.create({
1377messages: messages,
1378model: "gpt-4o-mini",
Blindaccessmain.tsx7 matches
2import React, { useState, useEffect, useContext, createContext } from "https://esm.sh/react@18.2.0";
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4import { OpenAI } from "https://esm.town/v/std/openai";
56// Accessibility Utilities
71const generateAIResponse = async (text) => {
72try {
73const openai = new OpenAI();
74const completion = await openai.chat.completions.create({
75messages: [
76{ role: "system", content: "أنت مساعد ذكي مخصص للمكفوفين، مهمتك تقديم مساعدة شاملة وداعمة" },
140const imageData = canvas.toDataURL('image/jpeg');
141
142const openai = new OpenAI();
143const response = await openai.chat.completions.create({
144model: "gpt-4o-mini",
145messages: [
230231try {
232const openai = new OpenAI();
233const routeResponse = await openai.chat.completions.create({
234model: "gpt-4o-mini",
235messages: [
groqAudioChattts.ts1 match
26console.log("🔊 Sending request to Groq Speech API");
27const start = Date.now();
28const response = await fetch("https://api.groq.com/openai/v1/audio/speech", {
29method: "POST",
30headers: {
groqAudioChatchat.ts1 match
20console.log("🔵 Sending request to Groq API");
21const start = Date.now();
22const response = await fetch("https://api.groq.com/openai/v1/chat/completions", {
23method: "POST",
24headers: {
groqAudioChataudio.ts1 match
63console.log("🎤 Sending request to Groq Whisper API");
64const start = Date.now();
65const response = await fetch("https://api.groq.com/openai/v1/audio/transcriptions", {
66method: "POST",
67headers: {
extractRecipeAImain.tsx3 matches
198199app.post("/extract-recipe", async (c) => {
200const { OpenAI } = await import("https://esm.town/v/std/openai");
201const openai = new OpenAI();
202203const formData = await c.req.formData();
224225try {
226const response = await openai.chat.completions.create({
227model: "gpt-4o",
228messages: [