cerebras_coderREADME.md2 matches
671. Sign up for [Cerebras](https://cloud.cerebras.ai/)
82. Get a Cerebras API Key
93. Save it in a [Val Town environment variable](https://www.val.town/settings/environment-variables) called `CEREBRAS_API_KEY`
1011# Todos
cerebras_codermain.tsx4 matches
212} catch (error) {
213Toastify({
214text: "We may have hit our Cerebras Usage limits. Try again later or fork this and use your own API key.",
215position: "center",
216duration: 3000,
1024};
1025} else {
1026const client = new Cerebras({ apiKey: Deno.env.get("CEREBRAS_API_KEY") });
1027const completion = await client.chat.completions.create({
1028messages: [
1148<meta name="viewport" content="width=device-width, initial-scale=1.0">
1149<title>CerebrasCoder</title>
1150<link rel="preconnect" href="https://fonts.googleapis.com" />
1151<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
1152<link
1153href="https://fonts.googleapis.com/css2?family=DM+Mono:ital,wght@0,300;0,400;0,500;1,300;1,400;1,500&family=DM+Sans:ital,opsz,wght@0,9..40,100..1000;1,9..40,100..1000&display=swap"
1154rel="stylesheet"
1155/>
Prompt_Improverorchestrator4 matches
31];
3233// Create API call promises with timeouts
34const workerPromises = workerConfigs.map(config => {
35const apiPromise = openai.chat.completions.create({
36model: "gpt-4o-mini",
37max_tokens: 500,
54);
5556return Promise.race([apiPromise, timeoutPromise]);
57});
5859// Execute all API calls concurrently
60const results = await Promise.all(workerPromises);
61
practicalIvoryTurtlemain.tsx2 matches
13*/
14export async function fetchCongressTradeReports({ lastRunAt }) {
15// Fetch the latest trade reports from Capitol Trades API
16const res = await fetchJSON(
17"https://bff.capitoltrades.com/trades?sortBy=-pubDate",
18);
19
fetchCongressTradeReportsmain.tsx2 matches
13*/
14export async function fetchCongressTradeReports({ lastRunAt }) {
15// Fetch the latest trade reports from Capitol Trades API
16const res = await fetchJSON(
17"https://bff.capitoltrades.com/trades?sortBy=-pubDate",
18);
19
891. Click `Fork`
102. Change `location` (Line 4) to describe your location. It accepts fairly flexible English descriptions which it turns into locations via [nominatim's geocoder API](https://www.val.town/v/stevekrouse/nominatimSearch).
113. Click `Run`
12
Weather_Dashboardmain.tsx2 matches
2import { render } from "npm:preact-render-to-string";
34const apiKey = Deno.env.get("WUNDERGROUND_API_KEY");
5const stationId = Deno.env.get("WUNDERGROUND_STATION_ID");
6122try {
123const response = await fetch(
124`https://api.weather.com/v2/pws/observations/current?stationId=${stationId}&format=json&units=m&numericPrecision=decimal&apiKey=${apiKey}`,
125);
126
fiberplaneHonoZodStarterindex.ts17 matches
1import { createFiberplane } from "https://esm.sh/@fiberplane/hono@0.4.4";
2import { swaggerUI } from "https://esm.sh/@hono/swagger-ui@0.2.0";
3import { OpenAPIHono } from "https://esm.sh/@hono/zod-openapi@0.18.4";
4import { HTTPException } from "https://esm.sh/hono@4.7.0/http-exception";
56import { createUser, deleteUser, filterUsersByName, findUserById, updateUser } from "./helpers.ts";
7import { superProtectedApi } from "./protected/api.ts";
8import { createUserRoute } from "./routes/create-user.ts";
9import { deleteUserRoute } from "./routes/delete-user.ts";
14import type { AppType } from "./types.ts";
1516const app = new OpenAPIHono<AppType>();
1718app.openapi(getUserRoute, (c) => {
19// This id is coerced to a number by the Zod schema for path parameters
20// See: `UserIdPathParamSchema` in `schema.ts`
30});
3132app.openapi(listUsersRoute, (c) => {
33const { name } = c.req.valid("query");
3438});
3940app.openapi(createUserRoute, (c) => {
41const { name, email, age } = c.req.valid("json");
4246});
4748app.openapi(updateUserRoute, (c) => {
49const { id } = c.req.valid("param");
50const { name, age } = c.req.valid("json");
59});
6061app.openapi(deleteUserRoute, (c) => {
62const { id } = c.req.valid("param");
6373});
7475// Mount an API with bearer auth
76app.route("/protected", superProtectedApi);
7778// Create OpenAPI documentation
79app.doc("/openapi.json", {
80openapi: "3.0.0",
81info: {
82title: "User Management API",
83version: "v1.0.0",
84},
8687// Swagger UI
88app.get("/docs", swaggerUI({ url: "/openapi.json" }));
8990// Mount the Fiberplane UI at the root to be able to test api endpoints
91app.use(
92"/*",
93createFiberplane({
94openapi: { url: "/openapi.json" },
95}),
96);
1import { createRoute } from "https://esm.sh/@hono/zod-openapi@0.18.4";
2import { ErrorSchema, NewUserSchema, UserIdPathParamSchema, UserSchema } from "../schema.ts";
3
1import { createRoute } from "https://esm.sh/@hono/zod-openapi@0.18.4";
2import { ErrorSchema, UserIdPathParamSchema } from "../schema.ts";
3