textToAudioPlayertts.ts1 match
35console.log("🔊 Sending request to Groq Speech API");
36const start = Date.now();
37const response = await fetch("https://api.groq.com/openai/v1/audio/speech", {
38method: "POST",
39headers: {
SimpleAudioPlayerPWAapp.tsx4 matches
291}
292
293// Using the OpenAI standard library for TTS
294const { OpenAI } = await import("https://esm.town/v/std/openai");
295const openai = new OpenAI();
296
297const mp3 = await openai.audio.speech.create({
298model: "tts-1",
299voice: voice || "alloy",
23## Voice Options
2425The app uses OpenAI's Text-to-Speech API with these voices:
2627- Alloy - Neutral, versatile voice
SimpleAudioPlayerPWAindex.ts4 matches
223const { text, voice } = await request.json();
224
225// Using the OpenAI standard library for TTS
226const { OpenAI } = await import("https://esm.town/v/std/openai");
227const openai = new OpenAI();
228
229const mp3 = await openai.audio.speech.create({
230model: "tts-1",
231voice: voice || "alloy",
1// List of available voices for OpenAI TTS API
2export const voices = [
3{ id: "alloy", name: "Alloy", description: "Neutral, versatile voice" },
SimpleAudioPlayerindex.ts4 matches
190const { text } = await request.json();
191
192// Using the OpenAI standard library for TTS
193const { OpenAI } = await import("https://esm.town/v/std/openai");
194const openai = new OpenAI();
195
196const mp3 = await openai.audio.speech.create({
197model: "tts-1",
198voice: "alloy",
14const urls = [
15"https://console.groq.com/docs/quickstart",
16"https://console.groq.com/docs/openai",
17"https://console.groq.com/docs/models",
18"https://console.groq.com/docs/rate-limits",
ItalianBrainRotGeneratormain.tsx5 matches
128if (url.pathname === "/generate-character") {
129try {
130const { OpenAI } = await import("https://esm.town/v/std/openai");
131const openai = new OpenAI();
132133// Define the Italian Brainrot character templates based on popular examples
158Create a character that perfectly fits this absurd meme universe without mentioning any specific brands or companies in the description.`;
159160const nameCompletion = await openai.chat.completions.create({
161messages: [
162{ role: "system", content: brainrotSystemPrompt },
169const characterName = nameCompletion.choices[0].message.content.trim();
170171const descriptionCompletion = await openai.chat.completions.create({
172messages: [
173{ role: "system", content: brainrotSystemPrompt },
187188// Get a viral catchphrase
189const catchphraseCompletion = await openai.chat.completions.create({
190messages: [
191{ role: "system", content: brainrotSystemPrompt },
MyStevenssendDailyBrief.ts9 matches
1import { Bot } from "https://deno.land/x/grammy@v1.35.0/mod.ts";
2import { DateTime } from "https://esm.sh/luxon@3.4.4";
3import { OpenAI } from "npm:openai";
4import { backstory } from "../backstory.ts";
5import {
13} from "../memoryUtils.ts";
1415async function generateBriefingContent(openai, memories, today, isSunday) {
16try {
17const weekdaysHelp = generateWeekDays(today);
74};
7576console.log("Sending prompt to openai...", userMessage);
7778const response = await openai.messages.create({
79model: "claude-3-7-sonnet-latest",
80max_tokens: 30000,
98export async function sendDailyBriefing(chatId?: string, today?: DateTime) {
99// Get API keys from environment
100const apiKey = Deno.env.get("OPENAI_API_KEY");
101const telegramToken = Deno.env.get("TELEGRAM_TOKEN");
102107108if (!apiKey) {
109console.error("openai API key is not configured.");
110return;
111}
121}
122123// Initialize openai client
124const openai = new OpenAI({ apiKey });
125126// Initialize Telegram bot
145// Generate briefing content
146const content = await generateBriefingContent(
147openai,
148memories,
149today,
1import { fetch } from "https://esm.town/v/std/fetch";
2import { OpenAI } from "https://esm.town/v/std/openai";
3import { z } from "npm:zod";
4666}
667668async function callOpenAI(
669systemPrompt: string,
670userPrompt: string,
675log(
676"DEBUG",
677"callOpenAI",
678`Calling OpenAI for task ${taskId}`,
679{ sysLen: systemPrompt.length, usrLen: userPrompt.length },
680mandateId,
682);
683try {
684const openai = new OpenAI();
685const completion = await openai.chat.completions.create({
686model: "gpt-4o-mini",
687messages: [{ role: "system", content: systemPrompt }, { role: "user", content: userPrompt }],
692const usage = completion.usage;
693if (!resultText) {
694log("WARN", "callOpenAI", `OpenAI returned no content for task ${taskId}.`, { usage }, mandateId, taskId);
695return null;
696}
697log(
698"DEBUG",
699"callOpenAI",
700`OpenAI call successful for task ${taskId}`,
701{ resLen: resultText.length, usage },
702mandateId,
706} catch (error) {
707const errorDetails = { msg: error.message, name: error.name, status: error.status, type: error.type };
708log("ERROR", "callOpenAI", `OpenAI API call failed for task ${taskId}`, { error: errorDetails }, mandateId, taskId);
709throw new Error(`OpenAI API error: ${error.message}`);
710}
711}
1096`Please generate the ${payload.contentType} for ${payload.platform} based on the details provided in the system prompt.`;
1097try {
1098const generatedContent = await callOpenAI(systemPrompt, userPrompt, mandateId, taskId, log);
1099if (!generatedContent) {
1100log("WARN", "ContentCreationAgent", `LLM returned no content for task ${taskId}`, undefined, mandateId, taskId);
1154const userPrompt = `Please develop the marketing strategy based on the details provided in the system prompt.`;
1155try {
1156const strategyContent = await callOpenAI(systemPrompt, userPrompt, mandateId, taskId, log);
1157if (!strategyContent) {
1158log("WARN", "MarketingStrategyAgent", `LLM returned no content for task ${taskId}`, undefined, mandateId, taskId);
1217const userPrompt = `Generate logo concepts for "${payload.businessName}" based on the details in the system prompt.`;
1218try {
1219const conceptContent = await callOpenAI(systemPrompt, userPrompt, mandateId, taskId, log);
1220if (!conceptContent) {
1221log("WARN", "LogoConceptAgent", `LLM returned no content for task ${taskId}`, undefined, mandateId, taskId);
1283`Build the brand identity guide for "${payload.businessName}" based on the details in the system prompt.`;
1284try {
1285const identityContent = await callOpenAI(systemPrompt, userPrompt, mandateId, taskId, log);
1286if (!identityContent) {
1287log("WARN", "BrandIdentityAgent", `LLM returned no content for task ${taskId}`, undefined, mandateId, taskId);
1333const userPrompt = `Run the ${payload.simulationType} simulation using the parameters provided in the system prompt.`;
1334try {
1335const simContent = await callOpenAI(systemPrompt, userPrompt, mandateId, taskId, log);
1336if (!simContent) {
1337log("WARN", "SimulationAgent", `LLM returned no content for task ${taskId}`, undefined, mandateId, taskId);
1384`Generate or refine the system prompt based on my request provided in the system prompt context.`;
1385try {
1386const genSysPrompt = await callOpenAI(systemPromptForMeta, userPromptForMeta, mandateId, taskId, log);
1387if (!genSysPrompt) {
1388log("WARN", "MetaPromptAgent", `LLM returned no content for task ${taskId}`, undefined, mandateId, taskId);