garvitcpp commited on
Commit
6f35cc8
·
verified ·
1 Parent(s): cd9c484

Update app/services/extraction.py

Browse files
Files changed (1) hide show
  1. app/services/extraction.py +8 -6
app/services/extraction.py CHANGED
@@ -362,12 +362,14 @@ Output:
362
  model = genai.GenerativeModel('gemini-2.5-flash')
363
 
364
  # Generate response
365
- response = model.generate_content(prompt,
366
- generation_config=genai.types.GenerationConfig(
367
- temperature=0,
368
- max_output_tokens=150,
369
- top_p=1
370
- ))
 
 
371
 
372
  # Process the response
373
  output_text = response.text.strip()
 
362
  model = genai.GenerativeModel('gemini-2.5-flash')
363
 
364
  # Generate response
365
+ response = model.generate_content(
366
+ prompt,
367
+ generation_config=genai.types.GenerationConfig(
368
+ temperature=0,
369
+ max_output_tokens=500, # Safety net, not a hard limit
370
+ top_p=1,
371
+ response_mime_type="application/json" # 🔥 FORCES JSON OUTPUT
372
+ ))
373
 
374
  # Process the response
375
  output_text = response.text.strip()