Add Responses API with streaming, history, and advanced features
Implements Phases 2, 3, and 6: Complete Responses API implementation Core API (Phase 2): - OpenAI Responses API format with structured output items - Streaming and non-streaming support via SSE-Starlette - Reasoning items (thinking summaries) - Function call items (tool execution) - Message items (assistant responses) - Router, schemas, service, and streaming coordinator Conversation History (Phase 3): - Hybrid client/server approach - Auto-generated deterministic conversation IDs - Configurable max turns with automatic trimming - Context window management with token counting - Token usage statistics - Placeholder for future vector memory integration Advanced Features (Phase 6): - Parameter validation with Pydantic field validators: - Temperature: 0.0-2.0 range enforcement - Reasoning effort: 6 levels (none to xhigh) - Max output tokens: positive integer enforcement - Stop sequences: up to 4, non-empty strings - Real-time stop sequence detection during streaming - Real-time max tokens enforcement with token counting - Graceful error handling and OpenAI-compatible error format Testing: - 9 unit tests for API endpoints and streaming - 11 unit tests for error handling - 13 unit tests for conversation history and context - 12 unit tests for advanced features and validation - Total: 45 tests with comprehensive coverage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
"""
|
||||
Responses API implementation.
|
||||
|
||||
This module implements the OpenAI Responses API format:
|
||||
- /v1/responses endpoint
|
||||
- Output items (reasoning, function_call, message)
|
||||
- Streaming events
|
||||
- Multi-turn conversations
|
||||
"""
|
||||
|
||||
from src.responses.schemas import (
|
||||
Response,
|
||||
ResponseRequest,
|
||||
OutputItem,
|
||||
MessageOutputItem,
|
||||
ReasoningOutputItem,
|
||||
FunctionCallOutputItem,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"Response",
|
||||
"ResponseRequest",
|
||||
"OutputItem",
|
||||
"MessageOutputItem",
|
||||
"ReasoningOutputItem",
|
||||
"FunctionCallOutputItem",
|
||||
]
|
||||
Reference in New Issue
Block a user