Search

3,304 results found for openai (1598ms)

Code
3,209

import { Hono } from "npm:hono@4.4.12";
// @ts-ignore
import { 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-ignore
import { 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-ignore
import { 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-ignore
import { 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 configuration
const 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` array
export 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 i
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 fields
export 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(r
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(r
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 w
// Converts arbitrary text into a strict JSON object and returns the `results` array
export 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 i
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 fields
export 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(r
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(r
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 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" },