Hi,
I am new to using crew ai agents. I am trying to build an agent which can generate image provided a description. I want to use Vertex AI Imagen3 for this task. I see that all Langchain tools are supported in crew ai. So I decided to use VertexAIImageGeneratorChat as custom tool. However, I am not able to set it up. I am not sure where I am making mistake and I don’t see any example for this. Kindly help.
Here is the code, but I don’t understand how to define google project and model here. When used this within agent, it gives OPENAI auth error.
class VertexAIImagenTool(BaseTool):
name: str = "VertexAI Image Generator Tool"
description: str = "A tool to generate images using the Vertex AI Image Generator model. Use this to generate images for quizzes"
generate: VertexAIImageGeneratorChat = Field(default_factory=VertexAIImageGeneratorChat)
def _run(self, query: str) -> str:
"""Execute the image geenration based on the input and return the generated image"""
try:
return self.generate.run(query)
except Exception as e:
return f"Error performing image generation: {str(e)}"