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=106&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 1633 results for "openai"(1050ms)

getModelBuildermain.tsx14 matches

@lt_07•Updated 7 months ago
3export async function getModelBuilder(spec: {
4 type?: "llm" | "chat" | "embedding";
5 provider?: "openai" | "huggingface";
6} = { type: "llm", provider: "openai" }, options?: any) {
7 const { extend, cond, matches, invoke } = await import("npm:lodash-es");
8 // Set up LangSmith tracer
17 // Set up API key for each providers
18 const args = extend({ callbacks }, options);
19 if (spec?.provider === "openai")
20 args.openAIApiKey = process.env.OPENAI;
21 else if (spec?.provider === "huggingface")
22 args.apiKey = process.env.HUGGINGFACE;
24 const setup = cond([
25 [
26 matches({ type: "llm", provider: "openai" }),
27 async () => {
28 const { OpenAI } = await import("npm:langchain/llms/openai");
29 return new OpenAI(args);
30 },
31 ],
32 [
33 matches({ type: "chat", provider: "openai" }),
34 async () => {
35 const { ChatOpenAI } = await import("npm:langchain/chat_models/openai");
36 return new ChatOpenAI(args);
37 },
38 ],
39 [
40 matches({ type: "embedding", provider: "openai" }),
41 async () => {
42 const { OpenAIEmbeddings } = await import(
43 "npm:langchain/embeddings/openai"
44 );
45 return new OpenAIEmbeddings(args);
46 },
47 ],

getModelBuilder_deleted_1727331494main.tsx14 matches

@lt_07•Updated 7 months ago
3export async function getModelBuilder(spec: {
4 type?: "llm" | "chat" | "embedding";
5 provider?: "openai" | "huggingface";
6} = { type: "llm", provider: "openai" }, options?: any) {
7 const { extend, cond, matches, invoke } = await import("npm:lodash-es");
8 // Set up LangSmith tracer
17 // Set up API key for each providers
18 const args = extend({ callbacks }, options);
19 if (spec?.provider === "openai")
20 args.openAIApiKey = process.env.OPENAI;
21 else if (spec?.provider === "huggingface")
22 args.apiKey = process.env.HUGGINGFACE;
24 const setup = cond([
25 [
26 matches({ type: "llm", provider: "openai" }),
27 async () => {
28 const { OpenAI } = await import("npm:langchain/llms/openai");
29 return new OpenAI(args);
30 },
31 ],
32 [
33 matches({ type: "chat", provider: "openai" }),
34 async () => {
35 const { ChatOpenAI } = await import("npm:langchain/chat_models/openai");
36 return new ChatOpenAI(args);
37 },
38 ],
39 [
40 matches({ type: "embedding", provider: "openai" }),
41 async () => {
42 const { OpenAIEmbeddings } = await import(
43 "npm:langchain/embeddings/openai"
44 );
45 return new OpenAIEmbeddings(args);
46 },
47 ],

bedtimeStoryMakermain.tsx1 match

@dthyresson•Updated 7 months ago
19import { generateOpenGraphTags, OpenGraphData } from "https://esm.town/v/dthyresson/generateOpenGraphTags";
20import { ValTownLink } from "https://esm.town/v/dthyresson/viewOnValTownComponent";
21import { chat } from "https://esm.town/v/stevekrouse/openai";
22import * as fal from "npm:@fal-ai/serverless-client";
23

free_open_routermain.tsx2 matches

@taras•Updated 7 months ago
155 },
156 {
157 url: "https://api.groq.com/openai/v1/models",
158 token: Deno.env.get("GROQ_API_KEY"),
159 },
298 if (provider === "groq") {
299 url.host = "api.groq.com";
300 url.pathname = url.pathname.replace("/api/v1", "/openai/v1");
301 url.port = "443";
302 url.protocol = "https";

add_to_notion_w_aiREADME.md1 match

@eyeseethru•Updated 8 months ago
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).

add_to_notion_w_aimain.tsx3 matches

@eyeseethru•Updated 8 months ago
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

InventionDetailstoJSONConvertermain.tsx3 matches

@willthereader•Updated 8 months ago
133 if (request.method === "POST" && new URL(request.url).pathname === "/convert") {
134 try {
135 const { OpenAI } = await import("https://esm.town/v/std/openai");
136 const { blob } = await import("https://esm.town/v/std/blob");
137 const openai = new OpenAI();
138
139 const body = await request.json();
192
193 try {
194 const completion = await openai.chat.completions.create({
195 messages: [
196 {

openai_structured_output_demoREADME.md4 matches

@stevekrouse•Updated 8 months ago
1# OpenAI Structured Output Demo
2
3Ensure responses follow JSON Schema for structured outputs
5The following demo uses zod to describe and parse the response to JSON.
6
7Learn more in the [OpenAI Structured outputs
8 docs](https://platform.openai.com/docs/guides/structured-outputs/introduction).
9
10
11Migrated from folder: Archive/openai_structured_output_demo

telegramDalleBotmain.tsx1 match

@adjacent•Updated 8 months ago
27 try {
28 const imageURL = (await textToImageDalle(
29 process.env.openai,
30 text,
31 1,

telegramDalleBotREADME.md1 match

@adjacent•Updated 8 months ago
1# Telegram DALLE Bot
2
3A personal telegram bot you can message to create images with OpenAI's [DALLE](https://openai.com/dall-e-2) ✨
4
5![DALLE: A Macintosh II sitting on a desk, painted by Picasso in his blue period.](https://i.imgur.com/uJrP5mE.png)

translateToEnglishWithOpenAI1 file match

@shlmt•Updated 6 days ago

testOpenAI1 file match

@stevekrouse•Updated 1 week 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": "*",