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
@@ -71,9 +102,10 @@ export function validateChatBody(body: unknown): ChatCompletionsBody {
71
102
72
103
// Validate each message
73
104
constvalidatedMessages: OpenAIMessage[]=[];
74
-
for(constmessageofrawBody.messages){
105
+
for(leti=0;i<rawBody.messages.length;i++){
106
+
constmessage=rawBody.messages[i];
75
107
if(!isValidMessage(message)){
76
-
thrownewError('Each message must have valid role (system|user|assistant) and non-empty content string');
108
+
thrownewError(`Message at index ${i} is invalid: must have valid role (system|user|assistant) and non-empty content. Received: ${JSON.stringify(message)}`);
0 commit comments