1import { fineTuneExMispellings } from "https://esm.town/v/stevekrouse/fineTuneExMispellings";
2import process from "node:process";
3import { openaiFineTuneData } from "https://esm.town/v/stevekrouse/openaiFineTuneData";
4
5export let fineTuningJob1 = openaiFineTuneData({
6 key: process.env.openai,
7 data: fineTuneExMispellings,
8});
58 }
59 aleister_chatley_countdown = 8 + Math.floor(Math.random() * 6);
60 const { OpenAI } = await import("https://deno.land/x/openai/mod.ts");
61 const openAI = new OpenAI(process.env.OPENAI_KEY);
62 const chatCompletion = await openAI.createChatCompletion(
63 prompts.philip_k_dick,
64 );
2
3export const conversationalRetrievalQAChainStreamingExample = (async () => {
4 const { ChatOpenAI } = await import(
5 "https://esm.sh/langchain/chat_models/openai"
6 );
7 const { OpenAIEmbeddings } = await import(
8 "https://esm.sh/langchain/embeddings/openai"
9 );
10 const { BufferMemory } = await import("https://esm.sh/langchain/memory");
16 );
17 let streamedResponse = "";
18 const streamingModel = new ChatOpenAI({
19 openAIApiKey: process.env.OPENAI_API_KEY,
20 streaming: true,
21 callbacks: [{
25 }],
26 });
27 const nonStreamingModel = new ChatOpenAI({
28 openAIApiKey: process.env.OPENAI_API_KEY,
29 });
30 /* Create the vectorstore */
36 ],
37 [{ id: 2 }, { id: 1 }, { id: 3 }],
38 new OpenAIEmbeddings({
39 openAIApiKey: process.env.OPENAI_API_KEY,
40 }),
41 );
1export const getJoke = (async () => {
2 const { ChatCompletion } = await import("npm:openai");
3 const result = await ChatCompletion.create({
4 model: "gpt-3.5-turbo",
4 const builder = await getModelBuilder({
5 type: "chat",
6 provider: "openai",
7 });
8 const model = await builder();
4 const builder = await getMemoryBuilder({
5 type: "summary",
6 provider: "openai",
7 });
8 const memory = await builder();
3// Shows how to use the Brave Search tool in a LangChain agent
4export const braveAgent = (async () => {
5 const { ChatOpenAI } = await import(
6 "https://esm.sh/langchain/chat_models/openai"
7 );
8 const { BraveSearch } = await import("https://esm.sh/langchain/tools");
13 "https://esm.sh/langchain/agents"
14 );
15 const model = new ChatOpenAI({
16 temperature: 0,
17 openAIApiKey: process.env.OPENAI_API_KEY,
18 });
19 const tools = [
28 const imageURL =
29 (await textToImageDalle(
30 process.env.openai,
31 text,
32 1,
4 const builder = await getMemoryBuilder({
5 type: "vector",
6 provider: "openai",
7 });
8 const memory = await builder();
4
5export let autoGPT_Test = (async () => {
6 const { Configuration, OpenAIApi } = await import("npm:openai@3.2.1");
7 const configuration = new Configuration({
8 apiKey: process.env.openai,
9 });
10 const openai = new OpenAIApi(configuration);
11 const completion = await openai.createChatCompletion({
12 model: "gpt-4",
13 messages: [