3/**
4 * Create a new Qdrant collection in an existing cluster with the given name
5 * Uses recommended values for OpenAPI embeddings
6 */
7export async function createQdrantCollection(args: {
16 method: "PUT",
17 headers: {
18 "api-key": qdrantKey,
19 "Content-Type": "application/json",
20 },
3
4export async function sendRandomChihuahuaToSlack() {
5 const dogAPIURL = new URL(
6 "https://dog.ceo/api/breed/chihuahua/images/random",
7 );
8 const dogApiResp = await fetch(dogAPIURL.href);
9 const { message } = await dogApiResp.json();
10 const res = await fetch(process.env.BROOKLAND_SLACK_WEBHOOK_URL, {
11 method: "POST",
6 }
7 const [author, name] = val.split(".");
8 const resp = await fetch(`https://api.val.town/v1/alias/${author}/${name}`);
9 if (resp.status !== 200) {
10 throw new Error(resp.statusText);
8 for (let i = 0; i < count; i++) {
9 let start = Date.now();
10 await fetch("https://api.val.town/eval/(()=%3E1+1)()");
11 evalTimes.push(Date.now() - start);
12 }
23 for (let i = 0; i < count; i++) {
24 let start = Date.now();
25 await fetch("https://api.val.town/eval/@healeycodes.addOnes()");
26 userFuncTimes.push(Date.now() - start);
27 }
5 throw new Error(`${fetchJSON.impl.toString()}`);
6 return fetchJSON(
7 "https://api.github.com/users/stevekrouse/following"
8 );
9})();
6 // Fetch a YAML file
7 const yaml = await fetch(
8 "https://raw.githubusercontent.com/docker/engine/8955d8da8951695a98eb7e15bead19d402c6eb27/api/swagger.yaml",
9 ).then((r) => r.text());
10 // parse the fetched file
5 const response =
6 (await fetch(
7 "https://api.val.town/v1/run/politelyinvinciblepointer.handleForm",
8 {
9 method: "POST",
1let { twitterAPIDown } = await import("https://esm.town/v/stevekrouse/twitterAPIDown");
2import process from "node:process";
3import { msHour } from "https://esm.town/v/stevekrouse/msHour";
4import { twitterSearch } from "https://esm.town/v/stevekrouse/twitterSearch";
5
6// let's poll the elevated v2 twitter api
7// until it's down, and store the state in
8// @stevekrouse.twitterAPIDown ({ down: boolean, reason: string})
9export async function checkIfTwitterAPIIsDown() {
10 try {
11 // query for something we know will return results
16 });
17 if (results.length) {
18 // if we get results, the API is still up
19 twitterAPIDown = {
20 down: false,
21 reason: `search returned ${results.length} results at ${new Date()}`,
22 };
23 } else {
24 // no results = API down
25 twitterAPIDown = {
26 down: true,
27 reason: `search returned ${results.length} results at ${new Date()}`,
29 }
30 } catch (e) {
31 // if there's an error, the API is also likely down
32 twitterAPIDown = {
33 down: false,
34 reason: `search errored ${e.message} at ${new Date()}`,
1export function myApi(name) {
2 return "hi " + name;
3}
17 };
18 } = await fetchJSON(
19 "https://api.openai.com/v1/images/generations",
20 {
21 method: "POST",