in src/utils/initExtraTools.ts [37:61]
handler: async (agent, input) => {
try {
const { Timestamps, Format } = input;
const response = await convertTimestamps(agent, Timestamps, Format);
return response as any;
} catch (error: any) {
// Handle specific Perplexity API error types
if (error.response) {
const { status, data } = error.response;
if (status === 429) {
return {
statusCode: status,
body: "Error: Rate limit exceeded. Please try again later.",
};
}
return {
statusCode: status,
body: `Error: ${data.error?.message || error.message}`,
};
}
return {
body: `Failed to get information: ${error.message}`,
};
}
}