From 3de8378f0d558276a07257c9ed2d6178ecafb596 Mon Sep 17 00:00:00 2001 From: ananthu1997 <31721523+ananthu1997@users.noreply.github.com> Date: Tue, 21 Oct 2025 11:26:43 +0530 Subject: [PATCH 1/2] Update README.md --- README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/README.md b/README.md index 86a35e5e..78fefbac 100644 --- a/README.md +++ b/README.md @@ -116,6 +116,7 @@ Flo AI Studio is a modern, intuitive visual editor that allows you to design com - [Google Gemini](#google-gemini) - [Google VertexAI](#google-vertexai) - [Ollama (Local)](#ollama-local) + - [🔄 Streaming Support in LLM](#streaming-support) - [📊 Output Formatting](#-output-formatting) - [🔄 Error Handling](#-error-handling) - [📚 Examples](#-examples) @@ -1046,6 +1047,29 @@ llm: Ollama = Ollama( ) ``` +### streaming-support +Streaming helps the llm to generate the output (response) piece-by-piece, or token-by-token, +as it is being computed, instead of waiting until the entire response is complete before sending it to the user + +Steaming Support has been added to all the llm providers. Example of streaming function wiht Gemini is shown below: +```python +from flo_ai.llm import Gemini + +llm: Gemini = Gemini( + model='gemini-2.5-flash', # or gemini-2.5-pro + temperature=0.7, + api_key='your-api-key' # or set GOOGLE_API_KEY env var +) +messages=[{"role": "user", "content": "Stream a short sentence."}] +chunks: List[str] = [] + async for chunk in llm.stream(messages=messages): + text = chunk.get('content', '') + if text: + chunks.append(text) + if len(''.join(chunks)) >= max_chars: + break + return ''.join(chunks) +``` ## 📊 Output Formatting Use Pydantic models or JSON schemas for structured outputs: From a2d58fa4dd90098826c06ae7f14bd8f7c5f2bfb4 Mon Sep 17 00:00:00 2001 From: ananthu1997 <31721523+ananthu1997@users.noreply.github.com> Date: Tue, 21 Oct 2025 11:30:18 +0530 Subject: [PATCH 2/2] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 78fefbac..5abe8e7e 100644 --- a/README.md +++ b/README.md @@ -1047,11 +1047,11 @@ llm: Ollama = Ollama( ) ``` -### streaming-support +### Streaming Support in LLM Streaming helps the llm to generate the output (response) piece-by-piece, or token-by-token, as it is being computed, instead of waiting until the entire response is complete before sending it to the user -Steaming Support has been added to all the llm providers. Example of streaming function wiht Gemini is shown below: +Steaming Support has been added to all the llm providers. Example of streaming function with Gemini is shown below: ```python from flo_ai.llm import Gemini