2
3export const langchainEx = (async () => {
4 const { ChatOpenAI } = await import(
5 "https://esm.sh/langchain/chat_models/openai"
6 );
7 const { PromptTemplate } = await import("https://esm.sh/langchain/prompts");
8 const { LLMChain } = await import("https://esm.sh/langchain/chains");
9 const model = new ChatOpenAI({
10 temperature: 0.9,
11 openAIApiKey: process.env.OPENAI_API_KEY,
12 verbose: true,
13 });
2
3export const chatAgentWithCustomPrompt = (async () => {
4 const { ChatOpenAI } = await import(
5 "https://esm.sh/langchain/chat_models/openai"
6 );
7 const { initializeAgentExecutorWithOptions } = await import(
11 "https://esm.sh/langchain/tools/calculator"
12 );
13 const model = new ChatOpenAI({
14 temperature: 0,
15 openAIApiKey: process.env.OPENAI_API_KEY,
16 });
17 const tools = [
1import { getOpenAiResponse } from "https://esm.town/v/thomasatflexos/getOpenAiResponse";
2import { getRelevantContent } from "https://esm.town/v/thomasatflexos/getRelevantContent";
3import process from "node:process";
57 \n IF you think that the Linkedin post is about new job opportunities, just respond with the text "N/A" and stop immediately. Do not respond any further.
58 \n ELSE IF you think the Linkdedin post is not about new job opportunities, please proceed to a meaningful comment to the provided Linkedin post based on the provided context and include ${link} in the post in a clever and relevant way, (don't be too blatant).`;
59 let finalResponse = await getOpenAiResponse(PROMPT);
60 const { data1, error1 } = await supabase
61 .from("linkedin_seedings")
13 });
14 }
15 const { OpenAIEmbeddings } = await import("npm:langchain/embeddings");
16 const { createClient } = await import(
17 "https://esm.sh/@supabase/supabase-js@2"
39 const vectorStore = await SupabaseVectorStore.fromDocuments(
40 splittedDocs,
41 new OpenAIEmbeddings({
42 openAIApiKey: process.env.OPEN_API_KEY,
43 }),
44 {
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2import { openaiOpenAPI } from "https://esm.town/v/stevekrouse/openaiOpenAPI";
3
4// https://stevekrouse-chatgptplugin.express.val.run/.well-known/ai-plugin.json
38 // OpenAPI Spec
39 // only POST /v1/eval for now
40 res.send(openaiOpenAPI);
41 }
42 else if (req.path === "/v1/eval") {
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON";
2
3export function openaiFineTune({ key, model, trainingFile }: {
4 key: string;
5 model?: string;
7}) {
8 return fetchJSON(
9 "https://api.openai.com/v1/fine_tuning/jobs",
10 {
11 method: "POST",
3
4export let autoGPT_Test2 = (async () => {
5 const { Configuration, OpenAIApi } = await import("npm:openai");
6 const configuration = new Configuration({
7 apiKey: process.env.openai,
8 });
9 const openai = new OpenAIApi(configuration);
10 const completion = await openai.createChatCompletion({
11 model: "gpt-3.5-turbo",
12 messages: [
1import { openaiImages } from "https://esm.town/v/ale_annini/openaiImages";
2
3export const images = openaiImages({ prompt: "a dog", n: 2 });
5 options = {},
6) => {
7 // Initialize OpenAI API stub
8 const { Configuration, OpenAIApi } = await import("https://esm.sh/openai");
9 const configuration = new Configuration({
10 apiKey: process.env.OPENAI,
11 });
12 const openai = new OpenAIApi(configuration);
13 // Request chat completion
14 const messages = typeof prompt === "string"
15 ? [{ role: "user", content: prompt }]
16 : prompt;
17 const { data } = await openai.createChatCompletion({
18 model: "gpt-3.5-turbo-0613",
19 messages,
4// https://api.val.town/v1/express/zzz.ListenTo?val=stevekrouse.whatIsValTown
5export async function ListenTo(req, res) {
6 const { val = "zzz.demoOpenAIGPT4Summary" } = req.query;
7 const url = `https://api.val.town/v1/run/${val.replace("@", "")}`
8 const resp = await fetch(url);