19async function generateMotivation(userProgress) {
20 try {
21 const { OpenAI } = await import("https://esm.town/v/std/openai");
22 const openai = new OpenAI();
23
24 const motivationPrompt = `Generate a highly personalized, inspiring message for someone who has ${userProgress.totalHabits} habits, ${userProgress.completedHabits} completed habits, and an average streak of ${userProgress.averageStreak} days. Make it motivational and specific.`;
25
26 const response = await openai.chat.completions.create({
27 model: "gpt-4o-mini",
28 messages: [{ role: "user", content: motivationPrompt }],
1import { OpenAI } from "https://esm.town/v/std/openai";
2import { sqlite } from "https://esm.town/v/std/sqlite";
3import { discordWebhook } from "https://esm.town/v/stevekrouse/discordWebhook";
113];
114
115const openai = new OpenAI();
116
117async function isTweetProcessed(tweetId: string): Promise<boolean> {
340 try {
341 const completion = await retryWithBackoff(() =>
342 openai.chat.completions.create({
343 model: "gpt-4o-mini",
344 messages: [
10 const [systemPrompt, setSystemPrompt] = useState("You are a helpful AI assistant.");
11 const [isLoading, setIsLoading] = useState(false);
12 const [model, setModel] = useState("openai");
13 const [isSystemPromptEditing, setIsSystemPromptEditing] = useState(false);
14
86 disabled={isLoading}
87 >
88 <option value="openai">GPT-4o Mini</option>
89 <option value="gemini">Gemini Pro</option>
90 <option value="mistral">Mistral 7B</option>
137 try {
138 let response;
139 if (model === "openai") {
140 const { OpenAI } = await import("https://esm.town/v/std/openai");
141 const openai = new OpenAI();
142
143 response = await openai.chat.completions.create({
144 messages: messages,
145 model: "gpt-4o-mini",
1import { OpenAI } from 'https://esm.town/v/std/openai';
2
3const devPrompt = 'You are a recipe parsing bot. You will be given a URL to a recipe. You will provide a JSON reponse. ONLY use data available from the provided URL. Do not add extra information to the JSON. Only respond with the properly formatted JSON.';
4
5export async function parseRecipe(recipeUrl: string): any {
6 const openAi = new OpenAI();
7
8 const completion = await openAi.chat.completions.create({
9 messages: [
10 { role: 'developer', content: devPrompt },
303 if (request.method === 'POST') {
304 try {
305 const { OpenAI } = await import("https://esm.town/v/std/openai");
306 const openai = new OpenAI();
307
308 // New PDF extraction endpoint
328
329 if (request.url.includes('/api/extract-skills')) {
330 const response = await openai.chat.completions.create({
331 model: "gpt-4o-mini",
332 messages: [
356
357 if (request.url.includes('/api/compare-skills')) {
358 const jobSkillsResponse = await openai.chat.completions.create({
359 model: "gpt-4o-mini",
360 messages: [
2import React, { useState, useEffect } from "https://esm.sh/react@18.2.0";
3import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
4import OpenAI from "https://esm.sh/openai@4.28.4";
5
6// Patient record type
126export default async function server(request: Request): Promise<Response> {
127 const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
128 const { OpenAI } = await import("https://esm.town/v/std/openai");
129 const KEY = "aiPoweredHealthRecordSystem";
130 const openai = new OpenAI();
131
132 // Create patient records table
170 if (request.method === 'POST' && new URL(request.url).pathname === '/ai-insight') {
171 const record = await request.json();
172 const completion = await openai.chat.completions.create({
173 messages: [
174 {
1import { blob } from "https://esm.town/v/std/blob";
2import { OpenAI } from "https://esm.town/v/std/openai";
3import { readFile, servePublicFile } from "https://esm.town/v/stevekrouse/utils@187-main/serve-public/index.ts";
4import Algebrite from "npm:algebrite";
138 */
139async function handleProblemGeneration() {
140 const openai = new OpenAI();
141 const completion = await openai.chat.completions.create({
142 model: "gpt-4",
143 messages: [
138 }
139
140 // Import OpenAI dynamically
141 const { OpenAI } = await import("https://esm.town/v/std/openai");
142 const openai = new OpenAI();
143
144 // Generate chat completion
145 const completion = await openai.chat.completions.create({
146 messages: [{ role: "user", content: chat }],
147 model: model,
128 Use plain language to search for emojis. Get great results.
129 <br />
130 Built on Val Town with sqlite vector search and openai embeddings.
131 <br />
132 Fork the <a href="${htmlUrl}" target="_blank">source</a> and build your own!
128 Use plain language to search for emojis. Get great results.
129 <br />
130 Built on Val Town with sqlite vector search and openai embeddings.
131 <br />
132 Fork the <a href="${htmlUrl}" target="_blank">source</a> and build your own!