intelligence_src_6dc544294b7f21f98a
- Source-provided label
- Publisher RSS metadata
- Evidence class
- mentioned in report
- Confidence
- Not reported
- Observed
- Dec 02, 2026 18:12 UTC
- Retrieved
- Dec 02, 2026 18:24 UTC
Day Topic Example Status 1 Talking to an LLM from code Classifying emails by category and urgency ✅ Code 2 Roles, examples and delimiters in prompts Translating technical language into plain language ✅ Code 3 Structured output with JSON, validated with Pydantic Turning a chat order into a table ✅ Code 4 Images with vision models Scanning a receipt and returning a JSON with the products and the total 📍 You're here 5 Embeddings: meaning as numbers Grouping 20 news articles by topic ⏳ Coming soon Day 4: Receipt reader with vision, schema validation and total checks The goal: take a photo of a receipt and turn it into structured data: the store, the date, the payment method, the totals and every item purchased. Vision models can read images, not just text. That means I can send a photo to Gemini and get the data back in the same validated format I used on Day 3. The schema I created two classes: Article describes each item the customer bought, and Receipts contains all the information about the purchase, including the list of articles. class Receipts(BaseModel): name: str | None = Field( default=None, description="Name of the store where the purchase was made" ) purchase_date: date | None = Field(default=None, description="Date where the purchase was done") address: str | None = Field( default=None, description="null if not mentioned the address of the store" ) payment_method: str | None = Field( default=None, description="null if not mentioned the payment method" ) subtotal: float | None = Field( default=None, description="The price of the products with no tax included" ) tax: float | None = Field( default=None, description="amount in money, not the percentage", ) total: float | None = Field(default=None, description='The grand total of the purchase') receipt: bool | None = Field( default=None, description="The receipt shows that the purchase is already paid. True only if appears any of these, the payment method, card number, amount charged, and False if the date of payment is in the future according to the date the image has", ) articles: list[Article] Two details make this schema work: description guides the model. For example, "amount in money, not the percentage" stops it from returning 19 instead of $3.80 for the tax. receipt: bool acts as a filter. Not every image is a paid receipt. A quote or a pending invoice gets False, and my code discards it. Reading the image def describe_receipt(path: str) -> Receipts | None: image_bytes = Path(path).read_bytes() image_part = types.Part.from_bytes( data=image_bytes, mime_type=MIME_TYPE[Path(path).suffix.lower()], ) response = client.models.generate_content( model=model, contents=image_part, config=types.GenerateContentConfig( system_instruction="""Extract the products orders. Use only information present in the image""", temperature=0, response_mime_type="application/json", response_schema=Receipts, ), ) # in case the receipt property is False return None if not response.parsed.receipt else response.parsed The function reads the image as bytes and tells the model what kind of file it is (mime_type, based on the extension: .png, .jpg...). Then it sends the image together with the schema. response.parsed already returns a validated Receipts object, so there's no need to parse the JSON by hand. Checking the math def check_totals(receipt: Receipts) -> None: """Verify the model's numbers instead of trusting them blindly.""" items_sum = 0 for article in receipt.articles: items_sum += article.price * article.amount # Check 1: items vs subtotal (round to cents to avoid float errors) if round(items_sum, 2) == round(receipt.subtotal, 2):
26a651be5531ec459cee4727e00f4b54b24020774715af5a7edfd4ab835510d9Network indicators are visibly defanged. This page does not make them clickable or send them to another service.
No validated file hashes or network indicators are stored for this record.
This record contains metadata and attribution only. It does not host, download, unpack, render, or execute malware samples.
Sources represented on this page. Publication and observation dates describe the content; successful batch dates describe local collection. A recent batch does not certify complete coverage or current provider availability.
1 sources: 0 stale, 0 needing attention, 0 paused, 0 unverified.
Stale means older than twice the recorded collection interval, with a minimum of one hour; without an interval, the threshold is 24 hours. Cached content remains available while a feed is stale, paused, or unverified.