Search

4,018 results found for openai (2246ms)

Code
3,914

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" },
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
object: "model",
created: 1677610602,
owned_by: "openai",
},
// --- 用户指定的未来/占位模型 ---
// 3. 正常对话逻辑
// 只有在不是请求模型列表时,才初始化 OpenAI,避免缺少 Key 导致报错
const openai = new OpenAI();
let body;
try {
const completion = await openai.chat.completions.create(body);
// 非流式响应
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
// 初始化 OpenAI 客户端 (自动使用 Val Town 的 std key 或你配置的 ENV key)
const openai = new OpenAI();
// 我们想要测试的模型列表
try {
const start = Date.now();
const completion = await openai.chat.completions.create({
messages: [{ role: "user", content: "Reply with the model name only." }],
model: model,
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" },
import { OpenAI } from "https://esm.sh/openai@5.20.1";
import { getIssue, readFileContent } from "./api/index.tsx";
import {
async function getAiSummary(commentBody: string): Promise<string> {
const openai = new OpenAI({
apiKey: Deno.env.get("OPENAI_API_KEY"),
});
const response = await openai.responses.create({
prompt: {
"id": "pmpt_68c477e0df8081908a417a427ab285480d8eef1252f514eb",
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
import { blob } from "https://esm.town/v/std/blob?v=11";
import { nanoid } from "npm:nanoid";
parentId: string | null,
) {
const openai = new OpenAI();
const layer = LAYERS[depth] || LAYERS[LAYERS.length - 1];
`;
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 === "generateMission") {
try {
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [{ role: "system", content: MISSION_PROMPT }],
snippet_en: "The end of junior developers?",
content:
"OpenAI prépare une mise à jour majeure avec plus de capacités de raisonnement et d'automa
content_en:
"OpenAI is preparing a major update with stronger reasoning and automation abilities. We e
},
{
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
import { blob } from "https://esm.town/v/std/blob?v=11";
if (!agent) throw new Error("Agent not found");
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
const agent = Object.values(AGENT_PERSONAS).find((a) => a.id === agentId);
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
/** @jsxImportSource https://esm.sh/react@18.2.0 */
import { OpenAI } from "https://esm.town/v/std/openai?v=4";
import { blob } from "https://esm.town/v/std/blob?v=11";
import { nanoid } from "npm:nanoid";
async function runArchitect(textSample: string) {
const openai = new OpenAI();
const prompt = `
Input Text: "${textSample.substring(0, 1000)}..."
`;
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [
async function runAgent(agent: any, text: string, jobId: string) {
const openai = new OpenAI();
await updateJob(jobId, {
try {
const completion = await openai.chat.completions.create({
model: "gpt-4o",
messages: [