Search
Code3,248
import { OpenAI } from "https://esm.town/v/std/openai";function extractCode(str: string): string { } const openai = new OpenAI(); const prompt = `Generate a TypeScript function named "${functionName}" with the following parameters: ${parameters}. ONLY RETURN VALID JAVASCRIPT DO NOT INCLUDE ANY CONTEXT.`; const completion = await openai.chat.completions.create({ messages: [ {
}, { "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", "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",
Note: When changing a SQLite table's schema, change the table's name (e.g., add _2 or _3) to create a fresh table.### OpenAI```tsimport { 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 create a fresh table.### OpenAI```tsimport { 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 create a fresh table.### OpenAI```tsimport { 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 { email } from "https://esm.town/v/std/email";import { OpenAI } from "https://esm.town/v/std/openai";import { JSDOM } from "npm:jsdom";import { NodeHtmlMarkdown, NodeHtmlMarkdownOptions } from "npm:node-html-markdown";);const openai = new OpenAI();console.log(trendingMarkdown);const completion = await openai.chat.completions.create({ messages: [ {
if (request.method === "POST") { try { const { OpenAI } = await import("https://esm.town/v/std/openai"); const openai = new OpenAI(); const formData = await request.formData(); const cvText = new TextDecoder().decode(cvBuffer); const completion = await openai.chat.completions.create({ messages: [ {
import express from 'express';import { getMessages, getLinks, getCategories, updateLinkCategory } from './database.js';import { Configuration, OpenAIApi } from 'openai';import 'dotenv/config';app.use(express.json());// Initialize OpenAI for AI-powered queriesconst configuration = new Configuration({ apiKey: process.env.OPENAI_API_KEY,});const openai = new OpenAIApi(configuration);/** * Function to analyze messages with OpenAI * @param {Array} messages - Array of message objects * @param {string} query - User query to analyze messages with * @returns {Object} - OpenAI response */async function analyzeMessagesWithAI(messages, query) { try { // Format messages for OpenAI const formattedConversation = messages.map(msg => { const author = msg.author_id === process.env.DISCORD_USER_ID ? 'You' : 'Partner'; `; // Call OpenAI API const response = await openai.createCompletion({ model: "gpt-3.5-turbo-instruct", prompt: prompt,
const links = getLinks(linkFilters); // If no specific categories, use OpenAI to help filter relevant links if ((!categories || categories.length === 0) && links.length > 0) { const relevantLinks = await filterRelevantLinks(links, query);
SPOUSE_USER_ID=spouse_user_id_here# OpenAI API key (for AI-powered querying)OPENAI_API_KEY=your_openai_api_key_here# Val.town settings
reconsumeralization
import { OpenAI } from "https://esm.town/v/std/openai";
import { sqlite } from "https://esm.town/v/stevekrouse/sqlite";
/**
* Practical Implementation of Collective Content Intelligence
* Bridging advanced AI with collaborative content creation
*/
exp
kwhinnery_openai
lost1991
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",
No docs found