Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

You can use Ollama’s structured-output feature to ask a local model for transaction fields, then validate the returned JSON with Pydantic. For safer handling, use a deterministic parser for notification formats you already understand, route unmatched messages to the model, and check extracted values against the original text before relying on them. A valid schema-conforming response is not proof that the model identified the transaction correctly.

What this approach can—and cannot—guarantee

There are three separate checks in this workflow:

  • Output shape: A JSON Schema supplied to Ollama constrains the response structure.
  • Validation: Pydantic can parse the JSON and reject values that violate the model’s declared types or validation rules.
  • Extraction correctness: Neither valid JSON nor a valid Pydantic object proves that the merchant, amount, currency, date, or transaction type was read accurately from the notification.

Ollama’s documentation describes structured output but does not report accuracy for bank-notification extraction or evaluate a particular small model on that task. Build and test against representative messages before using extracted fields in consequential workflows.

Define a schema that can represent uncertainty

Start with the fields your application actually needs—for example, amount, currency, merchant, date, transaction type, and a status indicating whether the message was understood. Design the schema so missing or ambiguous details can be represented, such as with optional fields or an explicit status. Do not require the model to fill every field if the notification does not contain the information.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The field choices below are an example of design guidance, not a bank-specific schema prescribed by Ollama. Adapt names, types, and validation rules to your messages and downstream use.

#1 Best Overall
GEEKOM A7 Mini PC,Ryzen 7 7730U(Low Power) 32GB RAM &500GB SSD(Expandable)
  • 【Low Power for Always-On AI Workflows】At just 15W TDP, the GEEKOM A7 uses far less power than a traditional 350W desktop, helping reduce electricity costs, heat, and cooling noise during extended operation. That efficiency makes it ideal for keeping cloud AI assistants and AI Agent tasks running in the background—automating document summaries, email polishing, meeting notes, content rewriting, research, and scheduled workflows throughout the day. The energy savings can help recoup the device cost in about 1 year, making A7 a practical choice for 24/7 AI task hosting and efficient everyday computing.
  • 【Ryzen 7 7730U – More Than a Low-Power PC】Think low power means less performance? Not here. The Ryzen 7 7730U mini computer packs 8 cores, 16 threads, and up to 4.5GHz, giving you the power to handle multitasking, dozens of tabs, video calls, and creative work smoothly. AMD Radeon Graphics supports 4K playback, multi-display work, photo editing, and casual gaming without a dedicated GPU. Compared with the Ryzen 7 5825U and Ryzen 5 7430U, it delivers up to 20% higher performance for faster response and smoother everyday computing—all in a compact, energy-efficient Mini desktop.
  • 【Lock In More Memory Before It Costs More】32GB gives you the headroom most demanding tasks need today—and room to grow tomorrow. Built for heavy multitasking, content creation, large projects, and AI-assisted workloads, the GEEKOM mini pc starts you with twice the memory of a typical 16GB setup, so you can skip an immediate upgrade. With AI driving greater demand for memory, starting with 32GB is a smarter way to stay ready for what’s next. The 500GB PCIe Gen4 x4 SSD delivers fast storage, with support for up to 64GB RAM and 4TB SSD storage when you need more.
  • 【Premium Metal Design & 3-Year Warranty】Why settle for plastic? The GEEKOM mini desktop features a premium aluminum alloy chassis that resists daily wear and helps dissipate heat during extended use. Rigorous quality testing and CE, FCC, and RoHS compliance support dependable performance, backed by a 3-year limited warranty and professional support for long-term peace of mind.
  • 【One Mini PC, All Your Ports】Stay connected with dual USB-C ports, 5 USB 3.2 ports, dual HDMI 2.0, and a 2.5G LAN port for fast, flexible connectivity. The USB-C ports support high-speed data transfer, display output, and peripheral power, while Wi-Fi 6E keeps streaming, file transfers, and online work fast and reliable. From multiple peripherals to high-resolution displays, everything you need stays within easy reach.
from datetime import date
from decimal import Decimal
from typing import Literal

from pydantic import BaseModel


class TransactionNotice(BaseModel):
    status: Literal["parsed", "incomplete", "unclear"]
    amount: Decimal | None = None
    currency: str | None = None
    merchant: str | None = None
    transaction_date: date | None = None
    transaction_type: str | None = None

Use validation rules that match your data rather than assuming every bank uses the same currency notation, date format, or transaction labels. If a notification leaves a value ambiguous, your model design should permit that ambiguity instead of encouraging a guess.

Request structured output and validate it in Python

Ollama accepts a JSON Schema through the chat request’s format parameter. Its Python example generates that schema from a Pydantic model with model_json_schema(), then parses the returned message content with model_validate_json(). The following illustrates that documented path; select and configure a model that is available in your own Ollama installation.

