Skip to content

Add image generation support - #102

Open
dannyjameswilliams wants to merge 8 commits into
mainfrom
feat/image_generation
Open

dannyjameswilliams wants to merge 8 commits into
mainfrom
feat/image_generation

Conversation

@dannyjameswilliams

@dannyjameswilliams dannyjameswilliams commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Related to backend PR #1032

Adds the GeneratedImage and GeneratedImageOptions classes to add to structured outputs.

Also adaptively changes the timeout based on if media was requested or not.

@orca-security-eu orca-security-eu Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

Comment thread weaviate_agents/classes/media.py Outdated
ImageShape = Literal["square", "landscape", "portrait"]


class QAImage(BaseModel):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're not using QA shorthand anywhere in code, would be better to explicit full word naming like in other models, too keep consitent?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm yeah, I don't mind, I just thought QueryAgentImage was a bit of a mouthful. What if we just had Image? It being imported from weaviate.agents.classes makes it clear where it comes from, I suppose

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'd say QueryAgentImage or Image works to align with other model naming

Comment thread weaviate_agents/query/query_agent.py Outdated
# type through to `ParsedAskModeResponse[MyModel].final_answer_parsed`.
M = TypeVar("M", bound=BaseModel)

_MEDIA_REQUEST_TIMEOUT = 180 # seconds

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a fan of pushing the timeout, I'd jsut keep existing default, because technically we wouldn't be able to ensure 100% reliability (e.g. because by default k8s pods would be killed after 30s of termination).
In ideal world you'd switch to async approaches if requests are expected to last that long.
So by keeping original timeout maybe it's better for user to get timeout if it's doing something very heavy (many images) to e.g. split that up to few requests

@dannyjameswilliams dannyjameswilliams Oct 2, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new 2.5 image models are a lot faster, and theoretically a single image + other nodes does fit within a standard QA call in 30s, but if there is a longer final answer then it will likely push above 30s more often than not.

personally I'd like to increase the timeout so a user's first experience with this isn't that it doesn't work and times out. A first time user coming in to test this feature or using it without much API/coding experience may not know to adjust the time out without reading the docs, and it causes a bit of friction I'd like to avoid

by default k8s pods would be killed after 30s of termination

would you mind giving a bit more detail on this? the api call doesn't time out from my testing when it's above 30 seconds, when would a user likely experience this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants