fix(OpenAI): Handle diarized json response in TranscriptionResponseSegment#706
Merged
Conversation
Collaborator
|
ah interesting. I have to read up on this - I missed it. Enabled CI to run for now |
Collaborator
|
Thanks - looks good. I want to run it through some real testing when I have some time. I'll adapt one of my samples here and run it through on both ways to be sure - https://github.com/iBotPeaches/openai-php-laravel-test/tree/master/app/Console/Commands |
Collaborator
|
Its odd the docs and your samples have non-null values, but my raw tests return a lot more nulls than I expect. Below is a real call sample {
"text": "The quick brown fox jumps over the lazy dog.",
"segments": [
{
"type": "transcript.text.segment",
"text": " The quick brown fox jumps over the lazy dog.",
"speaker": "A",
"start": 0,
"end": 2.1499999999999995,
"id": "seg_0"
}
],
"usage": {
"type": "tokens",
"total_tokens": 172,
"input_tokens": 51,
"input_token_details": {
"text_tokens": 11,
"audio_tokens": 40
},
"output_tokens": 121
}
} |
iBotPeaches
approved these changes
Oct 23, 2025
Collaborator
iBotPeaches
left a comment
There was a problem hiding this comment.
Tested it out here - iBotPeaches/openai-php-laravel-test@acc7a03
Confirmed failure prior to patch and success afterwards. I don't fully understand why I have nulls on a ton of fields, but direct calls via CURL replicate as well.
Collaborator
|
thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What:
Description:
TranscriptionResponse now parses both verbose JSON and diarized JSON responses.
Segment fields differ between the two response types.
This commit updates TranscriptionResponseSegment to handle both responses.
Note: Fields that differ between responses are now nullable, also, the id property can now be a integer or a string.