-
Notifications
You must be signed in to change notification settings - Fork 3.4k
chore(ai): README tweaks #10955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(ai): README tweaks #10955
Conversation
| model: openai('gpt-5'), | ||
| tools: { | ||
| image_generation: openai.tools.imageGeneration({ | ||
| generateImage: openai.tools.imageGeneration({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The README documents the image generation tool name as generateImage, but the actual example code uses image as the tool name.
View Details
📝 Patch Details
diff --git a/packages/ai/README.md b/packages/ai/README.md
index 9e81fbbe9..7c20eb97e 100644
--- a/packages/ai/README.md
+++ b/packages/ai/README.md
@@ -106,7 +106,7 @@ import { ToolLoopAgent, InferAgentUIMessage } from 'ai';
export const imageGenerationAgent = new ToolLoopAgent({
model: openai('gpt-5'),
tools: {
- generateImage: openai.tools.imageGeneration({
+ image: openai.tools.imageGeneration({
partialImages: 3,
}),
},
@@ -182,7 +182,7 @@ export default function Page() {
switch (part.type) {
case 'text':
return <div key={index}>{part.text}</div>;
- case 'tool-generateImage':
+ case 'tool-image':
return <ImageGenerationView key={index} invocation={part} />;
}
})}
Analysis
README documents incorrect tool name for image generation agent
What fails: The README.md example on lines 109 and 185 documents the image generation tool as generateImage, but the actual working agent code in examples/next-openai/agent/openai-image-generation-agent.ts uses image as the tool name.
How to reproduce: Follow the README example to create an agent with generateImage: openai.tools.imageGeneration({...}). Users will then expect the UI switch statement to handle case 'tool-generateImage', but the actual framework generates tool-image events based on the actual agent file's tool name.
Result: The UI component in the example page (examples/next-openai/app/chat-openai-image-generation/page.tsx) uses case 'tool-image': (line not shown in README), meaning the ImageGenerationView component won't render if users follow the README documentation's incorrect tool name.
Expected: The README should document the tool name as image to match the actual working implementation, so the switch case should be case 'tool-image': (which it now is after the fix).
Fixed: Updated line 109 from generateImage: to image: and updated line 185 from case 'tool-generateImage': to case 'tool-image': in packages/ai/README.md to match the actual working code.
| case 'text': | ||
| return <div key={index}>{part.text}</div>; | ||
| case 'tool-image_generation': | ||
| case 'tool-generateImage': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The README shows a tool case type of tool-generateImage, but the actual UI code uses tool-image to match the tool name defined in the agent.
View Details
📝 Patch Details
diff --git a/packages/ai/README.md b/packages/ai/README.md
index 9e81fbbe9..7c20eb97e 100644
--- a/packages/ai/README.md
+++ b/packages/ai/README.md
@@ -106,7 +106,7 @@ import { ToolLoopAgent, InferAgentUIMessage } from 'ai';
export const imageGenerationAgent = new ToolLoopAgent({
model: openai('gpt-5'),
tools: {
- generateImage: openai.tools.imageGeneration({
+ image: openai.tools.imageGeneration({
partialImages: 3,
}),
},
@@ -182,7 +182,7 @@ export default function Page() {
switch (part.type) {
case 'text':
return <div key={index}>{part.text}</div>;
- case 'tool-generateImage':
+ case 'tool-image':
return <ImageGenerationView key={index} invocation={part} />;
}
})}
Analysis
README documentation shows incorrect tool case name for image generation example
What fails: The README.md (packages/ai/README.md) documents an image generation example with a tool named generateImage and uses case statement case 'tool-generateImage'. However, the actual working implementation in examples/next-openai uses a tool named image with case statement case 'tool-image'.
How to reproduce:
- Follow the image generation example from packages/ai/README.md lines 100-185
- Create an agent with tool name
generateImageand implement UI handling withcase 'tool-generateImage' - Compare with actual working example at examples/next-openai/agent/openai-image-generation-agent.ts (line 7) which uses
image:as the tool name and examples/next-openai/app/chat-openai-image-generation/page.tsx (line 28) which usescase 'tool-image'
Result: The README example is inconsistent with the actual implementation pattern. The tool case type is constructed as tool-{toolName}, so the naming must match between the tool definition and the case statement.
Expected: The README should show the tool named image with case statement case 'tool-image' to match the actual working examples and follow the consistent tool-{toolName} pattern used throughout the codebase (e.g., tool showWeatherInformation → case tool-showWeatherInformation).
Summary
provider-agnostic