Search
Code3,209
import { Hono } from "npm:hono@4.4.12";// @ts-ignoreimport { OpenAI } from "https://esm.town/v/std/openai";import type { Context } from "npm:hono@4.4.12";import { streamText } from "npm:hono/streaming"; if (!industry) return c.json({ error: "Industry is required" }, 400); try { const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: DYNAMIC_LIST_GENERATOR_PROMPT }, { if (!occupation) return c.json({ error: "Occupation is required" }, 400); try { const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: DYNAMIC_LIST_GENERATOR_PROMPT }, { }\n\nOccupation: ${occupation_title}\n\nTask: ${task}`; try { const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: PROMPT_REFINER_SYSTEM_PROMPT }, { } try { const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: INPUT_EXTRACTOR_SYSTEM_PROMPT }, { } try { const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [ try { const openai = new OpenAI(); const agentStream = await openai.chat.completions.create({ model: "gpt-4o", messages: [{ role: "system", content: systemPromptWithContext }, { if (!raw_text) return c.json({ error: "raw_text is required" }, 400); try { const openai = new OpenAI(); const htmlCompletion = await openai.chat.completions.create({ model: "gpt-4o-mini", // Using a faster model for simple formatting messages: [{ role: "system", content: HTML_FORMATTER_SYSTEM_PROMPT }, {
// @ts-ignoreimport { OpenAI } from "https://esm.town/v/std/openai?v=4";// --- AI BEHAVIORAL GUIDELINES --- } const openai = new OpenAI(); const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [
// @ts-ignoreimport { OpenAI } from "https://esm.town/v/std/openai?v=4";// --- AI BEHAVIORAL GUIDELINES --- if (req.method === "POST" && action === "getAstrology") { try { // The user wants to use OpenAI, so we instantiate it. // NOTE: This requires the OPENAI_API_KEY environment variable to be set. const openai = new OpenAI(); const { planetaryData } = await req.json(); }`; const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [
// @ts-ignoreimport { OpenAI } from "https://esm.town/v/std/openai?v=4";// --- AI BEHAVIORAL GUIDELINES --- if (req.method === "POST" && action === "getAstrology") { try { // The user wants to use OpenAI, so we instantiate it. // NOTE: This requires the OPENAI_API_KEY environment variable to be set. const openai = new OpenAI(); const { planetaryData } = await req.json(); }`; const completion = await openai.chat.completions.create({ model: "gpt-4o", messages: [
// Settings configurationconst settings = { model: 'openai/gpt-oss-120b', stream: false, reasoningEffort: 'low' // Optionally set language or prompt here const resp = await fetch('https://api.groq.com/openai/v1/audio/transcriptions', { method: 'POST', headers: { 'Authorization': 'Bearer ' + apiKey }, language, offset = 0, model = 'openai/gpt-oss-120b', reasoning_effort = 'medium', tools = [{ type: 'browser_search' }], language, offset = 0, model = 'openai/gpt-oss-120b', reasoning_effort = 'medium', tools = [{ type: 'browser_search' }], start: async (controller) => { try { const upstream = await fetch("https://api.groq.com/openai/v1/chat/completions", { method: 'POST', headers: {
// Converts arbitrary text into a strict JSON object and returns the `results` arrayexport async function extractOrRepairJsonResults(rawText, apiKey, language = 'english') { const response = await fetch('https://api.groq.com/openai/v1/chat/completions', { method: 'POST', headers: { }, body: JSON.stringify({ model: 'openai/gpt-oss-120b', messages: [ {// This helper instructs the model to ONLY use URLs that appear in the provided text and never invent new ones.export async function extractResultsFromToolOutputs(toolText, apiKey, language = 'english') { const response = await fetch('https://api.groq.com/openai/v1/chat/completions', { method: 'POST', headers: { }, body: JSON.stringify({ model: 'openai/gpt-oss-120b', messages: [ {// Structured summary extraction to eliminate citation artifacts and enforce clean fieldsexport async function extractStructuredSummary(rawText, apiKey) { const response = await fetch('https://api.groq.com/openai/v1/chat/completions', { method: 'POST', headers: { }, body: JSON.stringify({ model: 'openai/gpt-oss-120b', messages: [ { if (reasoningText && String(reasoningText).trim()) parts.push('Reasoning text:\n' + String(reasoningText)); const response = await fetch('https://api.groq.com/openai/v1/chat/completions', { method: 'POST', headers: { }, body: JSON.stringify({ model: 'openai/gpt-oss-120b', messages: [ { if (reasoningText && String(reasoningText).trim()) parts.push('Reasoning text:\n' + String(reasoningText)); const response = await fetch('https://api.groq.com/openai/v1/chat/completions', { method: 'POST', headers: { }, body: JSON.stringify({ model: 'openai/gpt-oss-120b', messages: [ {
import "jsr:@std/dotenv/load";const API_URL = "https://api.groq.com/openai/v1/chat/completions";function getApiKey() { }, ], model: "openai/gpt-oss-120b", stream: true, reasoning_effort: "medium",
export async function groqChatCompletion(apiKey, payload) { console.log('>>> [groqChatCompletion] Payload:', payload); const response = await fetch('https://api.groq.com/openai/v1/chat/completions', { method: 'POST', headers: { try { const res = await groqChatCompletion(apiKey, { model: 'openai/gpt-oss-120b', messages: [ { role: 'system', content: 'Classify the user request as either links or text. Respond with a single token: links or text. Use links if the user appears to want a search results list of sources; use text if the user is asking for an explanation/summary/definition.' },
// Converts arbitrary text into a strict JSON object and returns the `results` arrayexport async function extractOrRepairJsonResults(rawText, apiKey, language = 'english') { const response = await fetch('https://api.groq.com/openai/v1/chat/completions', { method: 'POST', headers: { }, body: JSON.stringify({ model: 'openai/gpt-oss-120b', messages: [ {// This helper instructs the model to ONLY use URLs that appear in the provided text and never invent new ones.export async function extractResultsFromToolOutputs(toolText, apiKey, language = 'english') { const response = await fetch('https://api.groq.com/openai/v1/chat/completions', { method: 'POST', headers: { }, body: JSON.stringify({ model: 'openai/gpt-oss-120b', messages: [ {// Structured summary extraction to eliminate citation artifacts and enforce clean fieldsexport async function extractStructuredSummary(rawText, apiKey) { const response = await fetch('https://api.groq.com/openai/v1/chat/completions', { method: 'POST', headers: { }, body: JSON.stringify({ model: 'openai/gpt-oss-120b', messages: [ { if (reasoningText && String(reasoningText).trim()) parts.push('Reasoning text:\n' + String(reasoningText)); const response = await fetch('https://api.groq.com/openai/v1/chat/completions', { method: 'POST', headers: { }, body: JSON.stringify({ model: 'openai/gpt-oss-120b', messages: [ { if (reasoningText && String(reasoningText).trim()) parts.push('Reasoning text:\n' + String(reasoningText)); const response = await fetch('https://api.groq.com/openai/v1/chat/completions', { method: 'POST', headers: { }, body: JSON.stringify({ model: 'openai/gpt-oss-120b', messages: [ {
Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.### OpenAI```tsimport { 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" },
reconsumeralization
import { OpenAI } from "https://esm.town/v/std/openai";
import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
/**
* Practical Implementation of Collective Content Intelligence
* Bridging advanced AI with collaborative content creation
*/
exp
kwhinnery_openai
lost1991
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",
No docs found