I am uploading an image using this approach: ``` ...
# ask-ai
a
I am uploading an image using this approach:
Copy code
chat_ctx = agent_to_use.chat_ctx.copy()
            chat_ctx.add_message(
                role="user",
                content=[
                    "Here is an image I want to talk about:",
                    ImageContent(image=image_data_url)
                    ],
            )

            await agent_to_use.update_chat_ctx(chat_ctx)
I was hoping the agent would acknowledge the image that I uploaded - but it just carries on talking. Only acknowledging image once the user asks about it. Are there ways I can upload an image and have the agent react to it naturally in the conversation saying something like "oh I see the image..."
t
Thanks for reaching out, Matt. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
I'd be happy to help you get the agent to naturally acknowledge an uploaded image! Here’s a simple way to do it: 1. First, make sure the image is included in the chat context by using the
ImageContent
object. This can be either a base64-encoded data URL or an external URL. 2. Next, gently update the system prompt to guide the agent to recognize images. For example, you might add something like: "When you see an image in our conversation, naturally incorporate what you see into your response." 3. Finally, don’t forget to update the chat context with
update_chat_ctx()
after adding the image. This helps the agent process the image in the next inference cycle. If you’d like, I’m here to walk you through any of these steps or provide more details. Just let me know! Sources: agents/src/llm/__snapshots__/chat_context.test.ts.snap | Vision Agent Quickstart | LiveKit Docs | Vision | LiveKit Docs | agent/main.py