Skip to content

Commit 2714985

Browse files
committed
copied in from #17
1 parent 14d5d65 commit 2714985

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

packages/agents/README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,9 @@ import { OpenAI } from "openai";
6565
export class AIAgent extends Agent {
6666
async onRequest(request) {
6767
// Connect with AI capabilities
68-
const ai = new OpenAI();
68+
const ai = new OpenAI({
69+
apiKey: this.env.OPENAI_API_KEY,
70+
});
6971

7072
// Process and understand
7173
const response = await ai.chat.completions.create({
@@ -97,7 +99,14 @@ Define your agent's domain:
9799
"class_name": "AIAgent"
98100
}
99101
]
100-
}
102+
},
103+
"migrations": [
104+
{
105+
"tag": "v1",
106+
// Mandatory for the Agent to store state
107+
"new_sqlite_classes": ["AIAgent"]
108+
}
109+
]
101110
}
102111
```
103112

0 commit comments

Comments
 (0)