You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using the transcription functionality, if you request SRT format in the response, even though valid data is returned, it results in an OpenAIExceptionInvalidResponse exception. The problem is the returned data from the API is plain text SRT, not JSON data.
procedureTMainUI.Button3Click(Sender: TObject);
Var OpenAI: IOpenAI;
AIT: TAudioTranscription;
AIR: TAudioText;
begin
OpenAI := TOpenAI.Create('***');
AIR := TAudioText.Create;
Try
AIR := OpenAI.Audio.CreateTranscription(
procedure(Params: TAudioTranscription)
begin
Params.&File('D:\test.mp4');
Params.ResponseFormat('srt');
Params.Language('en');
end);
Except
on E: OpenAIExceptionInvalidResponse do
Memo2.Lines.Add('OpenAI Error: ' + E.Message + ' - ' + E.Code.ToString);
End;
Memo2.Lines.Add(AIR.Text);
AIR.Free;
end;
triggers here, even with code 200 and valid SRT text in the response text
functionTOpenAIAPI.ParseResponse<T>(const Code: Int64; const ResponseText: string): T;
begincase Code of200..299:
try
Result := TJson.JsonToObject<T>(ResponseText);
except
Result := nil;
end;
else
ParseError(Code, ResponseText);
end;
ifnot Assigned(Result) then
raise OpenAIExceptionInvalidResponse.Create('Empty or invalid response:', '', '', Code);
end;
The text was updated successfully, but these errors were encountered:
When using the transcription functionality, if you request SRT format in the response, even though valid data is returned, it results in an OpenAIExceptionInvalidResponse exception. The problem is the returned data from the API is plain text SRT, not JSON data.
triggers here, even with code 200 and valid SRT text in the response text
The text was updated successfully, but these errors were encountered: