Async SSE
Usage
from djangosdk.streaming.async_sse import AsyncSSEResponse
from djangosdk.agents.base import Agent
class AssistantAgent(Agent):
provider = "anthropic"
model = "claude-3-5-haiku-20241022"
async def stream_view(request):
agent = AssistantAgent()
prompt = request.GET.get("prompt", "")
async def generate():
async for chunk in agent.astream(prompt):
yield chunk
return AsyncSSEResponse(generate())ASGI Setup
Thinking Content in Streams
Last updated
Was this helpful?