Defines a protocol and event types for streaming LLM responses in PraisonAI.
# Source: https://github.com/MervinPraison/PraisonAI | License: MIT # Provided via justclaw.it.com; keep this notice with the code. """ StreamEvent protocol for PraisonAI streaming. This module defines the minimal streaming event protocol that both OpenAI SDK and LiteLLM streaming paths map their native chunks/events into. Design principles: - Zero overhead when not used (lazy imports, no global state) - Multi-agent safe (per-agent callbacks, no shared mutable state) - Async-safe (separate sync/async callback interfaces) - Provider-agnostic (same events for OpenAI, LiteLLM, etc.) """ from dataclasses import dataclass, field from enum import Enum from typing import Any, Dict, List, Optional, Protocol import time import logging logger = logging.getLogger(__name__) class StreamEventType ... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key