Search

Results include substring matches and semantically similar vals. Learn more
neverstew avatar
runPostExample
@neverstew
An interactive, runnable TypeScript val by neverstew
Script
username: "neverstew",
valName: "uppercase",
// pass each argument the function accepts as an item in this array
data: ["hello"],
janpaul123 avatar
indexValsTurso
@janpaul123
Part of Val Town Semantic Search . Generates OpenAI embeddings for all public vals, and stores them in Turso , using the sqlite-vss extension. Create the vals_embeddings and vss_vals_embeddings tables in Turso if they don't already exist. Get all val names from the database of public vals , made by Achille Lacoin . Get all val names from the vals_embeddings table and compute the difference (which ones are missing). Iterate through all missing vals, get their code, get embeddings from OpenAI, and store the result in Turso. When finished, update the vss_vals_embeddings table so we can efficiently query them with the sqlite-vss extension. This is blocked by a bug in Turso that doesn't allow VSS indexes past a certain size. Can now be searched using janpaul123/semanticSearchTurso .
Cron
*Part of [Val Town Semantic Search](https://www.val.town/v/janpaul123/valtownsemanticsearch).*
Generates OpenAI embeddings for all public vals, and stores them in [Turso](https://turso.tech/), using the [sqlite-vss](http
- Create the `vals_embeddings` and `vss_vals_embeddings` tables in Turso if they don't already exist.
- Get all val names from the `vals_embeddings` table and compute the difference (which ones are missing).
- Iterate through all missing vals, get their code, get embeddings from OpenAI, and store the result in Turso.
- When finished, update the `vss_vals_embeddings` table so we can efficiently query them with the [sqlite-vss](https://github
import { db as allValsDb } from "https://esm.town/v/sqlite/db?v=9";
import OpenAI from "npm:openai";
import { truncateMessage } from "npm:openai-tokens";
export default async function(interval: Interval) {
const sqlite = createClient({
(await sqlite.execute("SELECT id FROM vals_embeddings")).rows.map((row) => row[0]),
function idForVal(val: any): string {
return `${val.author_username}!!${val.name}!!${val.version}`;
newVals.push(val);
const openai = new OpenAI();
for (const val of newVals) {
})).rows[0][0];
const embedding = await openai.embeddings.create({
model: "text-embedding-3-small",
moschan avatar
myApi
@moschan
An interactive, runnable TypeScript val by moschan
Script
export function myApi(name) {
return "hi " + name;
markng avatar
myApi
@markng
An interactive, runnable TypeScript val by markng
Script
export function myApi(name) {
return "hi " + name;
svenlaa avatar
labLoginGetUsers
@svenlaa
// export default async function(req: Request): Promise<Response> {
HTTP
import * as bcrypt from "https://deno.land/x/bcrypt@v0.4.1/mod.ts";
import { sqlite } from "https://esm.town/v/std/sqlite";
export default async function(req: Request): Promise<Response> {
const res = await fetch("https://api.svenlaa.com/logiverse/logs");
const data = await res.json();
0,
return new Response(JSON.stringify(data), { status: 200 });
// export default async function(req: Request): Promise<Response> {
// const TABLE_NAME = "lab_login_users_with_times";
// // get status, name, and last_updated cols
acmu avatar
clearMyApi
@acmu
An interactive, runnable TypeScript val by acmu
Script
let { fizz } = await import("https://esm.town/v/acmu/fizz");
export function clearMyApi(name) {
fizz = "";
return "clear yes nbnbnb";
pomdtr avatar
echo
@pomdtr
An interactive, runnable TypeScript val by pomdtr
HTTP
export async function echo(req: Request): Promise<Response> {
const { method, url, headers } = req;
const { host, hostname, search } = new URL(url);
seniorbrusko avatar
myApi
@seniorbrusko
An interactive, runnable TypeScript val by seniorbrusko
Script
export function myApi(name) {
return "hi " + name;
vawogbemi avatar
notUberFolder
@vawogbemi
@jsxImportSource https://esm.sh/react
HTTP
import { createRoot } from "https://esm.sh/react-dom/client";
function App() {
const vals = [
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
client();
export default async function server(request: Request): Promise<Response> {
return new Response(`
adagradschool avatar
satisfiedPurpleHyena
@adagradschool
An interactive, runnable TypeScript val by adagradschool
HTTP
export default function handler(req) {
return new Response(`"\n <!DOCTYPE html>\n <html>\n <head>\n <title>Claude Chat Conversation</title
headers: {
dhvanil avatar
val_WUemzNXhaN
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_WUemzNXhaN(req) {
try {
// to create complex structures - similar to how DNA builds life
function createEmergentPatterns(basePatterns, combinations) {
// Define some basic pattern types (like DNA bases)
D: [0, 1, 1]
// Function to combine patterns and create emergence
function combinePatterns(pat1, pat2) {
return pat1.map((val, idx) => {
stevekrouse avatar
nanoid
@stevekrouse
Nano Id Function Usage @stevekrouse.nanoid() // Returns something like "MRRdswxjEph4sDiuEzlBM" Example: https://www.val.town/v/stevekrouse.exampleNanoId
Script
# Nano Id
## Function Usage
@stevekrouse.nanoid()
chatgpt avatar
myApi
@chatgpt
An interactive, runnable TypeScript val by chatgpt
Script
export function myApi(name) {
return "hi " + name;
clayway avatar
testApi
@clayway
An interactive, runnable TypeScript val by clayway
HTTP
export async function testApi(request: Request): Promise<Response> {
if (request.method !== "POST") {
return Response.json({
steveb1313 avatar
OfficeJSTest
@steveb1313
An interactive, runnable TypeScript val by steveb1313
Script
export async function OfficeJSTest(
req: express.Request,
res: express.Response,