no, i mean something like this.
def get_image_orientation(angle: int) -> int:
"""Useful for checking image orientation and returning the
degree of orientation as an integer (either one of 0, 90, 180, -90)."""
return angle
orientation_tool = FunctionTool.from_defaults(
fn=get_image_orientation,
)
tools = [orientation_tool]
mm_llm = OpenAI(
model=llm_model_small,
temperature=TEMPERATURE,
api_key=openai_api_key,
logsprob=None,
default_headers={}
)
MESSAGE = """You are a helpful agent. You will be given an image. Your task
is to determine the orientation of the image. Return either 0, 90, 180, or -90."""
for img_b64 in base64_images:
image_document = Document(image_resource=MediaResource(data=img_b64))
msg = ChatMessage(
role=MessageRole.USER,
blocks=[
TextBlock(text=MESSAGE),
ImageBlock(image=image_document.image_resource.data),
],
)
agent = OpenAIAgent.from_tools(
tools=tools,
llm=mm_llm,
verbose=False,
prefix_messages=[msg]
)
query = """Use your vision capabilities and from the image content,
determine the orientation of this image"""
response = agent.chat(message=query)
print(str(response))