1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import { evaltown } from "https://esm.town/v/stevekrouse/evaltown";
import { ValTownPrompt } from "https://esm.town/v/stevekrouse/ValTownPrompt";
import process from "node:process";
export let autoGPT_Test = (async () => {
const { Configuration, OpenAIApi } = await import("npm:openai@3.2.1");
const configuration = new Configuration({
apiKey: process.env.openai,
});
const openai = new OpenAIApi(configuration);
const completion = await openai.createChatCompletion({
model: "gpt-4",
messages: [
{
role: "system",
content: `CONSTRAINTS:
1. Exclusively output valid JavaScript that works in Val Town (explained below)
2. If you are unsure how you previously did something or want to recall past events, thinking about similar events will help you remember.
3. No user assistance
GOAL: return today's date
You should only respond with a single Val Town Javascript expression as described below
${ValTownPrompt}
RESPONSE EXAMPLES (each on its own line):
1 + 1
@me.foo++
`,
},
],
});
console.log(completion.data);
const content = completion.data.choices[0].message.content;
const evalResult = await evaltown({ code: content });
return evalResult;
})();
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
October 23, 2023