Search
chatbot
@odicho
An example of using Breadboard Board as a Service helper script. The board is a single turn of a chat bot: takes the conversation context and returns updated conversation context. To use: fork this val set the URL of the board to be served add "GEMINI_KEY" to your environment variables query directly or use as Service URL in the Core Kit service node.
HTTP
An example of using [Breadboard Board as a Service](https://www.val.town/v/dglazkov/bbaas) helper script. The board is a single turn of a chat bot: takes the conversation context and returns updated conversation context.
To use:
- fork this val
- set the URL of the board to be served
- add "GEMINI_KEY" to your environment variables
- query directly or use as Service URL in the Core Kit `service` node.
import { service } from "https://esm.town/v/odicho/entireGoldLark";
export default service(
"https://breadboard-community.wl.r.appspot.com/boards/@AdorableGorilla/catchup-local-copy.bgl.json",
nasaAPOD
@henrii
// Returns NASA's Astronomy Picture of the Day (APOD)
Script
import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
// Returns NASA's Astronomy Picture of the Day (APOD)
export const nasaAPOD = await fetchJSON("https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY");
console.log(nasaAPOD.url);
// Forked from @iBrokeit.nasaAPOD
stringCodeRunner
@yawnxyz
Val.town somehow doesn't run multi-line code. Does work with "3+3" but not more complex stuff.
HTTP
Val.town somehow doesn't run multi-line code. Does work with "3+3" but not more complex stuff.
/** @jsx jsx */
const app = new Hono();
app.post("/eval", async (c) => {
const payload = await c.req.json();
console.log('evaling using:', Deno.env.get('valtown'))
const response = await fetchJSON('https://api.val.town/v1/eval', {
method: 'POST',
body: JSON.stringify(payload),
headers: {
sdxl
@fal
SDXL (fastest) https://www.fal.ai/models/stable-diffusion-xl link to val - https://www.val.town/v/fal/sdxl import * as fal from "npm:@fal-ai/serverless-client";
const result = await fal.subscribe("fal-ai/fast-sdxl", {
input: {
prompt: "photo of a rhino dressed suit and tie sitting at a table in a bar with a bar stools, award winning photography, Elke vogelsang"
},
logs: true,
onQueueUpdate: (update) => {
if (update.status === "IN_PROGRESS") {
update.logs.map((log) => log.message).forEach(console.log);
}
},
});
Script
## SDXL (fastest)
https://www.fal.ai/models/stable-diffusion-xl
link to val - https://www.val.town/v/fal/sdxl
```js
const result = await fal.subscribe("fal-ai/fast-sdxl", {
input: {
export let sdxl = async (
prompt: string,
negative_prompt: string = "cartoon, illustration, animation. face. male, female",
image_size: string = "square_hd",
smilingLimeCardinal
@jeffreyyoung
An interactive, runnable TypeScript val by jeffreyyoung
HTTP
const basePrompt = [
`Generate an image generation model prompt (description) for the previous image, in nightmare before christmas chibi 3D anime style.`,
`The objective is to try to replicate the image as closely as possible,`,
`but in the new style. To do that, you should be very detailed in including`,
`relevant information necessary to reproduce the image, e.g. colors, poses,`,
`facial expressions, background objects, etc. Ensure that the entire description `,
`is consistent with the nightmare before christmas chibi 3D anime style, especially`,
`the 'nightmare before christmas 3D' part. Output only the prompt and nothing else.`,
].join(" ");
const settings = {
ninja_keys
@pomdtr
GET https://pomdtr-ninja_keys.web.val.run
HTTP
```http
GET https://pomdtr-ninja_keys.web.val.run
/** @jsxImportSource npm:hono@3.12.8/jsx **/
const app = new Hono();
app.get("/", (c) => {
return c.html(
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
v1
@naserdehghan
An interactive, runnable TypeScript val by naserdehghan
HTTP
import { Hono } from "npm:hono@4";
const app = new Hono();
app.get("/", (ctx) => {
return ctx.json({ ok: true });
app.get("about", (ctx) => {
return ctx.text("About US");
export default app.fetch;
examplebot_endpoint
@malloc
An interactive, runnable TypeScript val by malloc
Script
export let examplebot_endpoint = (
req: express.Request,
res: express.Response,
console.log(res);
if (!req.get("X-Signature-Timestamp") || !req.get("X-Signature-Ed25519")) {
res.status(400);
res.end("Signature headers missing");
verify_discord_signature(
process.env.discord_pubkey,
JSON.stringify(req.body),
sauron
@agmm
An interactive, runnable TypeScript val by agmm
HTTP
const app = new Hono();
const count = await blob.getJSON("count") as number || 0;
app.get("/", async (c) => {
await blob.setJSON("count", count + 1);
const eyes = new Array(count).fill("ποΈ").join("");
return c.text(`Every visit adds an eye.\n\n${eyes}`);
app.get("/reset", async (c) => {
const { key } = c.req.query();
if (key !== Deno.env.get("EYE_KEY")) {
c.status(401);
pipeSampleLLMRetrieverInputs
@webup
An interactive, runnable TypeScript val by webup
Script
export const pipeSampleLLMRetrieverInputs = (async () => {
const { PromptTemplate } = await import("npm:langchain/prompts");
const { RunnableSequence, RunnablePassthrough } = await import(
"npm:langchain/schema/runnable"
const { StringOutputParser } = await import(
"npm:langchain/schema/output_parser"
const { Document } = await import("npm:langchain/document");
const modelBuilder = await getModelBuilder();
const model = await modelBuilder();
const docs = await getSampleDocuments();
cmdk_command
@pomdtr
An interactive, runnable TypeScript val by pomdtr
HTTP
#!/usr/bin/env -S deno serve --allow-all --env --watch
const app = new Hono();
const token = Deno.env.get("valtown");
app.get("/", async (c) => {
const resp = await fetchAPI("/v1/me", {
token,
if (!resp.ok) {
return resp;
const me = await resp.json();
const page = {
CodeRunner
@jeffreyyoung
A simple poe bot
HTTP
A simple poe bot
const { loadPyodide } = pyodideModule;
const pyodide = await loadPyodide();
export default serve({
async *handleMessage(req) {
const lastMessage = req.query.at(-1)?.content;
const supportedCodeBlocks: {
type: "python";
content: string;
marked.use({
aqi
@zbeastly1
An interactive, runnable TypeScript val by zbeastly1
Script
export let aqi = async () => {
return await fetchJSON(
"https://api.openaq.org/v2/latest?" +
new URLSearchParams({
limit: "10",
page: "1",
location_id: "61498",
offset: "0",
sort: "desc",
radius: "100000",
upscaleThisUrl
@andrew
// Forked from @liamdanielduffy.upscaleThisUrl
Express (deprecated)
export const upscaleThisUrl = async (req, res) => {
const authToken = process.env.REPLICATE_API_TOKEN;
const url = "https://api.replicate.com/v1/predictions";
const jobId = req.body?.jobId;
const imageUrl = req.body?.imageUrl;
if (!jobId && !imageUrl) {
res.status(400).json({
error:
"You must pass either a jobId or an imageUrl. You did not pass either.",
if (jobId && imageUrl) {
modelSampleLLMCall
@bluemsn
An interactive, runnable TypeScript val by bluemsn
Script
import { getModelBuilder } from "https://esm.town/v/bluemsn/getModelBuilder";
export const modelSampleLLMCall = (async () => {
const builder = await getModelBuilder();
const model = await builder();
return await model.call("θ―΄ζδΈε₯εθ¨");