2
3// Fetches a random joke.
4function fetchRandomJoke() {
5 const SAMPLE_JOKE = {
6 "setup": "What do you call a group of disorganized cats?",
1export default async function what() {
2 console.log("what");
3}
5
6// Fetches a random joke.
7function fetchRandomJoke() {
8 const SAMPLE_JOKE = {
9 "setup": "What do you call a group of disorganized cats?",
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export async function postHogAPICapture({ key, event, properties, distinct_id }: {
4 key: string;
5 event: string;
7
8// Fetches a random joke.
9async function fetchRandomJoke() {
10 const response = fetch(
11 "https://official-joke-api.appspot.com/random_joke",
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
7}
8
9export async function getGeminiModels(): Promise<GeminiModel[]> {
10 try {
11 const API_KEY = process.env.GEMINI_API_KEY;
1import type { ChatCompletion, ChatCompletionCreateParamsNonStreaming, Message } from "npm:@types/openai";
2
3async function getOpenAI() {
4 // if you don't have a key, use our std library version
5 if (Deno.env.get("OPENAI_API_KEY") === undefined) {
14/**
15 * Initiates a chat conversation with OpenAI's GPT model and retrieves the content of the first response.
16 * This function can handle both single string inputs and arrays of message objects.
17 * It supports various GPT models, allowing for flexibility in choosing the model based on the application's needs.
18 *
21 * @returns {Promise<string>} A promise that resolves to the content of the first response from the completion.
22 */
23export async function chat(
24 input: string | Message[],
25 options?: Omit<ChatCompletionCreateParamsNonStreaming, "messages">,
2
3// Fetches a random joke.
4async function fetchRandomJoke() {
5 const response = await fetch(
6 "https://official-joke-api.appspot.com/random_joke",
A helper function to build a file's email
Simple functional CSS library for Val Town
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.
import { OpenAI } from "https://esm.town/v/std/openai";
export default async function(req: Request): Promise<Response> {
if (req.method === "OPTIONS") {
return new Response(null, {
headers: {
"Access-Control-Allow-Origin": "*",