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=112&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 1618 results for "openai"(633ms)

githubcollabgenmain.tsx4 matches

@ejfox•Updated 8 months ago
1import { OpenAI } from "https://esm.town/v/std/openai";
2
3const OPENAI_API_KEY = "your_openai_api_key"; // Replace with your actual OpenAI API key
4
5export default async function main(req: Request): Promise<Response> {
57 const user2Summary = summarizeActivity(user2Data);
58
59 const openai = new OpenAI(OPENAI_API_KEY);
60 const completion = await openai.chat.completions.create({
61 model: "gpt-3.5-turbo",
62 messages: [

githubactivitysummarizermain.tsx6 matches

@ejfox•Updated 8 months ago
1// This approach fetches GitHub activity for two users specified in the URL,
2// sends it to OpenAI for analysis, and returns collaboration suggestions.
3// It uses the GitHub API (which doesn't require authentication for public data)
4// and the OpenAI API (which does require an API key).
5// Tradeoff: We're using an inline API key for simplicity, which isn't ideal for security.
6// Note: This might hit rate limits for the GitHub API due to fetching a year of data.
7
8import { OpenAI } from "https://esm.town/v/std/openai";
9
10const OPENAI_API_KEY = "your_openai_api_key"; // Replace with your actual OpenAI API key
11
12export default async function main(req: Request): Promise<Response> {
54 const user2Summary = summarizeActivity(user2Data);
55
56 const openai = new OpenAI(OPENAI_API_KEY);
57 const completion = await openai.chat.completions.create({
58 model: "gpt-3.5-turbo",
59 messages: [

githubactivitysummarizerREADME.md3 matches

@ejfox•Updated 8 months ago
1# GitHub Activity Summarizer
2
3This val.town script fetches a user's recent GitHub activity and generates a summarized narrative overview using OpenAI's GPT model.
4
5## Features
6
7- Retrieves GitHub activity for a specified user from the past week
8- Summarizes activity using OpenAI's GPT-3.5-turbo model
9- Returns a concise, narrative summary of the user's GitHub contributions
10
22## Note
23
24Ensure you have necessary permissions and comply with GitHub's and OpenAI's terms of service when using this script.

relationshipgeneratormain.tsx5 matches

@ejfox•Updated 8 months ago
1// This val receives text input, sends it to OpenAI to generate relationships,
2// and returns a newline-delimited list of relationships.
3// It uses the OpenAI API to generate the relationships.
4// Tradeoff: This approach relies on an external API, which may have rate limits or costs.
5
7// curl -X POST -H "Content-Type: text/plain" -d "Your text here" https://your-val-url.web.val.run
8
9import { OpenAI } from "https://esm.town/v/std/openai";
10
11const openai = new OpenAI();
12
13export default async function main(req: Request): Promise<Response> {
18 const text = await req.text();
19
20 const completion = await openai.chat.completions.create({
21 model: "gpt-3.5-turbo",
22 messages: [

MuxAITranscriptmain.tsx4 matches

@decepulis•Updated 8 months ago
1import Mux from "npm:@mux/mux-node";
2import { AssemblyAI } from "npm:assemblyai";
3import OpenAI from "npm:openai";
4
5import { zodResponseFormat } from "npm:openai/helpers/zod";
6import z from "npm:zod";
7
15 apiKey: Deno.env.get("ASSEMBLY_AI_KEY"),
16});
17const openai = new OpenAI({
18 apiKey: Deno.env.get("OPEN_API_KEY"),
19});
133 const responseFormat = z.object({ cues: cueFormat });
134
135 const completion = await openai.chat.completions.create({
136 messages: [
137 {

MuxAITranscriptREADME.md1 match

@decepulis•Updated 8 months ago
14- Mux Access token details (`MUX_TOKEN_ID`, `MUX_TOKEN_SECRET`) This endpoint requires an existing Mux asset that's ready with an audio-only static rendition associated with it. You can run [this val](https://www.val.town/v/mux/createDubbingTestAsset) to create a new one for testing.
15- AssemblyAI API key (`ASSEMBLYAI_API_KEY`). Get it [from their dashboard here](https://www.assemblyai.com/app/account)
16- OpenAI API key (`OPENAI_API_KEY`). Get it [from their dashboard here](https://platform.openai.com/api-keys)
17
18Make a POST request to the Val's endpoint with the following body, replacing the values with your own asset ID and the list of speakers. Speakers are listed in order of appearance.
1import { OpenAI } from "https://esm.town/v/std/openai";
2import { OpenAIToolSet } from "npm:composio-core";
3
4const COMPOSIO_API_KEY = Deno.env.get("COMPOSIO_API_KEY"); // Getting the API key from the environment
5const toolset = new OpenAIToolSet({ apiKey: COMPOSIO_API_KEY });
6
7// Creating an authentication function for the user
32 const instruction = "Star a repo ComposioHQ/composio on GitHub";
33
34 const client = new OpenAI();
35 const response = await client.chat.completions.create({
36 model: "gpt-4-turbo",
1# Using OpenAI Assistant API, Composio to Star a Github Repo
2This is an example code of using Composio to star a github Repository by creating an AI Agent using OpenAI API
3
4## Goal
5Enable OpenAI assistants to perform tasks like starring a repository on GitHub via natural language commands.
6
7## Tools

easyAQIREADME.md1 match

@bcongdon•Updated 9 months ago
126. Uses EPA's ranking to classify the severity of the score (ie "Unhealthy for Sensitive Groups")
13
14It uses blob storage to cache the openai location id for your location string to skip a couple steps for the next time.
15
16## Example usage

tenseRoseTiglonmain.tsx3 matches

@MichaelNollox•Updated 9 months ago
2import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo";
3
4import { OpenAI } from "https://esm.town/v/std/openai";
5
6const openai = new OpenAI();
7
8const completion = await openai.chat.completions.create({
9 messages: [
10 { role: "user", content: "Say hello in a creative way" },

translateToEnglishWithOpenAI1 file match

@shlmt•Updated 4 days ago

testOpenAI1 file match

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