Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐼 feat: Add Flux Image Generation Tool #6147

Merged
merged 6 commits into from
Mar 2, 2025
Merged

🐼 feat: Add Flux Image Generation Tool #6147

merged 6 commits into from
Mar 2, 2025

Conversation

danny-avila
Copy link
Owner

Summary

Originally #5410

Thank you @leondape @jmaddington

• Implemented a new FluxAPI tool that supports both standard and finetuned image generation endpoints, including polling for results and local file saving.
• Updated .env.example and the manifest to include Flux configuration and proper authentication instructions.
• Integrated FluxAPI into the tool registry and updated the image generation configuration in the data provider.

Other changes

• Refactored the Image component by adding a className prop to enable customizable theme styling in Chat message attachments.
• Adjusted logging in AgentClient to warn on aborted operations for clearer error handling.
• Enhanced BaseClient tests to verify conversation persistence and removed an unused mock in FakeClient initialization for cleaner CI runs.

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Testing
I tested the Flux API integration by simulating calls with valid credentials and verifying the complete image generation flow, including result polling and file saving. I manually verified that images render correctly in chat messages with the new className prop and confirmed that the adjusted logging in AgentClient behaves as expected. All unit and integration tests passed locally.

Checklist

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes
  • Any changes dependent on mine have been merged and published in downstream modules

@danny-avila danny-avila merged commit 2e63e32 into main Mar 2, 2025
7 checks passed
@danny-avila danny-avila deleted the feat/flux branch March 2, 2025 18:19
@jmaddington
Copy link
Contributor

🙌 Awesome, thanks Danny!

@menardorama
Copy link

Why having flux restricted to cloud based solution ?

Could it be possible to have it for on prem ?

Having the model name configurable would be great, we would be able to run schnell or dev version.

Thanks anyway

@jmaddington
Copy link
Contributor

@menardorama The model name is configurable already. As for on-prem, you'd need to be more specific. Last I checked, the only way to run Flux locally was through Stable Diffusion or a similar tool, and Stable Diffusion is available through a plugin already.

@menardorama
Copy link

Well flux git repo tells you to run flux using tensorRT without any explanations.

As we have spare A40 I wanted to selfhost directly the solution.

If I see the env setting for API ENDPOINT, even if availables endpoints are listed, I don't understand how you can configure it....

@jmaddington
Copy link
Contributor

@menardorama the endpoint and the base url are two different things. The endpoints are what you called model names:
Having the model name configurable would be great, we would be able to run schnell or dev version.

The base url is what allows you to change the server that the plugin hits. It looks like Danny made this configurable, so that adding FLUX_API_BASE_URL=some.server.com will let you use whatever server you want.

I think you are on your own for figuring out how to get the Flux model working self-hosted, although Stable Diffusion isn't a bad place to start.

@menardorama
Copy link

Yes you're right, that was a bad shortcut....

I have already saw how to configure FLUX_API_BASE_UR in this PR but my point is that it seems there is no env variable for the endpoint (aka URI).

@leondape
Copy link
Contributor

leondape commented Mar 4, 2025

The tool was only tested for the BFL API directly. No other APIs were tested.
Explicitly the use of finetuned models, I am not sure about how they run on local instances or replicate.
Please feel free to try it and start a discussion. I won't be able to try a local implementation soon.
@danny-avila thanks for merging. I like the idea of separating the image tracking logic. Do you think you will be able to incorporate that properly, soon?

@jmaddington
Copy link
Contributor

@menardorama the tool allows the LLM to choose the endpoint.

See

As is currently implemented, the options are:

  • /v1/flux-pro-1.1
  • /v1/flux-pro
  • /v1/flux-dev
  • /v1/flux-pro-1.1-ultra
  • /v1/flux-pro-finetuned
  • /v1/flux-pro-1.1-ultra-finetuned

Just specify in your chat which one you would like to see used.

@busla busla mentioned this pull request Mar 4, 2025
14 tasks
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.

4 participants