Search

Results include substring matches and semantically similar vals. Learn more
yawnxyz avatar
aiBasicExample
@yawnxyz
// basic text generation
Script
import { ModelProvider, modelProvider } from "https://esm.town/v/yawnxyz/ai";
// basic text generation
let response = await modelProvider.gen({
prompt: 'hello, who am I speaking to?',
provider: 'google',
console.log('res:', response);
dhvanil avatar
web_2l64kXRF3P
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function web_2l64kXRF3P(req) {
return new Response(`<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>The Silent Syntax: How AI is Rewiring Human Communication</title>
<style>
body {
background-color: #0a0a0a;
yawnxyz avatar
aiStreamingExample
@yawnxyz
An interactive, runnable TypeScript val by yawnxyz
HTTP
export default async (req) => {
const { readable, writable } = new TransformStream();
const writer = writable.getWriter();
const textEncoder = new TextEncoder();
// Get the prompt from the URL query
const url = new URL(req.url);
const prompt = url.searchParams.get("prompt") || "tell me a joke";
if (!prompt || prompt.trim() === "") {
return new Response("Please provide a prompt in the URL query.", {
headers: {
cotr avatar
launch_thrifty_idea_generator
@cotr
An interactive, runnable TypeScript val by cotr
HTTP
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response("ok");
const searchParams = new URL(req.url).searchParams;
console.log(searchParams);
const topic = searchParams.get("topic");
console.log(topic);
try {
const apiKey = Deno.env.get("GEMINI_API_KEY");
const url = "https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-pro-latest:generateContent";
dhvanil avatar
web_whzyD0pbS0
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function web_whzyD0pbS0(req) {
return new Response(`<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>The Dark Hours: When AI Goes Quantum</title>
<style>
body {
font-family: 'Courier New', monospace;
kingishb avatar
grayFinch
@kingishb
Quick AI web search via email (useful for apple watch)
Email
Quick AI web search via email (useful for apple watch)
// A dumb search engine I can use from my apple watch by emailing a question.
export default async function(e: Email) {
if (!e.from.endsWith("<brian@sarriaking.com>")) {
console.error("unauthorized!", e.from);
return;
const resp = await fetch("https://api.perplexity.ai/chat/completions", {
method: "POST",
headers: {
"accept": "application/json",
pomdtr avatar
ask_ai_web
@pomdtr
An interactive, runnable TypeScript val by pomdtr
Script
import { Hono } from "npm:hono";
const app = new Hono();
kora avatar
aiBasicExample
@kora
Using Vercel AI SDK
Script
Using Vercel AI SDK
import { ModelProvider, modelProvider } from "https://esm.town/v/yawnxyz/ai";
// basic text generation
let response = await modelProvider.gen({
prompt: "hello, who am I speaking to?",
provider: "google",
} as any);
console.log("res:", response);
fal avatar
creative_upscaler
@fal
Creative Upscaler link to val - https://www.val.town/v/fal/creative_upscaler Usage const upscaledImage = @fal.creative_upscaler("an owl", "https://storage.googleapis.com/falserverless/model_tests/upscale/owl.png") Usage import fal from "npm:@fal-ai/serverless-client"; const result = await fal.subscribe("fal-ai/creative-upscaler", { input: { prompt: "an owl", image_url: "https://storage.googleapis.com/falserverless/model_tests/upscale/owl.png", }, logs: true, onQueueUpdate: (update) => { if (update.status === "IN_PROGRESS") { update.logs.map((log) => log.message).forEach(console.log); } }, }); https://www.fal.ai/models/creative-upscaler
Script
## Creative Upscaler
link to val - https://www.val.town/v/fal/creative_upscaler
### Usage
```js
const upscaledImage = @fal.creative_upscaler("an owl", "https://storage.googleapis.com/falserverless/model_tests/upscale/owl.
### Usage
export let creativeUpscaler = async (
prompt: string,
image_url: string,
creativity: number = 0.5,
vlad avatar
gptApiFramework
@vlad
Allows for automatic generation of Hono API comatible with GPTs. Endpoints' inputs and outputs need to be specified via types from which the Open API spec is generated automatically and available via /gpt/schema endpoint. Usage example: import { GptApi } from "https://esm.town/v/xkonti/gptApiFramework"; import { z } from "npm:zod"; /** * COMMON TYPES */ const ResponseCommandSchema = z.object({ feedback: z.string().describe("Feedback regarding submitted action"), command: z.string().describe("The command for the Mediator AI to follow strictly"), data: z.string().optional().describe("Additional data related to the given command"), }).describe("Contains feedback and further instructions to follow"); export type ResponseCommand = z.infer<typeof ResponseCommandSchema>; /** * INITIALIZE API */ const api = new GptApi({ url: "https://xkonti-planoverseerai.web.val.run", title: "Overseer AI API", description: "The API for interacting with the Overseer AI", version: "1.0.0", }); /** * REQUIREMENTS GATHERING ENDPOINTS */ api.nothingToJson<ResponseCommand>({ verb: "POST", path: "/newproblem", operationId: "new-problem", desc: "Endpoint for informing Overseer AI about a new problem presented by the User", requestSchema: null, requestDesc: null, responseSchema: ResponseCommandSchema, responseDesc: "Instruction on how to proceed with the new problem", }, async (ctx) => { return { feedback: "User input downloaded. Problem analysis is required.", command: await getPrompt("analyze-problem"), data: "", }; }); export default api.serve();
Script
Allows for automatic generation of Hono API comatible with GPTs. Endpoints' inputs and outputs need to be specified via types
Usage example:
```ts
* COMMON TYPES
const ResponseCommandSchema = z.object({
feedback: z.string().describe("Feedback regarding submitted action"),
export interface ApiInfo {
url: string;
title: string;
description: string;
jeffreyyoung avatar
specialBlueGopher
@jeffreyyoung
An interactive, runnable TypeScript val by jeffreyyoung
HTTP
const replicate = new Replicate({
auth: Deno.env.get("REPLICATE_API_KEY"),
export default serve({
async *handleMessage(req) {
const lastMsg = req.query.at(-1);
const imgUrl = lastMsg?.attachments?.at?.(0)?.url;
const maskUrl = lastMsg?.attachments?.at?.(1)?.url;
const prompt = lastMsg?.content?.trim();
if (!imgUrl || !maskUrl || !prompt) {
yield "Please include a prompt, an image and a mask";
fal avatar
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",
pomdtr avatar
smallweb
@pomdtr
More details about smallweb at https://smallweb.run
Script
More details about smallweb at <https://smallweb.run>
import type openapi from "npm:smallweb@0.14.4";
if (!Deno.env.get("SMALLWEB_API_URL")) {
throw new Error("Missing SMALLWEB_API_URL");
if (!Deno.env.get("SMALLWEB_API_TOKEN")) {
throw new Error("Missing SMALLWEB_API_TOKEN");
export const smallweb = createClient<NormalizeOAS<typeof openapi>>({
endpoint: Deno.env.get("SMALLWEB_API_URL"),
globalParams: {
headers: { Authorization: `Bearer ${Deno.env.get("SMALLWEB_API_TOKEN")}` },
tr3ntg avatar
googleGenerativeAIStreamingExample
@tr3ntg
Google Generative AI Streaming Example Example Val showing how to set up an authenticated Google GoogleGenerativeAI client. Prerequisite: Follow Google's Getting Started guide to get an API key and view some example methods.
HTTP
# Google Generative AI Streaming Example
Example Val showing how to set up an authenticated Google `GoogleGenerativeAI` client.
**Prerequisite:**
Follow Google's [Getting Started guide](https://ai.google.dev/gemini-api/docs/get-started/tutorial?lang=node) to get an API k
export default async function(req: Request): Promise<Response> {
const genAI = new GoogleGenerativeAI(Deno.env.get("your-api-key"));
const generativeModel = genAI.getGenerativeModel({
model: "gemini-1.5-flash-001",
const request = {
contents: [{ role: "user", parts: [{ text: "How are you doing today?" }] }],
isidentical avatar
falSDXLExample
@isidentical
An interactive, runnable TypeScript val by isidentical
Script
import * as fal from "npm:@fal-ai/serverless-client";
fal.config({
// Can also be auto-configured using environment variables:
credentials: Deno.env.get("FAL_KEY"),
const prompt = "a cute and happy dog";
const result: any = await fal.run("fal-ai/fast-lightning-sdxl", { input: { prompt } });
console.log(result.images[0].url);