WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Conversation

@lgrammel
Copy link
Collaborator

@lgrammel lgrammel commented Dec 7, 2025

Summary

  • add provider-agnostic
  • add UI
  • add Angular
  • use alias tool names

@vercel-ai-sdk vercel-ai-sdk bot added the documentation Improvements or additions to documentation label Dec 7, 2025
model: openai('gpt-5'),
tools: {
image_generation: openai.tools.imageGeneration({
generateImage: openai.tools.imageGeneration({
Copy link
Contributor

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':
Copy link
Contributor

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:

  1. Follow the image generation example from packages/ai/README.md lines 100-185
  2. Create an agent with tool name generateImage and implement UI handling with case 'tool-generateImage'
  3. 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 uses case '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).

@lgrammel lgrammel merged commit 40a95fa into main Dec 7, 2025
24 checks passed
@lgrammel lgrammel deleted the lg/8sDHlmKP branch December 7, 2025 14:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants