fix: correct Part.from_text() call and increase max_output_tokens for skin analysis

Pass `text=` as keyword arg to Part.from_text() and raise max_output_tokens
from 1024 to 2048 to prevent JSON truncation in the notes field.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Piotr Oleszczyk 2026-02-28 13:17:22 +01:00
parent ac28eb30d1
commit abf9593857

View file

@ -138,7 +138,7 @@ async def analyze_skin_photos(
parts.append(genai_types.Part.from_bytes(data=data, mime_type=photo.content_type)) parts.append(genai_types.Part.from_bytes(data=data, mime_type=photo.content_type))
parts.append( parts.append(
genai_types.Part.from_text( genai_types.Part.from_text(
"Analyze the skin condition visible in the above photo(s) and return the JSON assessment." text="Analyze the skin condition visible in the above photo(s) and return the JSON assessment."
) )
) )
@ -149,7 +149,7 @@ async def analyze_skin_photos(
config=genai_types.GenerateContentConfig( config=genai_types.GenerateContentConfig(
system_instruction=_skin_photo_system_prompt(), system_instruction=_skin_photo_system_prompt(),
response_mime_type="application/json", response_mime_type="application/json",
max_output_tokens=1024, max_output_tokens=2048,
temperature=0.0, temperature=0.0,
), ),
) )