1export function myApi(name) {
2 return "hi " + name;
3}
1export function myApi(name) {
2 return "hi " + name;
3}
1export function myApi(name) {
2 return "hi " + name;
3}
5
6export async function tgWebhook(req, res) {
7 const botSecretToken = req.get("X-Telegram-Bot-Api-Secret-Token");
8 if (botSecretToken !== process.env.tgBotSecretToken) {
9 res.status(401).json({ ok: false, description: "Unauthorized" });
9 "Bullet",
10 "Computer",
11 "Rapid",
12 "Top Rated",
13 "Blitz",
6// Create a summary from a given text using GPT 4
7export const OpenAISummary = async (text: string, config: {
8 apiKey?: string;
9 jwt?: string;
10 modelName?: string;
11} = {}) => {
12 const { apiKey, jwt, modelName = "gpt-4" } = config;
13 if (!apiKey && !jwt) {
14 const { success, reset } = await upstashRateLimiter(
15 "anon",
22 }
23 }
24 else if (!apiKey) {
25 try {
26 await verifyJWT(jwt);
31 }
32 const agent = await AIAgent(
33 apiKey || process.env.OPENAI_API_KEY_GPT4,
34 );
35 const response = await agent.summarize(text, modelName);
10 const { LangChainTracer } = await import("npm:langchain/callbacks");
11 const client = new Client({
12 apiUrl: "https://api.smith.langchain.com",
13 apiKey: process.env.LANGSMITH,
14 });
15 const tracer = new LangChainTracer({ client });
16 const callbacks = options?.verbose !== false ? [tracer] : [];
17 // Set up API key for each providers
18 const args = extend({ callbacks }, options);
19 if (spec?.provider === "openai")
20 args.openAIApiKey = process.env.OPENAI;
21 else if (spec?.provider === "huggingface")
22 args.apiKey = process.env.HUGGINGFACE;
23 // Populate model builders
24 const setup = cond([
2
3export async function spellCheck(req: express.Request, res: express.Response) {
4 let response = await fetch("https://www.dnd5eapi.co/api/spells");
5 let data = await response.json();
6 let countOfSpells = data["count"];
8 let randomSpell = data["results"][randomSpellNumber];
9 let response2 = await fetch(
10 `https://www.dnd5eapi.co/api/spells/${randomSpell["index"]}`,
11 );
12 let data2 = await response2.json();
1export let tell = (msg) => return `I heard you say ${msg}`;
2//Can call w/URL with: https://api.val.town/eval/@dvergin.tell('Howdy')
1export function myApi(name) {
2 return "hi " + name;
3}