7import { Hono } from "npm:hono@3";
8import _ from "npm:lodash@4";
9import OpenAI from "npm:openai";
10import { renderToString } from "npm:react-dom/server";
11
195
196 const contextWindow: any = await valleGetValsContextWindow(model);
197 const openai = new OpenAI();
198 const stream = await openai.chat.completions.create({
199 model,
200 stream: true,
7import { Hono } from "npm:hono@3";
8import _ from "npm:lodash@4";
9import OpenAI from "npm:openai";
10import { renderToString } from "npm:react-dom/server";
11const vt = new ValTown({ bearerToken: Deno.env.get("valtown") });
172
173 const contextWindow = await valleGetValsContextWindow(model);
174 const openai = new OpenAI();
175 const stream = await openai.chat.completions.create({
176 model,
177 stream: true,
10import { Hono } from "npm:hono@3";
11import _ from "npm:lodash@4";
12import OpenAI from "npm:openai";
13import { renderToString } from "npm:react-dom/server";
14
139
140 const contextWindow = await valleGetValsContextWindow(model);
141 const openai = new OpenAI();
142 const stream = await openai.chat.completions.create({
143 model,
144 stream: true,
7import { Hono } from "npm:hono@3";
8import _ from "npm:lodash@4";
9import OpenAI from "npm:openai";
10import { renderToString } from "npm:react-dom/server";
11
165
166 const contextWindow: any = await valleGetValsContextWindow(model);
167 const openai = new OpenAI();
168 const stream = await openai.chat.completions.create({
169 model,
170 stream: true,
6import { Hono } from "npm:hono@3";
7import _ from "npm:lodash@4";
8import OpenAI from "npm:openai";
9import { renderToString } from "npm:react-dom/server";
10
179
180 const contextWindow = await valleGetValsContextWindow.call(null, model);
181 const openai = new OpenAI();
182 const stream = await openai.chat.completions.create({
183 model,
184 stream: true,
6import { Hono } from "npm:hono";
7import _ from "npm:lodash@4";
8import OpenAI from "npm:openai";
9import { renderToString } from "npm:react-dom/server";
10
156
157 const contextWindow = await valleGetValsContextWindow(model);
158 const openai = new OpenAI();
159 const stream = await openai.chat.completions.create({
160 model,
161 stream: true,
11import { Hono } from "npm:hono";
12import _ from "npm:lodash";
13import OpenAI from "npm:openai";
14import { renderToString } from "npm:react-dom/server";
15
144
145 const contextWindow = await valleGetValsContextWindow(model);
146 const openai = new OpenAI();
147 const stream = await openai.chat.completions.create({
148 model,
149 stream: true,
1Fork it and authenticate with your Val Town API token as the password. Needs an `OPENAI_API_KEY` env var to be set.
2
3WARNING: pollutes your homepage with lots of temporary vals!!
7import { Hono } from "npm:hono@3";
8import _ from "npm:lodash@4";
9import OpenAI from "npm:openai";
10import { renderToString } from "npm:react-dom/server";
11
193
194 const contextWindow: any = await valleGetValsContextWindow(model);
195 const openai = new OpenAI();
196 const stream = await openai.chat.completions.create({
197 model,
198 stream: true,
6* Fork this val to your own profile.
7* Make a folder for the temporary vals that get generated, take the ID from the URL, and put it in `tempValsParentFolderId`.
8* If you want to use OpenAI models you need to set the `OPENAI_API_KEY` [env var](https://www.val.town/settings/environment-variables).
9* If you want to use Anthropic models you need to set the `ANTHROPIC_API_KEY` [env var](https://www.val.town/settings/environment-variables).
10* Create a [Val Town API token](https://www.val.town/settings/api), open the browser preview of this val, and use the API token as the password to log in.