Public
HTTP (deprecated)
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Readme

VALL-E

LLM code generation for vals! Make apps with a frontend, backend, and database.

It's a bit of work to get this running, but it's worth it.

  • Fork this val to your own profile.
  • Make a folder for the temporary vals that get generated, take the ID from the URL, and put it in tempValsParentFolderId.
  • If you want to use OpenAI models you need to set the OPENAI_API_KEY env var.
  • If you want to use Anthropic models you need to set the ANTHROPIC_API_KEY env var.
  • Create a Val Town API token, open the browser preview of this val, and use the API token as the password to log in.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import VALLErun from "https://esm.town/v/janpaul123/VALLErun?v=9";
import { extractValInfo } from "https://esm.town/v/pomdtr/extractValInfo?v=29";
import { OpenAI } from "https://esm.town/v/std/openai";
const openai = new OpenAI();
const completion = await openai.chat.completions.create({
messages: [
{ role: "user", content: "Say hello in a creative way" },
],
model: "gpt-4o-mini",
max_tokens: 30,
});
console.log(completion.choices[0].message.content);
// Set these to your own
export default VALLErun({
username: extractValInfo(import.meta.url).author,
// Make a folder, navigate to it, and get this from the URL.
tempValsParentFolderId: "4bb7b010-4443-11ef-8642-de64eea55b61",
});
michaelnollox-tenserosetiglon.web.val.run
August 10, 2024