Search
coffeeMongoose
@mmrech
An interactive, runnable TypeScript val by mmrech
HTTP
export default async function (req: Request): Promise<Response> {
return Response.json({ ok: true })
}<script src="//code.jquery.com/jquery-1.10.2.min.js"></script>
![webup avatar](https://images.clerk.dev/uploaded/img_2S4HPCT6HNZNKzadzuovxeU1BRZ.webp)
pipeSampleLLMBind
@webup
An interactive, runnable TypeScript val by webup
Script
type: "chat",
provider: "openai",
const model = await mb();
const tracer = await tb();
const functionSchema = [
name: "joke",
const chain = prompt.pipe(model.bind({
functions: functionSchema,
function_call: { name: "joke" },
return await chain.invoke({ subject: "bears" }, { callbacks: [tracer] });
photoEditingAIApp
@roysarajit143
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
import { createRoot } from "https://esm.sh/react-dom@18.2.0/client";
function App() {
const [uploadedImage, setUploadedImage] = useState(null);
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
if (typeof document !== "undefined") { client(); }
export default async function server(request: Request): Promise<Response> {
const { blob } = await import("https://esm.town/v/std/blob");
const { OpenAI } = await import("https://esm.town/v/std/openai");
const openai = new OpenAI();
if (request.method === 'POST') {
const { prompt } = await request.json();
const response = await openai.images.generate({
model: "dall-e-3",
api
@iamseeley
An interactive, runnable TypeScript val by iamseeley
Script
import { API_URL } from "https://esm.town/v/std/API_URL";
export async function api<T = any>(
path: string,
options?: RequestInit & {
val_ZNN6EfQkoJ
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_ZNN6EfQkoJ(req) {
try {
// Execute the code directly and capture its result
![stevekrouse avatar](https://images.clerk.dev/uploaded/img_2PqHa2Gsy93xQrjh2w78Xu0cChW.jpeg)
honEmeraldSnail
@stevekrouse
@jsxImportSource https://esm.sh/react
HTTP
const MODEL = "claude-3-sonnet-20240229";
function applyDiffs(html, diffs) {
console.log("Applying diffs. Initial HTML:", html);
return html; // Return original HTML if any error occurs
function parseHTMLFromResponse(content) {
const htmlMatch = content.match(/```html\s*([\s\S]*?)\s*```/);
return htmlMatch && htmlMatch[1] ? htmlMatch[1].trim() : null;
function parseDiffsFromResponse(content) {
try {
return null;
function App() {
const [messages, setMessages] = useState<Array<{ role: string; content: string }>>([]);
</div>
function client() {
createRoot(document.getElementById("root")).render(<App />);
client();
async function server(request: Request): Promise<Response> {
if (request.method === "POST" && new URL(request.url).pathname === "/api/chat") {
val_4IiypjugcT
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_4IiypjugcT(req) {
try {
// Execute the code directly and capture its result
promptChatGPT
@fadi
An interactive, runnable TypeScript val by fadi
Script
import { runVal } from "https://esm.town/v/std/runVal";
export function promptChatGPT(prompt) {
const gptResponse = runVal("patrickjm.gpt3", {
prompt: prompt,
firstValTest
@YuryKonvpalto
@jsxImportSource https://esm.sh/preact
HTTP
const replicate = new Replicate({
auth: Deno.env.get("REPLICATE_API_TOKEN"),
export default async function(req: Request) {
console.log(22222222);
if (req.method === "POST") {
web_wipah38Po7
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function web_wipah38Po7(req) {
return new Response(`<!DOCTYPE html>
<html>
val_0nQm9ioJc0
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function val_0nQm9ioJc0(req) {
try {
// Execute the code directly and capture its result
// Let's create a simple model of emergence using cellular automata
// This demonstrates how complex patterns can emerge from simple rules
function createCellularAutomata(size, generations) {
let grid = new Array(size).fill(0);
grid[Math.floor(size/2)] = 1; // Start with a single cell in the middle
linearRegression
@iamseeley
An interactive, runnable TypeScript val by iamseeley
HTTP
<div id="plotContainer"></div>
<script>
async function main() {
let pyodide = await loadPyodide();
await pyodide.loadPackage(['numpy', 'pandas', 'scikit-learn', 'matplotlib']);
myApi
@tmcw_onboarding
An interactive, runnable TypeScript val by tmcw_onboarding
Script
export function myApi(name) {
return "hi " + name;
![sokratis avatar](https://images.clerk.dev/oauth_github/img_2RhN4IBR2Em4zruhE1fDiioUEIS.jpeg)
myApi
@sokratis
An interactive, runnable TypeScript val by sokratis
Cron
export function myApi(name) {
console.log("Hello world!");
return "hi " + name;
emojiVectorEmbeddings
@maxm
// Initialize OpenAI client
Script
import { OpenAI } from "npm:openai";
// Initialize OpenAI client
const openai = new OpenAI();
async function getEmbedding(emoji: string): Promise<number[]> {
const result = await openai.embeddings.create({
async function loadEmoji(e: string) {
async function loadAllEmojis() {
export async function searchEmojis(query: string): Promise<string[]> {
// // Function to get all emojis (this is a subset for demonstration)
// function cosineSimilarity(vecA: number[], vecB: number[]): number {