patient / services /aiService.js
aliroohan179's picture
first
cd5e33d
raw
history blame contribute delete
641 Bytes
import { generateResponse } from './llmClient.js';
/**
* Summarize patient data based on a query using LLM
*/
export const summarizePatient = async (patientData, query) => {
const prompt = `
You are a medical assistant AI.
Analyze the following patient data and answer the query in a concise,
structured, and professional format.
Patient data: ${JSON.stringify(patientData)}
Question: ${query}
`;
try {
const content = await generateResponse(prompt);
return { content, role: 'assistant' };
} catch (error) {
return { content: `Error generating summary: ${error.message}`, error: true };
}
};