Search

Results include substring matches and semantically similar vals. Learn more
prashamtrivedi avatar
ThankYouNoteGenerator
@prashamtrivedi
@jsxImportSource https://esm.sh/react
HTTP
console.log(`Received ${request.method} request to ${request.url}`);
const { OpenAI } = await import("https://esm.town/v/std/openai");
const { sqlite } = await import("https://esm.town/v/stevekrouse/sqlite");
const openai = new OpenAI();
const url = new URL(request.url);
console.log("Generated prompt:", prompt);
const completion = await openai.chat.completions.create({
messages: [{ role: "user", content: prompt }],
stevekrouse avatar
townie_prompt
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
export const TOWNIE_SYSTEM_PROMPT =
ps://esm.town/v/stevekrouse/sqlite\");`\n </library>\n\n <library>\n ## OpenAI\n\n Val Town includes a free, proxied
boots avatar
VOTelCollector
@boots
This was the WIP proof of concept for setting up an OTel collector for traces emitted by @fiberplane/hono-otel The finished project is here : https://www.val.town/x/fiberplane/OpenTelemetryCollector OpenSource Tracing on ValTown backed by sqlite! Woo! WOOOOOOO!
HTTP
"value": {
"stringValue":
"{\"OPENAI_API_KEY\":\"sk-proj-uoRQ71Oaz16IbDJRJXY5T3BlbkFJgqSSf3Xglg0V0V2FhFrO\",\"ANTHROPIC_API_KEY
"key": "http.request.header.accept",
"value": {
"key": "fpx.http.request.env",
"value": {
"stringValue": "{\"OPENAI_API_KEY\":\"sk-proj-uoRQ71Oaz16IbDJRJXY5T3BlbkFJgqSSf3Xglg0V0V2FhFrO\",\"ANTHRO
"key": "http.request.header.accept",
"value": {
tmcw avatar
big_stories_ranks
@tmcw
// set by tmcw.big_story at 2023-07-21T13:27:35.553Z
Script
"ranks": [[1689676050115, 8], [1689679650435, 9], [1689683250422, 9], [1689686850141, 9], [1689690449649, 9], [1689694050
"https://www.nytimes.com/2023/07/18/technology/openai-chatgpt-facial-recognition.html": {
"title": "OpenAI Worries About What Its Chatbot Will Say About People’s Faces",
"url": "https://www.nytimes.com/2023/07/18/technology/openai-chatgpt-facial-recognition.html",
"section": "technology",
eugenechantk avatar
testExaJs
@eugenechantk
Testing Exa's JS SDK
Script
Testing Exa's JS SDK
const exa = new Exa("f2e3bc4c-a68d-4dcb-abf6-a34ee090a576", "https://api-internal.exa.sh");
const result = await exa.getContents(
"https://aisera.com/",
"https://savavo.com/",
"https://www.gridspace.com/",
"https://www.cien.ai/",
"https://www.cognitivescale.com/",
"https://decagon.ai/",
"https://www.talla.com/",
jackolicious avatar
gregariousCopperBaboon
@jackolicious
An interactive, runnable TypeScript val by jackolicious
HTTP
import google.generativeai as genai
genai.configure(api_key="AIzaSyB2cCzvwaObW8x7awAtP3FPVj9RWOvqLzA")
model = genai.GenerativeModel("gemini-1.5-flash")
export default async function (req: Request): Promise<Response> {
response = model.generate_content("Explain how AI works")
print(response.text)
return Response.json({ ok: response.text })
dhvanil avatar
web_YeFlAqrDrR
@dhvanil
An interactive, runnable TypeScript val by dhvanil
HTTP
export async function web_YeFlAqrDrR(req) {
return new Response(`<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TECHNICAL EXPOSURE: AI's Hidden Neural Capabilities</title>
<style>
body {
background-color: #000;
yawnxyz avatar
aiSimpleGroq
@yawnxyz
// set Deno.env.get("GROQ_API_KEY")
Script
import { ai } from "https://esm.town/v/yawnxyz/ai";
// set Deno.env.get("GROQ_API_KEY")
// console.log(await ai("tell me a joke in Spanish"))
console.log(await ai("tell me a reddit joke", {
provider: "anthropic",
model: "claude-3-haiku-20240307",
dinavinter avatar
ai
@dinavinter
An interactive, runnable TypeScript val by dinavinter
Script
asyncBatchEvents,
asyncEventGenerator,
fromAIElementStream,
fromAIEventCallback,
fromAIEventStream,
fromEventAsyncGenerator,
pipeToAI,
} from "https://esm.sh/@cxai/stream@1.0.17?target=esnext&yjs=13.6.20";
export type Actors = {
stream: ReturnType<typeof fromAIEventStream>;
iamseeley avatar
pipeline
@iamseeley
Using Pipeline import Pipeline from "https://esm.town/v/iamseeley/pipeline"; const pipeline = new Pipeline("task", "model"); const result = await pipeline.run(inputs); exampleTranslation exampleTextClassification exampleFeatureExtraction exampleTextGeneration exampleSummarization exampleQuestionAnswering
Script
## Using Pipeline
```ts
const pipeline = new Pipeline("task", "model");
const result = await pipeline.run(inputs);
[exampleTranslation](https://www.val.town/v/iamseeley/exampleTranslation)
[exampleTextClassification](https://esm.town/v/iamseeley/exampleTextClassification)
const HUGGING_FACE_API_URL = "https://api-inference.huggingface.co/models";
const HUGGING_FACE_API_KEY = Deno.env.get("HUGGING_FACE_API_KEY");
const defaultModels = {
"feature-extraction": "sentence-transformers/all-MiniLM-L6-v2",
stevekrouse avatar
gemini2FlashExample
@stevekrouse
An interactive, runnable TypeScript val by stevekrouse
Script
import { GoogleGenerativeAI } from "npm:@google/generative-ai";
const prompt = "What is the meaning of life?";
const genAI = new GoogleGenerativeAI(Deno.env.get("GOOGLE_GENERATIVE_AI"));
const model = genAI.getGenerativeModel(
{ model: "gemini-2.0-flash-exp" },
const result = await model.generateContent(prompt);
console.log(result.response.text());
justbe avatar
oura
@justbe
An interactive, runnable TypeScript val by justbe
Script
import { Oura } from "https://deno.land/x/oura_api@0.3.1/mod.ts";
export const oura = (ouraPersonalAccessToken) => new Oura(ouraPersonalAccessToken);
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: {