Rank #2
GMKtec EVO-X2 AI Mini PC Ryzen Al Max+ 395 Superchip 128GB LPDDR5X 2TB SSD
  • EVOLUTION RYZEN AI MAX+ 395 MINI PC - GMKtec EVO-X2 is the next evolution in AI mini PC Ryzen Strix Halo series. Thanks to AMD Simultaneous Multithreading (SMT) the core-count is effectively doubled, to 32 threads. Ryzen AI Max+ 395 has 64 MB of L3 cache and can boost up to 5.1 GHz, depending on the workload. The Ryzen AI Max+ 395 is currently rated as the "most powerful x86 APU" on the market for AI computing.
  • AI NPU with XDNA 2 ARCHITECTURE - Powered by 16 “Zen 5” CPU cores, 50+ peak AI TOPS XDNA 2 NPU and a truly massive integrated GPU driven by 40 AMD RDNA 3.5 CUs, the Ryzen AI MAX+ 395 is a transformative upgrade and delivers a significant performance boost over the competition. The Ryzen AI Max+ 395 excels in consumer AI workloads like the llama.cpp-powered application: LM Studio. Shaping up to be the must-have app for client LLM workloads, LM Studio allows users to locally run the latest language model without any technical knowledge required and unleash their creativity and productivity.
  • AMD RADEON 8090S iGPU GAMING PC - The AMD Radeon RX 8060S offers all 40 CUs with up to 2.9 GHz graphics clock and uses the new RDNA 3.5 architecture. The powerful iGPU is positioned between an RTX 4060 and 4070 laptop GPU and therefore enables gaming in FHD at maximum details in most demanding games. The 8060S can also utilize the full 128GB pool, which is perfect for running LLMs such as Deepseek 70B Q8, which runs comfortably on this machine.
  • EIGHT CHANNEL LPDDR5X - LPDDR5X is a new ground breaking memory small form factor installed on-board. With blazing speeds up to to 8000MT/s, it runs 1.5x faster than the DDR5 SODIMMs; 90% better performance over DDR5 SODIMMs in video conferencing and photo editing; 30% better performance in productivity apps; 12% better performance in digital content workloads.
  • QUAD SCREEN 8K DISPLAY SUPPORT - EVO-X2 AI Mini PC support 4-screen 4K/8K output via HDMI 2.1 (8K@60Hz), DisplayPort 1.4 (4K@60Hz), and dual USB 4 40Gbps Transfer speed (supporting PD3.0/DP1.4/DATA). Ideal for gaming, video editing, and multitasking, it provides expansive and crisp multi-display support.
import ollama
from pydantic import ValidationError

schema = TransactionNotice.model_json_schema()

notice_text = "Your card was charged 24.50 USD at Example Market on 2026-09-30."

try:
    response = ollama.chat(
        model="your-local-model",
        messages=[
            {
                "role": "system",
                "content": (
                    "Extract transaction details only when they are supported by "
                    "the notification. Use null for missing or unclear fields. "
                    "Return as JSON."
                ),
            },
            {"role": "user", "content": notice_text},
        ],
        format=schema,
        options={"temperature": 0},
    )
    parsed = TransactionNotice.model_validate_json(
        response["message"]["content"]
    )
except (ValidationError, KeyError, TypeError) as exc:
    # Keep the original notice available for review or fallback handling.
    parsed = None
    print(f"Could not validate the response: {exc}")

Ollama’s December 6, 2024 structured-output post recommends using Pydantic or a JSON Schema to define the response structure, adding “return as JSON” to the prompt, and setting temperature to 0 for more deterministic output. These measures can help keep the format consistent; they do not establish that the extracted facts are correct. See Ollama’s structured outputs documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

In production, replace the illustrative exception handling with behavior appropriate to your application. For example, record a validation failure for review, retain the original notification, or send it to a fallback path. Avoid silently treating an invalid or incomplete result as a successfully parsed transaction.

