Spaces:
Sleeping
Sleeping
| 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 }; | |
| } | |
| }; | |