llm_engineering icon indicating copy to clipboard operation
llm_engineering copied to clipboard

Add Gemini streaming support to brochure generator

Open SAMK-online opened this issue 4 months ago • 1 comments

Add Gemini Streaming Support to Brochure Generator

This PR adds support for using Google's Gemini model in the brochure generator, alongside the existing GPT and Claude options.

Changes

  • Added stream_gemini function to handle Gemini API streaming responses
  • Updated stream_brochure to support Gemini model option
  • Added Gemini to model dropdown in UI
  • Maintains consistent streaming pattern with GPT and Claude implementations

Implementation Details

  • Uses Gemini's streaming API with the same pattern as GPT and Claude
  • Handles streaming chunks consistently with other models
  • Preserves markdown formatting in responses
  • Maintains same error handling pattern as other models

Testing

The implementation has been tested with:

  • Basic company website URLs
  • Streaming functionality works as expected
  • UI updates in real-time as responses are generated

Requirements

  • Requires Google API key to be configured (same as existing setup)
  • Uses gemini-2.5-flash model for optimal performance
  • No additional dependencies required beyond existing ones

Notes

  • Follows the same streaming pattern as existing models for consistency
  • Uses the OpenAI-compatible endpoint for better integration
  • Maintains the same error handling patterns

SAMK-online avatar Aug 24 '25 14:08 SAMK-online

Hey - this PR seems to be changing an existing file in the repo - was that intentional? Ed

ed-donner avatar Aug 31 '25 14:08 ed-donner