We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 14d5d65 commit 2714985Copy full SHA for 2714985
packages/agents/README.md
@@ -65,7 +65,9 @@ import { OpenAI } from "openai";
65
export class AIAgent extends Agent {
66
async onRequest(request) {
67
// Connect with AI capabilities
68
- const ai = new OpenAI();
+ const ai = new OpenAI({
69
+ apiKey: this.env.OPENAI_API_KEY,
70
+ });
71
72
// Process and understand
73
const response = await ai.chat.completions.create({
@@ -97,7 +99,14 @@ Define your agent's domain:
97
99
"class_name": "AIAgent"
98
100
}
101
]
- }
102
+ },
103
+ "migrations": [
104
+ {
105
+ "tag": "v1",
106
+ // Mandatory for the Agent to store state
107
+ "new_sqlite_classes": ["AIAgent"]
108
+ }
109
+ ]
110
111
```
112
0 commit comments