feat: complete production hardening implementation, specialty canonicalization, google-genai migration, voice reliability, sqlite concurrency, and test suite consolidation
This commit is contained in:
@@ -109,13 +109,19 @@ Return ONLY a valid JSON object matching this structure:
|
||||
if GEMINI_API_KEY and GEMINI_API_KEY.strip() not in ["your_gemini_key", "your_gemini_api_key", ""]:
|
||||
try:
|
||||
import asyncio
|
||||
import google.generativeai as genai
|
||||
genai.configure(api_key=GEMINI_API_KEY)
|
||||
model = genai.GenerativeModel(
|
||||
GEMINI_MODEL or "gemini-1.5-flash",
|
||||
generation_config={"response_mime_type": "application/json"}
|
||||
from google import genai
|
||||
from google.genai import types
|
||||
|
||||
client = genai.Client(api_key=GEMINI_API_KEY)
|
||||
config = types.GenerateContentConfig(response_mime_type="application/json")
|
||||
res = await asyncio.wait_for(
|
||||
client.aio.models.generate_content(
|
||||
model=GEMINI_MODEL or "gemini-1.5-flash",
|
||||
contents=prompt,
|
||||
config=config,
|
||||
),
|
||||
timeout=3.5
|
||||
)
|
||||
res = await asyncio.wait_for(model.generate_content_async(prompt), timeout=3.5)
|
||||
cleaned = res.text.replace("```json", "").replace("```", "").strip()
|
||||
parsed = json.loads(cleaned)
|
||||
validated = PatientOnboardingResult.model_validate(parsed)
|
||||
|
||||
Reference in New Issue
Block a user