Repository navigation
Replies: 1 comment
|
Hi! Ollama models can support text streaming through LiteLLM in ADK. The issue appears to be a distinction between SSE streaming and bidirectional Live streaming. The error:
suggests that you're trying to use ADK's Live API path (
For streaming text responsesUse Here's a minimal example: import asyncio
from google.adk.agents import Agent
from google.adk.agents.run_config import RunConfig, StreamingMode
from google.adk.models.lite_llm import LiteLlm
from google.adk.runners import InMemoryRunner
from google.genai import types
agent = Agent(
name="ollama_agent",
model=LiteLlm(model="ollama_chat/qwen3:8b"),
instruction="You are a helpful assistant.",
)
async def main():
runner = InMemoryRunner(
agent=agent,
app_name="ollama_demo",
)
session = await runner.session_service.create_session(
app_name="ollama_demo",
user_id="test_user",
)
async for event in runner.run_async(
user_id="test_user",
session_id=session.id,
new_message=types.Content(
role="user",
parts=[types.Part.from_text(text="Explain MCP briefly.")],
),
run_config=RunConfig(
streaming_mode=StreamingMode.SSE
),
):
if event.partial and event.content:
for part in event.content.parts or []:
if part.text:
print(part.text, end="", flush=True)
print()
asyncio.run(main())This example omits tools for clarity. You can keep your existing A few important details:
If you specifically need real-time, bidirectional audio/video through I haven't run your exact setup, but this matches the current ADK implementation and documentation. References:
|
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hi everyone,
I'm trying to use the streaming functionality with models hosted on Ollama, but none of the models I've tested are working. Has anyone managed to get this working, or are only models from the Gemini API supported?
Please check server log for full details: Live connection is not supported for the model I use.
All reactions