12
13- Click `Fork` on this val
14- Get your Braintrust API key at https://www.braintrust.dev/app/settings?subroute=api-keys
15- Add it to your project `Environment Variables` (on the left side bar of this project) as `BRAINTRUST_API_KEY`
16- Click `Run` on the `tutorial` val
4export default async function handler() {
5 const result = {
6 apiKeyStatus: null,
7 evalStarted: false,
8 evalComplete: false,
12
13 try {
14 // Check API key
15 const apiKey = Deno.env.get("BRAINTRUST_API_KEY");
16 if (!apiKey) {
17 throw new Error("Add BRAINTRUST_API_KEY to your environment variables");
18 }
19 result.apiKeyStatus = "found";
20 console.log("API Key status:", result.apiKeyStatus);
21
22 // Start evaluation
12
13- Click `Fork` on this val
14- Get your Braintrust API key at https://www.braintrust.dev/app/settings?subroute=api-keys
15- Add it to your project [Environment Variables](https://www.val.town/settings/environment-variables) as `BRAINTRUST_API_KEY`
16- Click `Run` on the `tutorial` val
12
13- Click `Fork` on this val
14- Get your Braintrust API key at https://www.braintrust.dev/app/settings?subroute=api-keys
15- Add it to your project `Environment Variables` (on the left side bar of this project) as `BRAINTRUST_API_KEY`
16- Click `Run` on the `tutorial` val
3import React, { useEffect, useState } from "https://esm.sh/react@18.2.0";
4
5// API Documentation
6/**
7 * @typedef {Object} ProjectState
61 setError(null);
62 try {
63 const response = await fetch("/api/state");
64 if (!response.ok) throw new Error("Failed to fetch state");
65 const data = await response.json();
80 setError(null);
81 try {
82 const response = await fetch("/api/state", {
83 method: "POST",
84 headers: { "Content-Type": "application/json" },
579 await authenticate(req);
580
581 if (req.method === "GET" && req.url.endsWith("/api/state")) {
582 const state = await getState();
583 return Response.json(state || {});
584 } else if (req.method === "POST" && req.url.endsWith("/api/state")) {
585 const update = await req.json();
586 validateInput(update);
1import { BskyAgent } from "npm:@atproto/api";
2
3export async function postToBluesky() {
1# Gemini API
2A simple and easy to use client for the Gemini API
3
4*_This template shows you how to use the Gemini. This starter template was ported from [this one on Docs](https://ai.google.dev/gemini-api/docs/quickstart?lang=node#install-gemini-library)._*
5
6## To run it:
7
8- Click `Fork` on this val
9- Get your [Gemini API key](https://aistudio.google.com/app/apikey)
10- Add it to your [Environment Variables](https://www.val.town/settings/environment-variables) as `GEMINI_API_KEY`
11- Click `Run` on this script val
1# Notion SDK for JavaScript
2A simple and easy to use client for the Notion API
3
4*_This template shows you how to use the Notion SDK. This starter template was ported from [this one on GitHub](https://github.com/makenotion/notion-sdk-js?tab=readme-ov-file#installation)._*
7
8- Click `Fork` on this val
9- Get your Notion API key at https://www.notion.so/profile/integrations
10- Add it to your [Environment Variables](https://www.val.town/settings/environment-variables) as `NOTION_TOKEN`
11- Click `Run` on this script val
5export default async function handler() {
6 const result = {
7 apiKeyStatus: null,
8 evalStarted: false,
9 evalComplete: false,
13
14 try {
15 // Check API key
16 const apiKey = Deno.env.get("BRAINTRUST_API_KEY");
17 if (!apiKey) {
18 throw new Error("Add BRAINTRUST_API_KEY to your environment variables");
19 }
20 result.apiKeyStatus = "found";
21 console.log("API Key status:", result.apiKeyStatus);
22
23 // Start evaluation
1export default function handler(req: Request) {
2 return new Response("Hello, Val Town API!", {
3 headers: {
4 "Content-Type": "text/plain"