21 const model = await builder();
22 const input = await prompt.format({
23 question: "What is the capital of France?",
24 });
25 const response = await model.call(input);
1import { chatMessages } from "https://esm.town/v/mario/chatMessages";
2
3// https://api.val.town/express/@nimalu.chat
4export const chat = (req, res) => {
5 const messages = chatMessages
27 li.innerHTML = '<span class="font-semibold text-gray-900">' + sender + '</span>: ' + message;
28 ul.appendChild(li)
29 fetch("https://api.val.town/eval/@nimalu.sendChatMessage('" + message + "','"+ sender + "')")
30 }
31
6 res: express.Response,
7) {
8 let response = await fetch("https://api.onepeloton.com/auth/login", {
9 method: "POST",
10 mode: "no-cors",
21 const session = await response.json();
22 let workoutResponse = await fetch(
23 `https://api.onepeloton.com/api/user/${session["user_id"]}/workouts`,
24 {
25 method: "GET",
38 );
39 const airtable = new Airtable({
40 apiKey: process.env.airTablePelo,
41 baseId: process.env.airTableBase,
42 tableName: "Table 1",
11export async function fetchCongressTradeReports(callback) {
12 const res = await fetchJSON(
13 "https://bff.capitoltrades.com/trades?sortBy=-pubDate"
14 );
15 const trades = res.data;
3export const getTrains = (async () => {
4 const skerries = await fetch(
5 "https://irish-rail-rest-api.fly.dev/stations/SKRES/timetable",
6 ).then((res) => res.json());
7 const connolly = await fetch(
8 "https://irish-rail-rest-api.fly.dev/stations/CNLLY/timetable",
9 ).then((res) => res.json());
10 return {
1import { testMutateSemantics } from "https://esm.town/v/stevekrouse/testMutateSemantics";
2
3export const unauthenticatedCanMutateViaObjectSneak = (api) =>
4 testMutateSemantics({
5 stateName: "@stevekrouse.testState",
6 api,
7 expected: (old, next) => next.n2 === next.n,
8 mutator: (now) => `(() => {
1export function myApi(name) {
2 console.email("yay " + name);
3 return "hi :)" + name;
3export let convertCurrency = async (desired, base = "usd", amount = 1) => {
4 let { rates } = await fetchJSON(
5 `https://open.er-api.com/v6/latest/${base}`,
6 );
7 if (rates && rates[desired.toUpperCase()])
9 else {
10 let { rates } = await fetchJSON(
11 "https://api.coingecko.com/api/v3/exchange_rates",
12 );
13 return amount * rates[desired.toLowerCase()]?.value /
1export function myApi(name) {
2 return "hi " + name;
3}
1export function myApi(name) {
2 return "hi " + name;
3}