1import { email } from "https://esm.town/v/std/email?v=11";
2import { OpenAI } from "npm:openai";
3
4let location = "Wolfsburg";
8).then(r => r.json());
9
10const openai = new OpenAI();
11let chatCompletion = await openai.chat.completions.create({
12 messages: [{
13 role: "user",
1import { email } from "https://esm.town/v/std/email?v=11";
2import { OpenAI } from "npm:openai";
3
4let location = "brooklyn ny";
8).then(r => r.json());
9
10const openai = new OpenAI();
11let chatCompletion = await openai.chat.completions.create({
12 messages: [{
13 role: "user",
4 * The TextBelt API is used for sending SMS messages without requiring an API key.
5 * The conversation history is stored as an array of message objects containing sender, content, date, and phone number.
6 * OpenAI's GPT-4 is used to generate contextual responses based on the conversation history.
7 */
8
9import { blob } from "https://esm.town/v/std/blob";
10import { OpenAI } from "https://esm.town/v/std/openai";
11import { Buffer } from "node:buffer";
12import { createHmac, timingSafeEqual } from "node:crypto";
85// Helper function to generate AI response
86async function generateAIResponse(history: Message[]): Promise<string> {
87 const openai = new OpenAI();
88 const messages: { role: "user" | "assistant" | "system"; content: string }[] = history.map(msg => ({
89 role: msg.sender === "User" ? "user" : "assistant",
97 });
98
99 const completion = await openai.chat.completions.create({
100 messages,
101 model: "gpt-4-0613",
14Supports: checkbox, date, multi_select, number, rich_text, select, status, title, url, email
15
16- Uses `NOTION_API_KEY`, `OPENAI_API_KEY` stored in env variables and uses [Valtown blob storage](https://esm.town/v/std/blob) to store information about the database.
17- Use `get_notion_db_info` to use the stored blob if exists or create one, use `get_and_save_notion_db_info` to create a new blob (and replace an existing one if exists).
3import Instructor from "npm:@instructor-ai/instructor";
4import { Client } from "npm:@notionhq/client";
5import OpenAI from "npm:openai";
6import { z } from "npm:zod";
7
26};
27
28const oai = new OpenAI({
29 apiKey: process.env.OPENAI_API_KEY ?? undefined,
30});
31
1import { loadPageContent } from "https://esm.town/v/charlypoly/browserbaseUtils";
2import { OpenAI } from "https://esm.town/v/std/openai?v=4";
3import { z } from "npm:zod";
4import { zodToJsonSchema } from "npm:zod-to-json-schema";
25});
26
27// we create a OpenAI Tool that takes our schema as argument
28const extractContentTool: any = {
29 type: "function",
36};
37
38const openai = new OpenAI();
39
40// We ask OpenAI to extract the content from the given web page.
41// The model will reach out to our `extract_content` tool and
42// by doing so, the model will extract the required data to satisfy
43// the requirement of `extract_content`s argument.
44const completion = await openai.chat.completions.create({
45 model: "gpt-4-turbo",
46 messages: [
55});
56
57// we retrieve the serialized arguments generated by OpenAI
58const result = completion.choices[0].message.tool_calls![0].function.arguments;
59// the serialized arguments are parsed into a valid JavaScript array of objects
1import { OpenAI } from "npm:openai";
2import { zodResponseFormat } from "npm:openai/helpers/zod";
3import { z } from "npm:zod";
4
9});
10
11const client = new OpenAI({ apiKey: Deno.env.get("OPENAI_API_KEY") });
12
13async function main() {
38 }
39 const code = await generateValCode(
40 process.env.VT_OPENAI_KEY,
41 value.description,
42 );
21 try {
22 let resp = await textToImageDalle(
23 process.env.openai,
24 text.replace("/dalle", ""),
25 1,
100 // Configuration
101 const API_CONFIG = {
102 url: "https://willthereader-openaidefiner.web.val.run",
103 method: "POST",
104 mode: "cors",