Skip to content

Implement OpenAI Responses API Provider #71

@Furisto

Description

@Furisto

Overview

The openai_responses.go file contains the OpenAIModelProfile and model definitions for the OpenAI Responses API, but the actual provider implementation is incomplete. The Responses API is OpenAI's structured output API designed for complex, multi-step interactions.

Current State

  • ✅ OpenAIModelProfile struct defined with comprehensive configuration options
  • ✅ Model definitions for responses API models (gpt-5-2025-08-07 and others)
  • ❌ Provider implementation is incomplete
  • ❌ InvokeModel method not implemented
  • ❌ Message transformation incomplete
  • ❌ Tool/function calling not properly integrated
  • ❌ Streaming response handling not finished
  • ❌ No tests

What Needs to be Done

Complete the implementation of the OpenAI Responses API provider and add comprehensive test coverage.

Implementation Requirements

  1. Provider Structure

    • Create OpenAIProvider struct for Responses API
    • Implement proper initialization with API key validation
    • Support configuration options from OpenAIModelProfile
  2. Core Functionality

    • Implement InvokeModel method with streaming support
    • Handle request/response transformation for Responses API format
    • Implement proper error handling and logging
    • Support input items and response format
  3. Message Handling

    • Transform internal Message format to OpenAI Responses API format
    • Support user messages, system instructions, and previous responses
    • Handle tool results properly
  4. Tool/Function Calling

    • Transform tools to Responses API format
    • Handle function call outputs
    • Support structured tool responses
  5. Streaming Support

    • Implement streaming event handling
    • Properly accumulate streamed chunks
    • Handle different event types (content, tool calls, etc.)
  6. Token Usage Tracking

    • Track input and output tokens from responses
    • Handle cache metrics if supported by API

Files to Modify

  • backend/model/openai_responses.go - Complete implementation
  • backend/model/openai_responses_test.go - Create comprehensive test file

References

  • OpenAI Responses API Documentation
  • OpenAI Completion Provider: backend/model/openai_completion.go (reference pattern)
  • Provider interface: backend/model/provider.go

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions