I'm using TypeChat to get AzureOpenAI Api response in json format.
I'm using this function to send request
export const getSummary = async (mails:string) =>{
return new Promise(async (resolve,reject)=> {
const response= await translator.translate(mails);
if (!response.success) {
console.log(response); <--- error happens here
return reject(response);
}
const summarizedMail = response.data;
console.log(JSON.stringify(summarizedMail,undefined, 2));
if (summarizedMail.summaryObject.type==="unknown") {
console.log("I didn't understand the following:");
console.log(summarizedMail.summaryObject.text);
}
resolve(response)
})
I'm using this schema definition
export interface SummarizedMailItems {
type:'mailSummary';
summarizationLanguage: 'arabic' | 'english' | 'french' | 'spanish';
summaryParagraph:string;
summaryBulletpoints: [string,string,string];
}
export interface UnknownText {
type:'unknown';
text: string; // The text that wasn't understood
}
export type SummarizedMail = {
summaryObject: SummarizedMailItems | UnknownText;
};
I'm getting this error message :
{ success: false, message: "JSON validation failed: File '/schema.ts' is not a module.\n'Object' only refers to a type, but is being used as a value here.\nCannot find name 'exports'.\n{\n "paragraphSummary": "Discover trends in your work habits with Microsoft Viva Insights. Get insights on your work habits in areas such as focus, well-being, network, and collaboration. Protect your privacy with Viva Insights. Understand and improve your professional habits by reflecting on your work methodology. Click on Viva Insights in the Outlook ribbon to view your tasks and more.",\n "bulletPointsSummary": [\n "27 days without interruption of quiet hours",\n "0% of significant collaboration outside of working hours",\n "100% of available time for individual work in a normal week"\n ]\n}", }
I notice that in the response I get a JSON format that corresponds to an old json defined