Back

Version 30

1/24/2024
import { chat } from "https://esm.town/v/cosmo/chat_openai";
import { getCurrentWeather } from "https://esm.town/v/cosmo/get_current_weather";

const currentWeather = await getCurrentWeather("48.4117", "-114.34"),
messages = [
{ role: "system", content: "Interpret the provided weather data, speaking only in rhymes." },
{ role: "user", content: JSON.stringify(currentWeather) },
],
chatResponse = await chat(Deno.env.get("OPENAI_API_KEY"), messages);

export const weather = chatReponse.choices[0].message.content;
Updated: February 1, 2024