sashabaranov / go-openai

OpenAI ChatGPT, GPT-3, GPT-4, DALL·E, Whisper API wrapper for Go
Apache License 2.0
9.3k stars 1.43k forks source link

feat: type BatchStatus for all possible states #907

Open tucnak opened 3 days ago

tucnak commented 3 days ago

The OpenAI API reference on Batch API is peculiar insofar it doesn't enumerate possible states for batch status. I was surprised to learn that neither did this library (which is surprising considering it's defining EmbeddingModel among other things) so I simply used the enumeration from OpenAI's Python SDK.

    status: Literal[
        "validating", "failed", "in_progress", "finalizing", "completed", "expired", "cancelling", "cancelled"
    ]
    """The current status of the batch."""

This PR introduces a breaking change: Batch.Status before a string now a BatchStatus.