Search
Code47
import { hnSearch } from "https://esm.town/v/stevekrouse/hnSearch";import { ComputeJSON, ComputeText, sb, Substrate } from "npm:substrate";import { z } from "npm:zod";import { zodToJsonSchema } from "npm:zod-to-json-schema";const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });// search for HN comments using https://hn.algolia.com/api});markdown.id = "markdown";const stream = await substrate.stream(markdown);// Render streaming markdownexport default async function handler(req: Request): Promise<Response> { const renderMarkdown = (await import("https://esm.town/v/substrate/renderMarkdown")).default; return renderMarkdown(stream);}Find comments on HN (powered by [Algolia](https://hn.algolia.com/api)), extract content and return a streaming markdown summary (powered by [Substrate](https://substrate.run)).The RAG portion of this is 34 lines of Substrate code. Read the walkthrough: https://x.com/vprtwn/status/1812844236401762513🪩 To fork, [sign up for Substrate](https://substrate.run/signin) to get your own API key and $50 free credits. See also:- https://www.val.town/v/substrate/twitterRAG[sub.audio](https://sub.audio) – generate subtitles and chapters for any audio URL.Speech-to-text and chapter summaries powered by [Substrate](https://substrate.run)🪩 To fork, [sign up for Substrate](https://substrate.run/signin) to get your own API key and $50 free creditsMigrated from folder: Archive/subaudioFind comments on HN (powered by [Algolia](https://hn.algolia.com/api)), extract content and return a streaming markdown summary (powered by [Substrate](https://substrate.run)).The RAG portion of this is 34 lines of Substrate code. Read the walkthrough: https://x.com/vprtwn/status/1812844236401762513🪩 To fork, [sign up for Substrate](https://substrate.run/signin) to get your own API key and $50 free credits. See also:- https://www.val.town/v/substrate/twitterRAGimport { hnSearch } from "https://esm.town/v/stevekrouse/hnSearch";import { ComputeJSON, ComputeText, sb, Substrate } from "npm:substrate";import { z } from "npm:zod";import { zodToJsonSchema } from "npm:zod-to-json-schema";const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });// search for HN comments using https://hn.algolia.com/api model: "Llama3Instruct70B",}); markdown.id = "markdown"const stream = await substrate.stream(markdown);// Render streaming markdownexport default async function handler(req: Request): Promise<Response> { const renderMarkdown = (await import("https://esm.town/v/substrate/renderMarkdown")).default; return renderMarkdown(stream);}Inspired by https://github.com/rectanglehq/Shapeshift [HN thread](https://news.ycombinator.com/item?id=40972130)Check out [Substrate](https://substrate.run/)!Migrated from folder: ExamplesAndForks/substrate/shapeshiftimport { ComputeJSON, ComputeText, sb, Substrate } from "npm:substrate";import { z } from "npm:zod";import { zodToJsonSchema } from "npm:zod-to-json-schema";const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY")});const sourceObj = { json_schema: zodToJsonSchema(TargetObjSchema),})const res = await substrate.run(json);console.log(JSON.stringify(res.get(json).json_object, null, 2));Generates a streaming illustrated primer on a subject. Enter a subject, click on titles to "delve".🪩 To fork, [sign up for Substrate](https://substrate.run/signin) to get your own API key and $50 free credits Migrated from folder: ExamplesAndForks/substrate/illustratedPrimerimport inputHeader from "https://esm.town/v/substrate/inputHeader";import { ComputeJSON, ComputeText, GenerateImage, sb, Substrate } from "npm:substrate";import { z } from "npm:zod";import { zodToJsonSchema } from "npm:zod-to-json-schema"; const input = new URL(req.url).searchParams.get("input") || "modernism"; // Substrate graph const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY_R") }); const Topic = z .object({ const image4 = new GenerateImage({ prompt: prompt4.future.text }); const nodes = [image1, caption1, image2, caption2, image3, caption3, image4, caption4]; const stream = await substrate.stream(...nodes); // UIimport urlHeader from "https://esm.town/v/substrate/urlHeader";import Exa from "npm:exa-js";import { ComputeText, GenerateImage, sb, Substrate } from "npm:substrate";const exa = new Exa(Deno.env.get("EXA_API_KEY"));const substrate = new Substrate({ apiKey: Deno.env.get("SUBSTRATE_API_KEY") });export default async function handler(req: Request): Promise<Response> { model: "Llama3Instruct70B", }); const stream = await substrate.stream(summary); let { readable, writable } = new TransformStream();Docs
No docs found