You can use the GoogleImageSearchTool
(opens in a new tab) to generate and return Google Image Search results from your agent.
Building a ReACT Agent with GoogleImageSearchTool
Just provide the GoogleImageSearchTool
(opens in a new tab) to your FunctionsBasedAgent
(opens in a new tab) to use it.
from steamship.agents.tools.image_generation import GoogleImageSearchTool
self._agent = FunctionsBasedAgent(
tools=[
GoogleImageSearchTool(),
],
llm=OpenAI(self.client),
)
By default, this will cause the ReACT agent to generate an image when you request a picture of something. If will do so by using Google's managed Google Image Search plugin.
If you want to change or constrain the circumstances when this tool is used, you can set the ai_description
field during initialization:
DalleTool(
ai_description=(
"Used to retrieve an image of a well known object, person, place, or idea. "
"Only use if the user has asked directly for an image of a well known subject. "
"The input is a plain text string describing an object, person, place, or idea. "
"The output is an image of that thing."
)
)
Full-working examples of DalleTool
The following examples can be copy-pasted into your project:
- GoogleChatbot (opens in a new tab) - Uses Google Image Search and Google Question Answering to generate images and answers from the web.
Deploying an AgentService with GoogleImageSearchTool
To deploy an agent with this tool, just make sure it's properly wrapped in an AgentService
wrapper and then follow the normal deployment instructions.
You will get a URL that you can visit to create instances of your agent in the cloud and connect to it from the web & chat apps.