feat: implement voice-based patient onboarding pipeline with AI orchestration, multi-language STT/TTS support, and clinical state extraction.
This commit is contained in:
@@ -71,3 +71,21 @@ Return ONLY JSON:
|
||||
"allergies_found": [],
|
||||
"summary": f"Could not extract document details: {e}",
|
||||
}
|
||||
|
||||
async def generate_response(
|
||||
self,
|
||||
system_prompt: str,
|
||||
user_message: str,
|
||||
) -> str:
|
||||
if not self.api_key or self.api_key in ["your_gemini_key", "your_gemini_api_key", ""]:
|
||||
raise ValueError("Gemini API key not configured")
|
||||
|
||||
import google.generativeai as genai
|
||||
genai.configure(api_key=self.api_key)
|
||||
model = genai.GenerativeModel(
|
||||
model_name=self.model or "gemini-1.5-flash",
|
||||
generation_config={"response_mime_type": "application/json"},
|
||||
)
|
||||
full_prompt = f"{system_prompt}\n\nPATIENT SAID: {user_message}"
|
||||
response = await model.generate_content_async(full_prompt)
|
||||
return response.text
|
||||
|
||||
Reference in New Issue
Block a user