Search

3,374 results found for openai (3808ms)

Code
3,279

import { fetch } from "https://esm.town/v/std/fetch";
import { OpenAI } from "https://esm.town/v/std/openai";
import { z } from "npm:zod";
}
// --- OpenAI Call Wrapper (MODIFIED to enable JSON mode) ---
async function callOpenAI(
sysP: string,
userP: string,
log("DB", "oai", `Call tid=${tid}`, { spL: sysP.length, upL: userP.length }, mid, tid);
try {
const oai = new OpenAI();
const comp = await oai.chat.completions.create({
model: "gpt-4o-mini",
try {
const { sys, user } = cfg.p(p);
const rawC = await callOpenAI(sys, user, mid, tid, log);
if (!rawC) {
log("WN", cfg.n, `No LLM content tid=${tid}.`, {}, mid, tid);
},
{
"title": "An Introduction to OpenAI fine-tuning",
"slug": "an-introduction-to-openai-fine-tuning",
"link": "/blog/an-introduction-to-openai-fine-tuning",
"description": "How to customize OpenAI to your liking",
"pubDate": "Fri, 25 Aug 2023 00:00:00 GMT",
"author": "Steve Krouse",
"slug": "val-town-newsletter-16",
"link": "/blog/val-town-newsletter-16",
"description": "Our seed round, growing team, Codeium completions, @std/openai, and more",
"pubDate": "Mon, 22 Apr 2024 00:00:00 GMT",
"author": "Steve Krouse",
import { Hono } from "https://esm.sh/hono@3.11.7";
import { OpenAI } from "https://esm.town/v/std/openai";
import { getAllTools, getToolsByCategory, getToolById, searchTools } from "../database/queries";
import { AITool, SearchRequest, ToolCategory } from "../../shared/types";
const api = new Hono();
const openai = new OpenAI();
// Get all tools
const allTools = await getAllTools();
// Use OpenAI to analyze the query and recommend tools
const aiResponse = await openai.chat.completions.create({
model: "gpt-4o-mini",
messages: [
- Frontend: React with Tailwind CSS
- Backend: Hono API framework
- AI: OpenAI for query understanding and tool recommendations
- Database: SQLite for tool information storage
import React, { useState, useEffect, useCallback } from "https://esm.sh/react@18.2.0";
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
import { OpenAI } from "https://esm.town/v/std/openai";
// Enhanced subjects with more detailed metadata
export default async function server(request: Request): Promise<Response> {
const { OpenAI } = await import("https://esm.town/v/std/openai");
const openai = new OpenAI();
if (request.method === 'POST') {
if (request.url.includes('/generate-question')) {
try {
const completion = await openai.chat.completions.create({
messages: [
{
const incomingMsg = formData.get("Body")?.toString();
// Send the SMS text to OpenAI
const response = await fetch("https://api.openai.com/v1/chat/completions", {
method: "POST",
headers: {
Authorization: `Bearer ${Deno.env.get("OPENAI_API_KEY")}`,
"Content-Type": "application/json",
},
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" },
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" },