Avatar

yawnxyz

i make ui for ai
Joined March 31, 2023
Public vals
63
yawnxyz avatar
shapeshift
@yawnxyz
Script
Semantically map a JSON object to a target schema using an LLM. (Click "Run") Inspired by https://github.com/rectanglehq/Shapeshift HN thread Check out Substrate !
yawnxyz avatar
illustratedPrimer
@yawnxyz
HTTP
Generates a streaming illustrated primer on a subject. Enter a subject, click on titles to "delve". 🪩 To fork, sign up for Substrate to get your own API key and $50 free credits
yawnxyz avatar
stitchVal
@yawnxyz
HTTP
inspired by https://x.com/dankuntz/status/1813283813881225625 written by Sonnet-3.5 with ~12 prompts and some final manual tweaks
yawnxyz avatar
stringInferExample
@yawnxyz
Script
example of inferring params from a prompt: https://x.com/yawnxyz/status/1812922642510586039 putting results in does wonders use an "extraction guide" to direct results
yawnxyz avatar
pubmed
@yawnxyz
HTTP
Pubmed Search Search Pubmed using a public pubmedisearch endpoint
yawnxyz avatar
citation
@yawnxyz
Script
citation js docs suck - to get JSON output, set 'data' as the type and format: 'object' - to get string output, set 'bibliograph' as the type and format: 'string' - if you get "format error" it means the format of the input, NOT the output template
yawnxyz avatar
urlMetadata
@yawnxyz
Script
// console.log(await getUrlMetadata('https://arstechnica.com/space/2024/06/nasa-indefinitely-delays-return-of-starliner-to-review-propulsion-data/'))
yawnxyz avatar
audioManagerRunner
@yawnxyz
Script
An interactive, runnable TypeScript val by yawnxyz
yawnxyz avatar
processTextInChunks
@yawnxyz
Script
Text Chunk Processor This JavaScript function processes long text inputs by breaking them into smaller chunks, applying a custom processing function to each chunk, and optionally handling overlaps between chunks. Function Signature processTextInChunks(inputText, processFn, config) Parameters inputText (string): The long input text to be processed. processFn (function, optional): A function to process each chunk. Defaults to logging the chunk. config (object, optional): Configuration options. Config Options chunkLength (number): Length of each chunk. Default: 1000. overlapLength (number): Length of overlap between chunks. Default: 0. Usage const longText = "Your very long text here..."; const result = processTextInChunks(longText, (mainChunk, overlapChunk, info) => { // Process the chunk here console.log(`Processing chunk from ${info.startIndex} to ${info.endIndex}`); console.log(`Main chunk: ${mainChunk}`); console.log(`Overlap: ${overlapChunk}`); return mainChunk.length; // Example return value }, { chunkLength: 500, overlapLength: 50 } ); console.log(result); Notes If processFn is not provided, the function will log each chunk and return the original text. If processFn returns a value, these values will be collected in an array and returned. If processFn doesn't return anything, the original input text is returned. The processFn receives three arguments: mainChunk : The current chunk of text being processed. overlapChunk : The overlapping text from the previous chunk (empty for the first chunk). An info object containing: startIndex : Start index of the current chunk in the original text. endIndex : End index of the current chunk in the original text. isLastChunk : Boolean indicating if this is the last chunk. Use Cases Processing large texts in smaller, manageable pieces. Applying transformations or analysis to text while maintaining context through overlaps. Tokenization or parsing of large documents.
yawnxyz avatar
pipeline
@yawnxyz
Script
Using Pipeline import Pipeline from "https://esm.town/v/iamseeley/pipeline"; // ... } else if (req.method === "POST") { const { inputs } = await req.json(); const pipeline = new Pipeline("task", "model"); const result = await pipeline.run(inputs); return new Response(JSON.stringify(result), { headers: { "Content-Type": "application/json" } }); } } exampleTranslation exampleTextClassification exampleFeatureExtraction exampleTextGeneration exampleSummarization exampleQuestionAnswering
yawnxyz avatar
ragwithclaude_ui
@yawnxyz
HTTP
Wanted to build a UI for Simon's thing but he locked it lol
yawnxyz avatar
duckdbExample
@yawnxyz
Script
DuckDB DuckDB works on Val Town, with only one small tweak! We're basically using DuckDB in the same way you'd use it with a browser - using the WASM package with its dependencies fetched from jsdelivr . The only trick is to create the worker ourselves rather than using duckdb.createWorker . DuckDB's built-in createWorker method doesn't specify a worker type, which causes type to default to classic , and Deno (our runtime) doesn't support classic workers.
yawnxyz avatar
upload_url
@yawnxyz
Script
// Function to upload data using Wormhole API and return the URL
yawnxyz avatar
aiSimpleGroq
@yawnxyz
Script
// set Deno.env.get("GROQ_API_KEY")
yawnxyz avatar
blobAdmin
@yawnxyz
HTTP
Blob Admin This is a lightweight Blob Admin interface to view and debug your Blob data. Use this button to install the val: It uses basic authentication with your Val Town API Token as the password (leave the username field blank). TODO [x] /new - render a page to write a new blob key and value [x] /edit/:blob - render a page to edit a blob (prefilled with the existing content) [x] /delete/:blob - delete a blob and render success [x] add upload/download buttons [ ] Use modals for create/upload/edit/view/delete page (htmx ?) [ ] handle non-textual blobs properly [ ] use codemirror instead of a textarea for editing text blobs
yawnxyz avatar
translate
@yawnxyz
HTTP
Translator using a public deepl api