Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/image-url.jpg%20%22Optional%20title%22?q=openai&page=141&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=openai

Returns an array of strings in format "username" or "username/projectName"

Found 1602 results for "openai"(2022ms)

aiSarcasticMotivationalMessagemain.tsx1 match

@patrickjm•Updated 1 year ago
7 "Emphasize a morbid sense of humor.",
8 ].join("\n"),
9 openAiKey: process.env.openai_key,
10});

chatmain.tsx6 matches

@webup•Updated 1 year ago
5 options = {},
6) => {
7 // Initialize OpenAI API stub
8 const { Configuration, OpenAIApi } = await import(
9 "https://esm.sh/openai@3.3.0"
10 );
11 const configuration = new Configuration({
12 apiKey: process.env.OPENAI,
13 });
14 const openai = new OpenAIApi(configuration);
15 // Request chat completion
16 const messages = typeof prompt === "string"
17 ? [{ role: "user", content: prompt }]
18 : prompt;
19 const { data } = await openai.createChatCompletion({
20 model: "gpt-3.5-turbo-0613",
21 messages,

modelSampleChatCallmain.tsx1 match

@webup•Updated 1 year ago
4 const builder = await getModelBuilder({
5 type: "chat",
6 provider: "openai",
7 });
8 const model = await builder();
2
3export const multipleKeysAndMemoryConversationChainExample = (async () => {
4 const { ChatOpenAI } = await import(
5 "https://esm.sh/langchain/chat_models/openai"
6 );
7 const { BufferMemory } = await import("https://esm.sh/langchain/memory");
13 } = await import("https://esm.sh/langchain/prompts");
14 const { ConversationChain } = await import("https://esm.sh/langchain/chains");
15 const llm = new ChatOpenAI({
16 modelName: "gpt-3.5-turbo",
17 openAIApiKey: process.env.OPENAI_API_KEY,
18 temperature: 0,
19 });

browserlessPuppeteerExamplemain.tsx1 match

@vtdocs•Updated 1 year ago
13 });
14 const page = await browser.newPage();
15 await page.goto("https://en.wikipedia.org/wiki/OpenAI");
16 const intro = await page.evaluate(
17 `document.querySelector('p:nth-of-type(2)').innerText`,

pipeSampleLLMBindmain.tsx1 match

@webup•Updated 1 year ago
7 const mb = await getModelBuilder({
8 type: "chat",
9 provider: "openai",
10 });
11 const model = await mb();

openaiOpenAPImain.tsx1 match

@stevekrouse•Updated 1 year ago
1export let openaiOpenAPI = `
2openapi: 3.0.0
3info:
44 };
45 let openApiResponse = await fetch(
46 "https://api.openai.com/v1/chat/completions",
47 requestOptions,
48 );

browserlessScrapeExamplemain.tsx1 match

@vtdocs•Updated 1 year ago
8 method: "POST",
9 body: JSON.stringify({
10 "url": "https://en.wikipedia.org/wiki/OpenAI",
11 "elements": [{
12 // The second <p> element on the page

conversationalQAChainExmain.tsx10 matches

@jacoblee93•Updated 1 year ago
2
3export const conversationalQAChainEx = (async () => {
4 const { ChatOpenAI } = await import(
5 "https://esm.sh/langchain/chat_models/openai"
6 );
7 const { HNSWLib } = await import(
8 "https://esm.sh/langchain/vectorstores/hnswlib"
9 );
10 const { OpenAIEmbeddings } = await import(
11 "https://esm.sh/langchain/embeddings/openai"
12 );
13 const { ConversationalRetrievalQAChain } = await import(
14 "https://esm.sh/langchain/chains"
15 );
16 const gpt35 = new ChatOpenAI({
17 openAIApiKey: process.env.OPENAI_API_KEY,
18 modelName: "gpt-3.5-turbo",
19 temperature: 0,
20 });
21 const gpt4 = new ChatOpenAI({
22 openAIApiKey: process.env.OPENAI_API_KEY,
23 modelName: "gpt-4",
24 temperature: 0,
27 ["Hello world", "Bye bye", "hello nice world", "bye", "hi"],
28 [{ id: 2 }, { id: 1 }, { id: 3 }, { id: 4 }, { id: 5 }],
29 new OpenAIEmbeddings({
30 openAIApiKey: process.env.OPENAI_API_KEY,
31 }),
32 );

translateToEnglishWithOpenAI1 file match

@shlmt•Updated 21 hours ago

testOpenAI1 file match

@stevekrouse•Updated 2 days ago
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": "*",