1import { openai } from "npm:@ai-sdk/openai";
2import { generateText } from "npm:ai";
3
20
21 const { text } = await generateText({
22 model: openai("gpt-4"),
23 system: "You are an expert at explaining complex topics in a way that resonates with young professionals in their mid-twenties.",
24 prompt: `Explain ${topic} as if talking to a 25-year-old young professional. Use casual but intelligent language, modern references, and relatable examples. The explanation should be comprehensive but not overly academic.`,
1import { openai } from "npm:@ai-sdk/openai";
2import { generateText } from "npm:ai";
3
29
30 const { text } = await generateText({
31 model: openai("gpt-4"),
32 system: "You are a 150-year-old person from the 1870s explaining modern topics.",
33 prompt: prompt,
1import { openai } from "npm:@ai-sdk/openai"; // Ensure OPENAI_API_KEY environment variable is set
2
3export default async function(req: Request): Promise<Response> {
16 Include 2-3 relevant emojis.`;
17
18 const response = await openai.chat.completions.create({
19 model: "gpt-3.5-turbo",
20 messages: [
37 async function generateHeadlines() {
38 try {
39 const { OpenAI } = await import("https://esm.town/v/std/openai");
40 const openai = new OpenAI();
41
42 const response = await openai.chat.completions.create({
43 messages: [
44 {
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3export default async function server(request: Request): Promise<Response> {
11 const { name } = await request.json();
12
13 // Initialize OpenAI
14 const openai = new OpenAI();
15
16 // Use GPT to parse the name
17 const completion = await openai.chat.completions.create({
18 messages: [
19 {
1import { openai } from "npm:@ai-sdk/openai"; // Ensure OPENAI_API_KEY environment variable is set
2import { generateText } from "npm:ai";
3
19
20 const { text } = await generateText({
21 model: openai("o1"),
22 system: "You create agent code",
23 prompt: `
1import { openai } from "npm:@ai-sdk/openai"; // Ensure OPENAI_API_KEY environment variable is set
2import { generateText } from "npm:ai";
3
15
16 const { text } = await generateText({
17 model: openai("gpt-4o-mini"),
18 system:
19 "You are a CIA AGENT, that works at DARPA, you understand the intricate nature of how easy it is to hack shit.",
1#!/usr/bin/env node
2
3import { openai } from "npm:@ai-sdk/openai";
4import { experimental_generateImage as generateImage } from "npm:ai";
5
47 try {
48 imageResult = await generateImage({
49 model: openai.image("dall-e-3"),
50 prompt: meme_idea,
51 });
1import { openai } from "npm:@ai-sdk/openai"; // Ensure OPENAI_API_KEY environment variable is set
2import { generateText } from "npm:ai";
3
14 const recentChanges = body?.recent_changes ?? "The codebase now includes swearwords";
15 const { text } = await generateText({
16 model: openai("gpt-4o-mini"),
17 system: "You a moral counseler who analyes changes made to a codebase and return your opinion",
18 prompt: `
1// This approach fetches GitHub activity for two users specified in the URL,
2// sends it to OpenAI for analysis, and returns collaboration suggestions.
3// It uses the GitHub API (which doesn't require authentication for public data)
4// and the OpenAI API (which does require an API key).
5// Tradeoff: We're using an inline API key for simplicity, which isn't ideal for security.
6// Note: This might hit rate limits for the GitHub API due to fetching a year of data.
7
8import { OpenAI } from "https://esm.town/v/std/openai";
9
10const OPENAI_API_KEY = "your_openai_api_key"; // Replace with your actual OpenAI API key
11
12export default async function main(req: Request): Promise<Response> {
51 const user1Summary = summarizeActivity(user1Data);
52
53 const openai = new OpenAI(OPENAI_API_KEY);
54 const completion = await openai.chat.completions.create({
55 model: "gpt-4o-mini",
56 messages: [