@netlify/agent-runner-cli 1.173.0 → 1.174.0-image-prompt.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin-local.js +172 -166
- package/dist/bin.js +210 -204
- package/dist/index.js +170 -164
- package/dist/skills/netlify-ai-gateway/SKILL.md +19 -8
- package/package.json +1 -1
|
@@ -177,24 +177,35 @@ for await (const chunk of stream) {
|
|
|
177
177
|
|
|
178
178
|
## Image Generation
|
|
179
179
|
|
|
180
|
-
|
|
180
|
+
Use a Gemini image model, also known as "Nano Banana": pick a `gemini` model with `image` in its name from the Available Models list. No provider API key is needed — construct the client from the AI Gateway variables, which are always set. The gateway serves the Gemini REST API directly at its base URL, with no provider path prefix. Generated images come back as inline data parts:
|
|
181
181
|
|
|
182
182
|
```typescript
|
|
183
|
-
import
|
|
183
|
+
import { GoogleGenAI } from '@google/genai'
|
|
184
184
|
|
|
185
|
-
const
|
|
185
|
+
const ai = new GoogleGenAI({
|
|
186
|
+
apiKey: process.env.NETLIFY_AI_GATEWAY_KEY,
|
|
187
|
+
httpOptions: { baseUrl: process.env.NETLIFY_AI_GATEWAY_BASE_URL?.replace(/\/$/, '') },
|
|
188
|
+
})
|
|
186
189
|
|
|
187
|
-
const
|
|
188
|
-
model: '
|
|
189
|
-
|
|
190
|
+
const response = await ai.models.generateContent({
|
|
191
|
+
model: 'gemini-3.1-flash-image',
|
|
192
|
+
contents: 'A cute otter in a river',
|
|
190
193
|
})
|
|
191
194
|
|
|
192
|
-
const
|
|
195
|
+
for (const part of response.candidates[0].content.parts) {
|
|
196
|
+
if (part.inlineData) {
|
|
197
|
+
const imageBase64 = part.inlineData.data
|
|
198
|
+
}
|
|
199
|
+
}
|
|
193
200
|
```
|
|
194
201
|
|
|
195
|
-
|
|
202
|
+
If the project already uses the OpenAI SDK, image generation is also available via the Responses API with the `image_generation` tool:
|
|
196
203
|
|
|
197
204
|
```typescript
|
|
205
|
+
import OpenAI from 'openai'
|
|
206
|
+
|
|
207
|
+
const openai = new OpenAI()
|
|
208
|
+
|
|
198
209
|
const response = await openai.responses.create({
|
|
199
210
|
model: 'gpt-4o',
|
|
200
211
|
input: 'Create a simple logo',
|
package/package.json
CHANGED