1. 08 Feb, 2026 13 commits
  2. 07 Feb, 2026 13 commits
  3. 06 Feb, 2026 14 commits
    • Stefy Lanza (nextime / spora )'s avatar
    • Stefy Lanza (nextime / spora )'s avatar
    • Stefy Lanza (nextime / spora )'s avatar
    • Stefy Lanza (nextime / spora )'s avatar
    • Stefy Lanza (nextime / spora )'s avatar
      Fix Google GenAI streaming response handling · 77c08ee2
      Stefy Lanza (nextime / spora ) authored
      - Return Google's synchronous iterator directly from provider handler
      - Detect Google streaming responses by checking for __iter__ but not __aiter__
      - Convert Google chunks to OpenAI format in stream_generator
      - Handle both sync (Google) and async (OpenAI/Anthropic) streaming responses
      - Fix 'async_generator object is not iterable' error
      
      This fixes streaming requests through autoselect and rotation handlers
      that were failing with 'async_generator' object is not iterable error.
      77c08ee2
    • Stefy Lanza (nextime / spora )'s avatar
      Fix Google GenAI streaming handler to use async generator · 81e9a8f5
      Stefy Lanza (nextime / spora ) authored
      - Keep stream_generator as async function (not sync)
      - Wrap Google's synchronous iterator in async generator
      - Properly structure if/else for streaming vs non-streaming paths
      - Fix 'client has been closed' error in streaming responses
      
      This fixes the issue where streaming requests through autoselect
      were failing with 'Cannot send a request, as a client has been closed'
      error.
      81e9a8f5
    • Stefy Lanza (nextime / spora )'s avatar
      Fix streaming chunk structure for Google GenAI · 63268f97
      Stefy Lanza (nextime / spora ) authored
      - Ensure complete chunk object is yielded as single unit
      - Add logging to show complete chunk structure
      - Fix issue where chunk was being serialized as separate fields
      - Maintain OpenAI-compatible chat.completion.chunk format
      
      This should fix the streaming issue where chunks were being
      serialized as separate data: lines instead of complete
      JSON objects.
      63268f97
    • Stefy Lanza (nextime / spora )'s avatar
      Implement streaming support for Google GenAI provider · 8360e33b
      Stefy Lanza (nextime / spora ) authored
      - Use generate_content_stream() for streaming requests
      - Create async generator that yields OpenAI-compatible chunks
      - Extract text from each stream chunk
      - Generate unique chunk IDs
      - Format chunks as chat.completion.chunk objects
      - Include delta content in each chunk
      - Maintain non-streaming functionality for regular requests
      
      This fixes the streaming issue where Google GenAI was returning
      a dict instead of an iterable, causing 'JSONResponse object is
      not iterable' errors.
      8360e33b
    • Stefy Lanza (nextime / spora )'s avatar
      Create test script for AISBF proxy · 3c7bec4c
      Stefy Lanza (nextime / spora ) authored
      - Test non-streaming requests to autoselect endpoint
      - Test streaming requests to autoselect endpoint
      - Test listing available providers
      - Test listing models for autoselect endpoint
      - Use model 'autoselect' for autoselect endpoint
      - Include jq installation instructions for formatted output
      
      Run with: ./test_proxy.sh
      3c7bec4c
    • Stefy Lanza (nextime / spora )'s avatar
      Remove Pydantic validation to test serialization · 6a1fc753
      Stefy Lanza (nextime / spora ) authored
      - Remove ChatCompletionResponse validation from GoogleProviderHandler
      - Remove ChatCompletionResponse validation from AnthropicProviderHandler
      - Return raw response dict directly
      - Add logging to show response dict keys
      - This tests if Pydantic validation was causing serialization issues
      
      Testing if removing validation fixes client-side 'Cannot read properties
      of undefined' errors.
      6a1fc753
    • Stefy Lanza (nextime / spora )'s avatar
      Wrap Google and Anthropic provider responses in JSONResponse · 4760277f
      Stefy Lanza (nextime / spora ) authored
      GoogleProviderHandler:
      - Wrap validated response dict in JSONResponse before returning
      - Add logging to confirm JSONResponse is being returned
      - Ensures proper JSON serialization for Google GenAI responses
      
      AnthropicProviderHandler:
      - Wrap validated response dict in JSONResponse before returning
      - Add logging to confirm JSONResponse is being returned
      - Ensures proper JSON serialization for Anthropic responses
      
      RequestHandler:
      - Remove JSONResponse wrapping (now handled by providers)
      - Update logging to detect JSONResponse vs dict responses
      - OpenAI and Ollama providers return raw dicts (already compatible)
      
      This fixes client-side 'Cannot read properties of undefined' errors by ensuring
      Google and Anthropic responses are properly serialized as JSONResponse,
      while leaving OpenAI and Ollama responses as-is since they're already
      OpenAI-compatible.
      4760277f
    • Stefy Lanza (nextime / spora )'s avatar
      Wrap response in JSONResponse for proper serialization · d4a92e37
      Stefy Lanza (nextime / spora ) authored
      - Import JSONResponse from fastapi.responses
      - Explicitly wrap response dict in JSONResponse
      - Add logging to confirm JSONResponse is being returned
      - This ensures FastAPI properly serializes the response dict
      - Fixes potential serialization issues causing client-side errors
      d4a92e37
    • Stefy Lanza (nextime / spora )'s avatar
      Add response structure logging in RequestHandler · 94f17378
      Stefy Lanza (nextime / spora ) authored
      - Log response type and full response object
      - Log response keys to verify structure
      - Check if 'choices' key exists
      - Verify choices is a list and not empty
      - Log choices[0] content if available
      - Add error logging for missing or malformed response structure
      
      This will help identify why clients are getting 'Cannot read properties
      of undefined (reading '0') errors when accessing response.choices[0]
      94f17378
    • Stefy Lanza (nextime / spora )'s avatar
      Add comprehensive tool calls support for Google and Anthropic providers · 60ca20d2
      Stefy Lanza (nextime / spora ) authored
      GoogleProviderHandler enhancements:
      - Process all parts in response content (not just first part)
      - Extract and combine all text parts
      - Detect and convert Google function_call to OpenAI tool_calls format
      - Generate unique call IDs for tool calls
      - Handle function responses for debugging
      - Set content to None when tool_calls are present (OpenAI convention)
      - Add comprehensive logging for tool call detection and conversion
      - Support both text and function/tool calls in same response
      - Validate response against ChatCompletionResponse Pydantic model
      - Add detailed response structure logging
      
      AnthropicProviderHandler enhancements:
      - Process all content blocks (not just text)
      - Detect and convert Anthropic tool_use blocks to OpenAI tool_calls format
      - Generate unique call IDs for tool calls
      - Combine all text parts from multiple blocks
      - Set content to None when tool_calls are present (OpenAI convention)
      - Add comprehensive logging for tool_use detection and conversion
      - Validate response against ChatCompletionResponse Pydantic model
      - Add detailed response structure logging
      
      Both handlers now properly translate provider-specific function calling
      formats to OpenAI-compatible tool_calls structure, ensuring clients receive
      valid structured responses with proper schema validation.
      60ca20d2