Search

Results include substring matches and semantically similar vals. Learn more
bluemsn avatar
getModelBuilder
@bluemsn
An interactive, runnable TypeScript val by bluemsn
Script
async () => {
const { OpenAIEmbeddings } = await import(
"npm:langchain/embeddings/openai"
return new OpenAIEmbeddings(args);
matches({ type: "llm", provider: "huggingface" }),
await import("npm:@huggingface/inference");
const { HuggingFaceInferenceEmbeddings } = await import(
"npm:langchain/embeddings/hf"
return new HuggingFaceInferenceEmbeddings(args);
// Return function to prevent "Serialization Error"
wilt avatar
createQdrantCollection
@wilt
* Create a new Qdrant collection in an existing cluster with the given name * Uses recommended values for OpenAPI embeddings
Script
import { fetch } from "https://esm.town/v/std/fetch";
* Create a new Qdrant collection in an existing cluster with the given name
* Uses recommended values for OpenAPI embeddings
export async function createQdrantCollection(args: {
collectionName: string;
yawnxyz avatar
SidebarToArchive
@yawnxyz
Sidebar.io Archiver Sidebar's been one of my biggest design resources for the last decade. Since sidebar.io's break announcement this morning (https://sidebar.io/break/) I've set out to mess around with using Val.town to archive sidebar. The Google Sheet can be found here: https://docs.google.com/spreadsheets/d/1RghvMfPTR5xvHMAk1pKYuH2pFYYKOJ6bH0LLkHNZiuc/edit?usp=sharing Initially I was just piping data to Google Sheets but that's slow, wasteful and kind of dumb... instead I just wrapped Hono around the code to provide a download the CSV to browser.
HTTP (deprecated)
try {
// let embeddings = await modelProvider.gen({
// embed: true,
// value: JSON.stringify(link)
// console.log(`Adding link ${counter}:`, link.title, link.url, embeddings);
console.log(`Adding link ${counter}:`, link.title, link.url);
data: JSON.stringify(link),
// embeddings: embeddings.embedding.join(','),
} finally {
jacoblee93 avatar
runAgent
@jacoblee93
An interactive, runnable TypeScript val by jacoblee93
Script
-----Header tweet-----
@LangChainAI πŸ¦œπŸ”— JS/TS 0.0.83 out with loads of @GoogleAI and PaLM!
πŸ’¬ Google Vertex AI chat model + embeddings
πŸ”Ž Google Custom Search tool
⛓️ API chain: make API calls from docs
elsif_maj avatar
topHNThreadByHour
@elsif_maj
// set at Thu Nov 30 2023 14:22:53 GMT+0000 (Coordinated Universal Time)
Email
// set at Thu Nov 30 2023 14:22:53 GMT+0000 (Coordinated Universal Time)
's autonomous vehicle deployment","Top thread on Hackernews for 10:00 is: Embeddings: What they are and why they matter","Top
rlesser avatar
CohereEmbed
@rlesser
An interactive, runnable TypeScript val by rlesser
Script
import { CohereCommon } from "https://esm.town/v/rlesser/CohereCommon";
export let CohereEmbed = (key: string, texts: Array<string>, options = {}) => {
// see endpoint options here: https://docs.cohere.ai/reference/embed
const defaultOptions = {
truncate: "END",
return CohereCommon(key, "embed", {
...defaultOptions,
...options,
texts,
neverstew avatar
embedSelf
@neverstew
* This val embeds itself in the web page created by hitting it's Web Endpoint!
HTTP (deprecated)
* This val embeds itself in the web page created by hitting it's Web Endpoint!
export let embedSelf = async (request: Request): Promise<Response> => {
return new Response(
<style>
:root { background: "white"; font-family: sans-serif; }
</style>
<h1>My cool new val</h1>
<iframe
id="val_embedded"
title="Embedded Val Example"
pomdtr avatar
embed
@pomdtr
An interactive, runnable TypeScript val by pomdtr
Script
const script = document.querySelector(`[src="https://esm.town/v/pomdtr/embed"]`);
if (!script) {
throw new Error("could not find script");
const wrapperID = script.getAttribute("data-element-id");
const wrapper = document.getElementById(wrapperID);
const code = wrapper.textContent;
const iframe = document.createElement("iframe", { is: "iframe" });
iframe.src = `https://easrng-playground.web.val.run?code=${encodeURIComponent(code)}`;
iframe.style.border = "none";
iframe.style.width = "500px";
pomdtr avatar
embed_demo
@pomdtr
An interactive, runnable TypeScript val by pomdtr
HTTP (deprecated)
const html = `
<h3 style="text-align: center;">Welcome to my website</h3>
<script src="https://esm.town/v/pomdtr/embed" data-element-id="my-element" type="module"></script>
<!-- anywhere else on your page -->
<div id="my-element">
console.log("hello world!")
</div>
export default function(req: Request) {
return new Response(
html,
petermillspaugh avatar
lessons
@petermillspaugh
An interactive, runnable TypeScript val by petermillspaugh
Script
export const lessons = {
0: retrievalPractice,
1: spacedRepetition,
2: interleaving,
3: variedPractice,
4: elaborationAndReflection,
5: encodingAndConsolidation,
6: generation,
7: growthMindset,
8: yourBrain,
petermillspaugh avatar
encodingAndConsolidation
@petermillspaugh
@jsxImportSource https://esm.sh/react
Script
/** @jsxImportSource https://esm.sh/react */
* Note: this lesson is a work in progress πŸ‘·β€β™‚οΈ
const TITLE = "Encoding & consolidation";
// TODO: better prompt
const FILL_BLANK = <>Where are memories stored in your brain?</>;
const CONTENT = (
<h2>Memory traces</h2>
<p>
A memory trace is a metaphorical/theoretical term for the brain’s representation of some knowledge or memory. The
β€œtrace” includes synaptic connections between neurons. Also known as an β€œengram”.
3
Next