Search

3,276 results found for openai (3712ms)

Code
3,181

// @ts-ignore
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
// @ts-ignore
import { DOMParser } from "npm:linkedom";
// --- AI & TOOL DEFINITIONS ---
const openai = new OpenAI();
// This is the "mind" of Campy. It defines its persona, goals, and available tools.
`;
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
async function generate_talking_points(subject: string, context: string) {
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
const { messages } = await req.json();
// 1. Send the conversation to OpenAI
const response = await openai.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "system", content: CAMPY_SYSTEM_PROMPT }, ...messages],
// 4. After executing tools, let the model process the results
const secondResponse = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
join/auto/main.tsx
20 matches
import { Hono } from "npm:hono@4.4.12";
import { OpenAI } from "https://esm.town/v/std/openai";
import type { Context } from "npm:hono@4.4.12";
import { streamText } from "npm:hono/streaming";
// --- BACKEND SERVICES ---
const services = {
async callOpenAI(
systemPrompt: string,
userContent: string | object,
} = options;
const openai = new OpenAI();
const messages: any[] = [
{ role: "system", content: systemPrompt },
try {
const completion = await openai.chat.completions.create(requestPayload);
if (stream && c) {
return completion;
} catch (e) {
console.error(`Error calling OpenAI: ${e.message}`);
throw new Error("AI service failed.");
}
try {
const completion = await services.callOpenAI(
"You are a helpful assistant following strict output rules.",
prompt,
const body = await c.req.json();
const userContent = { type, ...body };
return services.callOpenAI(
config.prompts.DYNAMIC_LIST_GENERATOR,
userContent,
JSON.stringify(company_context)
}\n\nOccupation: ${occupation_title}\n\nTask: ${task}`;
return services.callOpenAI(config.prompts.PROMPT_REFINER, userContent, {
c,
isJson: true,
app.post("/api/inputs", async (c: Context) => {
const { refined_prompt } = await c.req.json<InputsBody>();
return services.callOpenAI(config.prompts.INPUT_EXTRACTOR, refined_prompt, {
c,
isJson: true,
return streamText(c, async (stream) => {
try {
const openai = new OpenAI();
const initialResponse = await openai.chat.completions.create({
model: config.models.major,
messages,
}
const finalStream = await openai.chat.completions.create({
model: config.models.major,
messages,
JSON.stringify(company_context)
}\n\nTask Briefing:\n${refined_prompt}`;
return services.callOpenAI(
config.prompts.EVALUATION_CRITERIA_GENERATOR,
userContent,
return streamText(c, async (stream) => {
try {
const openai = new OpenAI();
const initialResponse = await openai.chat.completions.create({
model: config.models.major, // Use the powerful model for evaluation
messages,
}
const finalStream = await openai.chat.completions.create({
model: config.models.major,
messages,
return streamText(c, async (stream) => {
try {
const openai = new OpenAI();
const initialResponse = await openai.chat.completions.create({
model: config.models.major,
messages,
}
const finalStream = await openai.chat.completions.create({
model: config.models.major,
messages,
const systemPrompt =
`${config.prompts.REFINER_AGENT}\n\nOutput Language: ${language}`;
return services.callOpenAI(systemPrompt, userContent, { c, stream: true });
});
},
{
"owner": "openai",
"name": "gpt-oss-120b",
"type": "text-generation",
"id": "openai/gpt-oss-120b",
"description":
7B-parameter Mixture-of-Experts (MoE) language model from OpenAI designed for high-reasoning, ag
"cover_img_url":
"https://shared.deepinfra.com/models/openai/gpt-oss-120b/cover_image.a422aaee1b1d6446e2c
"tags": [],
"pricing": {
const response = await fetch(
"https://api.deepinfra.com/v1/openai/chat/completions",
{
method: "POST",
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" },
let response;
try {
response = await fetch('https://api.groq.com/openai/v1/chat/completions', {
method: 'POST',
headers: {
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" },
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" },
// @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") {
try {
const openai = new OpenAI();
const body = await req.json();
switch (action) {
case "decide": {
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
case "cureGoal": {
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
case "reflect": {
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
const data = {
"model": "openai/gpt-4o",
"messages": [
{