103await email({
104subject: "Website Scraper Error",
105text: `An error occurred while scraping ${WEBSITE_URL}: ${error.message}`,
106});
107}
whackaghostmain.tsx1 match
341<meta name="viewport" content="width=device-width, initial-scale=1.0">
342<title>Whack-a-Ghost</title>
343<link href="https://fonts.googleapis.com/css2?family=Creepster&family=Roboto:wght@400;700&display=swap" rel="stylesheet">
344<style>${css}</style>
345</head>
runescapeWoodCuttingmain.tsx1 match
155<head>
156<title>RuneVal</title>
157<link href="https://fonts.googleapis.com/css2?family=VT323&display=swap" rel="stylesheet">
158<style>${css}</style>
159</head>
denoGameHTMLmain.tsx6 matches
113scoreboard.push({ name, score });
114115// Call the function to update the scoreboard on the Val Town API
116updateScoreboard(name, score);
117}
118119function updateScoreboard(name, score) {
120const apiUrl =
121"https://api.val.town/v1/run/rodrigotello.updateDinoScoreboard";
122123fetch(apiUrl, {
124method: "POST",
125headers: {
158159// Fetch the latest scoreboard data
160const apiUrl =
161"https://api.val.town/v1/run/rodrigotello.dinoGameScoreboard";
162163// Sort the scoreboard by score in descending order
74<title>Ugly and Bloated Website</title>
75<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.min.css">
76<link href="https://fonts.googleapis.com/css2?family=Comic+Neue:wght@700&family=Pacifico&family=Press+Start+2P&display=swap" rel="stylesheet">
77<style>${css}</style>
78</head>
5console.log("Initiating pdf sender");
6const browser = await puppeteer.connect({
7browserWSEndpoint: `wss://connect.browserbase.com?apiKey=${Deno.env.get("BROWSERBASE_API_KEY")}`,
8});
9
anthropicCachingmain.tsx30 matches
1/**
2* This val creates an interactive webpage that demonstrates the functionality of the Anthropic API.
3* It uses a React frontend with an input for the API key and buttons to trigger different operations.
4* The Anthropic API key is stored in the frontend state and sent with each API request.
5*/
61011function App() {
12const [apiKey, setApiKey] = useState("");
13const [outputs, setOutputs] = useState({
14nonCachedCall: "",
2324const runOperation = async (operation: string) => {
25if (!apiKey) {
26alert("Please enter your Anthropic API key first.");
27return;
28}
35"Content-Type": "application/json",
36},
37body: JSON.stringify({ apiKey }),
38});
39const result = await response.text();
52<a href="https://github.com/anthropics/anthropic-cookbook/blob/7786b9f39db8ba65202792f564c59697a5222531/misc/prompt_caching.ipynb#L402">
53this python notebook
54</a>. Enter in your Anthropic API key (which is not saved) and click the buttons to see the results.
55</p>
56<p>
60<input
61type="password"
62placeholder="Enter Anthropic API Key"
63value={apiKey}
64onChange={(e) => setApiKey(e.target.value)}
65/>
66</div>
67<div>
68<button onClick={() => runOperation("nonCachedCall")} disabled={loading.nonCachedCall}>
69Non-cached API Call
70</button>
71<button onClick={() => runOperation("cachedCall")} disabled={loading.cachedCall}>Cached API Call</button>
72<button onClick={() => runOperation("multiTurn")} disabled={loading.multiTurn}>Multi-turn Conversation</button>
73</div>
74<h2>Non-cached API Call Output:</h2>
75<pre>{loading.nonCachedCall ? "Loading..." : outputs.nonCachedCall}</pre>
76<h2>Cached API Call Output:</h2>
77<pre>{loading.cachedCall ? "Loading..." : outputs.cachedCall}</pre>
78<h2>Multi-turn Conversation Output:</h2>
95if (url.pathname === "/run") {
96const operation = url.searchParams.get("operation");
97const { apiKey } = await request.json();
9899if (!apiKey) {
100return new Response("API key is required", { status: 400 });
101}
102104105if (operation === "nonCachedCall") {
106result = await runNonCachedCall(apiKey);
107} else if (operation === "cachedCall") {
108result = "Making two calls, first one to cache...\n\n";
109result += await runCachedCall(apiKey);
110result += "\n\nNow the cached call...\n\n";
111result += await runCachedCall(apiKey);
112} else if (operation === "multiTurn") {
113result = await runMultiTurnConversation(apiKey);
114} else {
115return new Response("Invalid operation", { status: 400 });
146}
147148async function runNonCachedCall(apiKey: string): Promise<string> {
149const { default: anthropic } = await import("npm:@anthropic-ai/sdk@0.26.1");
150const client = new anthropic.Anthropic({ apiKey });
151const MODEL_NAME = "claude-3-5-sonnet-20240620";
152175const elapsedTime = (endTime - startTime) / 1000;
176177return `Non-cached API call time: ${elapsedTime.toFixed(2)} seconds
178Input tokens: ${response.usage.input_tokens}
179Output tokens: ${response.usage.output_tokens}
182}
183184async function runCachedCall(apiKey: string): Promise<string> {
185const { default: anthropic } = await import("npm:@anthropic-ai/sdk@0.26.1");
186const client = new anthropic.Anthropic({ apiKey });
187const MODEL_NAME = "claude-3-5-sonnet-20240620";
188212const elapsedTime = (endTime - startTime) / 1000;
213214return `Cached API call time: ${elapsedTime.toFixed(2)} seconds
215Input tokens: ${response.usage.input_tokens}
216Output tokens: ${response.usage.output_tokens}
221}
222223async function runMultiTurnConversation(apiKey: string): Promise<string> {
224const { default: anthropic } = await import("npm:@anthropic-ai/sdk@0.26.1");
225const client = new anthropic.Anthropic({ apiKey });
226const MODEL_NAME = "claude-3-5-sonnet-20240620";
227
anthropicCachingmain.tsx30 matches
1/**
2* This val creates an interactive webpage that demonstrates the functionality of the Anthropic API.
3* It uses a React frontend with an input for the API key and buttons to trigger different operations.
4* The Anthropic API key is stored in the frontend state and sent with each API request.
5*/
61011function App() {
12const [apiKey, setApiKey] = useState("");
13const [outputs, setOutputs] = useState({
14nonCachedCall: "",
2324const runOperation = async (operation: string) => {
25if (!apiKey) {
26alert("Please enter your Anthropic API key first.");
27return;
28}
35"Content-Type": "application/json",
36},
37body: JSON.stringify({ apiKey }),
38});
39const result = await response.text();
52<a href="https://github.com/anthropics/anthropic-cookbook/blob/7786b9f39db8ba65202792f564c59697a5222531/misc/prompt_caching.ipynb#L402">
53this python notebook
54</a>. Enter in your Anthropic API key (which is not saved) and click the buttons to see the results.
55</p>
56<p>
60<input
61type="password"
62placeholder="Enter Anthropic API Key"
63value={apiKey}
64onChange={(e) => setApiKey(e.target.value)}
65/>
66</div>
67<div>
68<button onClick={() => runOperation("nonCachedCall")} disabled={loading.nonCachedCall}>
69Non-cached API Call
70</button>
71<button onClick={() => runOperation("cachedCall")} disabled={loading.cachedCall}>Cached API Call</button>
72<button onClick={() => runOperation("multiTurn")} disabled={loading.multiTurn}>Multi-turn Conversation</button>
73</div>
74<h2>Non-cached API Call Output:</h2>
75<pre>{loading.nonCachedCall ? "Loading..." : outputs.nonCachedCall}</pre>
76<h2>Cached API Call Output:</h2>
77<pre>{loading.cachedCall ? "Loading..." : outputs.cachedCall}</pre>
78<h2>Multi-turn Conversation Output:</h2>
95if (url.pathname === "/run") {
96const operation = url.searchParams.get("operation");
97const { apiKey } = await request.json();
9899if (!apiKey) {
100return new Response("API key is required", { status: 400 });
101}
102104105if (operation === "nonCachedCall") {
106result = await runNonCachedCall(apiKey);
107} else if (operation === "cachedCall") {
108result = "Making two calls, first one to cache...\n\n";
109result += await runCachedCall(apiKey);
110result += "\n\nNow the cached call...\n\n";
111result += await runCachedCall(apiKey);
112} else if (operation === "multiTurn") {
113result = await runMultiTurnConversation(apiKey);
114} else {
115return new Response("Invalid operation", { status: 400 });
146}
147148async function runNonCachedCall(apiKey: string): Promise<string> {
149const { default: anthropic } = await import("npm:@anthropic-ai/sdk@0.26.1");
150const client = new anthropic.Anthropic({ apiKey });
151const MODEL_NAME = "claude-3-5-sonnet-20240620";
152175const elapsedTime = (endTime - startTime) / 1000;
176177return `Non-cached API call time: ${elapsedTime.toFixed(2)} seconds
178Input tokens: ${response.usage.input_tokens}
179Output tokens: ${response.usage.output_tokens}
182}
183184async function runCachedCall(apiKey: string): Promise<string> {
185const { default: anthropic } = await import("npm:@anthropic-ai/sdk@0.26.1");
186const client = new anthropic.Anthropic({ apiKey });
187const MODEL_NAME = "claude-3-5-sonnet-20240620";
188212const elapsedTime = (endTime - startTime) / 1000;
213214return `Cached API call time: ${elapsedTime.toFixed(2)} seconds
215Input tokens: ${response.usage.input_tokens}
216Output tokens: ${response.usage.output_tokens}
221}
222223async function runMultiTurnConversation(apiKey: string): Promise<string> {
224const { default: anthropic } = await import("npm:@anthropic-ai/sdk@0.26.1");
225const client = new anthropic.Anthropic({ apiKey });
226const MODEL_NAME = "claude-3-5-sonnet-20240620";
227
68) {
69return async (req: Request) => {
70const { api } = await import("https://esm.town/v/pomdtr/api");
71const { deleteCookie, getCookies, setCookie } = await import("jsr:@std/http/cookie");
72
priceTrackermain.tsx2 matches
23const productUrl = "https://www.emma-sleep.co.uk/mattresses/emma-luxe-cooling-mattress/";
4const apiUrl = "https://api.ecom.emma-sleep.com/ecommerce-api-gateway/virtual-carts/emma_gb_webshop";
5const product = {
6cartDraft: {
2526export const checkPrice = async () => {
27const res = await fetch(apiUrl, {
28method: "POST",
29headers: { "Content-Type": "application/json" },