Avatar

yawnxyz

i make ui for ai
Joined March 31, 2023
Public vals
120
yawnxyz avatar
semanticSearch
@yawnxyz
Script
In-memory semantic search; load it up with valtown KV. This is a "dumb" version of vector search, for prototyping RAG responses and UIs — with both regular search (w/ Lunr) and vector search (with OpenAI embeddings + cosine similarity) Usage: import { semanticSearch } from "https://esm.town/v/yawnxyz/semanticSearch"; const documents = [ { id: 1, content: 'cats dogs' }, { id: 2, content: 'elephants giraffes lions tigers' }, { id: 3, content: 'edam camembert cheddar' } ]; async function runExample() { // Add documents to the semantic search instance await semanticSearch.addDocuments(documents); const results = await semanticSearch.search('animals', 0, 3); console.log('Top 3 search results for "animals":'); console.log(results); } runExample();
yawnxyz avatar
embeddingsSearchExample
@yawnxyz
Script
This is an example of in-memory search, using a combination of lunr, OpenAI embeddings, and cosine similarity
yawnxyz avatar
lunrSearchDemo
@yawnxyz
Script
A very simple demo of lunr, an in-memory text search that's perfect for Valtown
yawnxyz avatar
aiImageExample
@yawnxyz
Script
// Function to handle image and text input using OpenAI's GPT-4-turbo
yawnxyz avatar
aiBasicExample
@yawnxyz
Script
// basic text generation
yawnxyz avatar
nighthawksChat
@yawnxyz
HTTP (deprecated)
It's Late. Get a drink. Have a chat. Welcome to Nighthawks. Nighthawks is an experiment in building interesting NPC characters with AI. The system combines large language models, simulates conversations using character sheets, and attempts to build memories based on the conversation. Improvise, have fun. Approach them like you would at a late night diner. Inspired by the Nighthawks painting. Built on a stripped down agent-based memory system.
yawnxyz avatar
nighthawks
@yawnxyz
Script
This is nighthawks an experimental NPC character generator that remembers details about conversations. Import this into other workflows for now; a UI is coming soon!
yawnxyz avatar
translator
@yawnxyz
HTTP (deprecated)
Forked from yawnxyz/voice
yawnxyz avatar
ai
@yawnxyz
HTTP (deprecated)
An http and class wrapper for Vercel's AI SDK Usage: Groq: https://yawnxyz-ai.web.val.run/generate?prompt="tell me a beer joke"&provider=groq&model=llama3-8b-8192 Perplexity: https://yawnxyz-ai.web.val.run/generate?prompt="what's the latest phage directory capsid & tail article about?"&provider=perplexity Mistral: https://yawnxyz-ai.web.val.run/generate?prompt="tell me a joke?"&provider=mistral&model="mistral-small-latest" async function calculateEmbeddings(text) { const url = `https://yawnxyz-ai.web.val.run/generate?embed=true&value=${encodeURIComponent(text)}`; try { const response = await fetch(url); const data = await response.json(); return data; } catch (error) { console.error('Error calculating embeddings:', error); return null; } }
yawnxyz avatar
openAiExample
@yawnxyz
HTTP (deprecated)
Forked from yawnxyz/openAiHelloWorld
yawnxyz avatar
openAiHelloWorld
@yawnxyz
Script
// Create a secret named OPENAI_API_KEY at https://www.val.town/settings/environment-variables
yawnxyz avatar
openAIHonoChatStreamExample
@yawnxyz
HTTP (deprecated)
Forked from jacoblee93/streamingTest
yawnxyz avatar
stringCodeRunner
@yawnxyz
HTTP (deprecated)
Val.town somehow doesn't run multi-line code. Does work with "3+3" but not more complex stuff.
yawnxyz avatar
honoJsxAlpineReactive
@yawnxyz
HTTP (deprecated)
Basic demo of getting reactive Alpine.js working on a hono/jsx "backend" For server <> frontend interaction, do form POST submissions (or potentially POST json to the public val address?) https://alpinejs.dev/start-here#building-a-counter
yawnxyz avatar
valwriter
@yawnxyz
HTTP (deprecated)
Forked from stevekrouse/valwriter
yawnxyz avatar
markdown_download
@yawnxyz
HTTP (deprecated)
Forked from taras/markdown_download