Rank #3
GMKtec K15 AI Mini PC Oculink Intel Ultra 5 125U 32GB DDR5 512GB SSD
  • LOW ENERGY HIGH PERFORMANCE MINI PC - The Intel Core Ultra 5 125U is part of the Ultra 5 lineup, using the Meteor Lake architecture with BGA 2049. Intel Hyper-Threading technology is available and effectly doubles the core-count of the P-Cores, to a total of 14 threads. Core Ultra 5 125U has 12 MB of L3 cache and operates at 1300 MHz by default, but can boost up to 4.3 GHz, depending on the workload. With a TDP of 15 W, the Core Ultra 5 125U consumes very little energy but outputs high performance efficiency
  • 32GB DDR5 RAM + 512GB SSD - The K15 mini computer is equipped with Dual 16GB (Total 32GB) SO-DIMM DDR5 4800MHz memory sticks. 512GB PCIE 4.0 SSD Drive with 3x M.2 2280 Expansion slots. Each slot capable of reading up to 8TB. (24TB MAX)
  • QUAD SCREEN 4K DISPLAY SUPPORT - K15 Mini PC support 4-screen 4K/8K output via HDMI 2.1 (8K@60Hz), DisplayPort 1.4 (4K@60Hz), and USB Type-C Transfer speed (supporting PD3.0/DP1.4/DATA). Ideal for gaming, video editing, and multitasking, it provides expansive and crisp multi-display support
  • OCULINK PORT - The Oculink port on the rear interface enables higher bandwidth capabilities, better frame rates and lower lag. The standard also operates at PCIe x4 speeds, compared to Thunderbolt's x3. Gamers and content creators can benefit from Oculink's higher bandwidth, resulting in better performance and lower lag for eGPU setups
  • DUAL NIC FAST 2.5GBE + WIFI 6E + BT 5.2 - Dual Ethernet 2.5GbE LAN port design provides more applications, such as firewall, multichannel aggregation, soft routing, file storage server. Built-in WIFI 6E / Bluetooth 5.2 is more stable and efficient to connect multiple wireless devices such as projector, printer, monitor, speakers and etc
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use regex for stable formats and the model for the rest

If a bank’s notification template is stable and you can reliably identify its fields, a conventional parser or regular expression may be easier to inspect and reason about for that format. A practical routing design is:

  1. Identify notification formats you know and have tested.
  2. Parse those formats with deterministic rules, and check that required fields were actually matched.
  3. Route messages that do not match a known template to the local model’s structured-output path.
  4. Compare either path’s extracted values with the source message or known expected values before consequential use.

This is an engineering safeguard, not a documented Ollama feature or a measured claim that regex will improve accuracy. Regex can be brittle when layouts change; a model can return plausible but incorrect values. Keep the original text available so a mismatch or uncertain result can be investigated.

Rank #4
GMKtec AI Mini PC Ultra 9 285H (Turbo 5.4GHz) 64GB DDR5 1TB PCIe 4.0 SSD Mini Gaming Computer 3X M.2 Expansion Slots, Oculink, Quad Screen 8K Display EVO-T1
  • EVOLUTION CORE ULTRA 9 285H MINI PC - GMKtec EVO-T1 is the next evolution in AI mini PC Ultra 9 series. The Core Ultra 9 285H offers 16 cores (six P-cores + eight E-cores + two LPE-cores) and 16 threads with a turbo clock of 5.4 GHz. It is currently one of the best value for performance AI mini PC computers.
  • AI NPU - The 285H features an Intel AI Boost NPU, capable of up to 13 TOPS (Tera Operations per Second) for INT8 calculations, which is designed to accelerate AI tasks.
  • INTEL ARC 140T GAMING PC - The Arc 140T GPU includes 8 Xe cores and supports features like DirectX 12, OpenGL 4.5, and OpenCL 3, making it capable of handling modern games and creative applications. It also supports Quick Sync Video for efficient video encoding and decoding, as well as AV1 encoding and decoding.
  • 64GB DDR5 RAM + 1TB SSD - The EVO-T1 is equipped with Dual 32GB (Total 64GB) SO-DIMM DDR5 5600MHz memory sticks. 2TB PCIE 4.0 SSD Drive with 3x M.2 2280 Expansion slots. Each slot capable of reading up to 4TB. (12TB MAX)
  • QUAD SCREEN 8K DISPLAY SUPPORT - EVO-T1 AI Mini PC support 4-screen 4K/8K output via HDMI 2.1 (8K@60Hz), DisplayPort 1.4 (4K@60Hz), and USB Type-C Transfer speed (supporting PD3.0/DP1.4/DATA). Ideal for gaming, video editing, and multitasking, it provides expansive and crisp multi-display support.

Test the complete extraction path

Create a test set of representative messages from the banks, locales, and notification variations your application expects. Include straightforward examples as well as missing fields, ambiguous dates or amounts, unfamiliar merchants, and template changes. For each case, record the correct expected values and compare them with the complete pipeline’s output—not just whether the response is valid JSON.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  • Check field-level correctness against the original notification or known expected data.
  • Verify how absent and ambiguous information is represented.
  • Exercise both the known-template parser and the model fallback, including validation failures.
  • Repeat testing when notification formats, prompts, schema rules, or model versions change.

No accuracy percentage, preferred small model, minimum hardware specification, or bank-specific regex pattern is established here. Those depend on the implementation and messages being processed, so measure them in your own environment rather than assuming a general result.

Understand the privacy boundary

Ollama’s privacy policy, last updated March 2026, says prompts and responses processed locally are not collected, stored, transmitted, or accessible to Ollama. It describes cloud-hosted model prompts and responses separately as processed transiently. The local-processing statement concerns Ollama’s service; it does not guarantee how your application, host machine, logs, backups, or other dependencies handle notification data. Review the full Ollama privacy policy and your own deployment’s data flow.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.