Home›Python

Python

Python tooling, libraries, and best practices for AI engineers. Covers the latest frameworks, packages, and patterns in the Python AI ecosystem.

16 articles

16 articles
Serving Scikit-LLM Pipelines as REST APIs with FastAPI
Machine Learning Mastery· 2 days ago
Serving Scikit-LLM Pipelines as REST APIs with FastAPI

This article demonstrates how to expose a Scikit‑LLM zero‑shot text classification pipeline, backed by a locally hosted Ollama model, as a RESTful service using FastAPI. It walks through wiring the Scikit‑LLM pipeline into a FastAPI endpoint, enabling HTTP‑based inference without external hosting. Engineers can thus…

Computing Effective Dimension for Quantum ML Models in PyTorch
Towards Data Science· 3 days ago
Computing Effective Dimension for Quantum ML Models in PyTorch

The article introduces methods for computing the effective dimension of quantum machine‑learning models implemented in PyTorch, covering both local and global variants, Fisher information estimation, epsilon‑ball sampling, and log‑space stability, and provides example PennyLane code alongside a time‑series experiment.

How to Validate LLM Output in a DuckDB and dbt Pipeline
Towards Data Science· Nov 10, 2026
How to Validate LLM Output in a DuckDB and dbt Pipeline

The article demonstrates how to validate the output of a Gemini Flash‑Lite LLM by extracting structured fields—skills, seniority, and Nigeria eligibility—from 18 RemoteOK job postings. It shows a pipeline that stores the raw LLM response in DuckDB, then runs Python‑based checks and a suite of dbt tests to ensure each…

Build Your First Multi-Tool AI Agent with Ollama and Python
Towards Data Science· Nov 6, 2026
Build Your First Multi-Tool AI Agent with Ollama and Python

The article demonstrates how to construct a multi‑tool AI agent in Python that leverages Ollama to orchestrate calls to three distinct database tools. The agent dynamically selects the most appropriate tool based on previous results, and it incorporates an eight‑turn circuit‑breaker to prevent infinite loops. The…

Give Your Python AI Agent Persistent Memory with One JSON File
Towards Data Science· Nov 6, 2026
Give Your Python AI Agent Persistent Memory with One JSON File

The article shows how to give a Python AI agent persistent memory across restarts by storing conversation state in a single JSON file, using three custom Python classes, an OpenRouter API key, and the gpt‑4.1‑mini model. It demonstrates adding a calculator tool, a stub web‑search tool, and conversation recall without…

Python 3.15 Has a New Profiler
Towards Data Science· Oct 24, 2026
Python 3.15 Has a New Profiler

Python 3.15 introduces a new built‑in profiler that captures performance details missed by the traditional cProfile module, offering developers deeper insight into execution bottlenecks. This profiler provides more granular timing information, enabling engineers to pinpoint inefficiencies in Python code, especially in…

How to Build a Multi-Modal RAG Pipeline for Images and Documents in Python
Machine Learning Mastery· Oct 21, 2026
How to Build a Multi-Modal RAG Pipeline for Images and Documents in Python

This article explains how to construct a multi‑modal Retrieval‑Augmented Generation (RAG) pipeline in Python that can retrieve and reason over both text and images extracted from documents. Not mentioned specific model names, benchmark results, or architectural details. Engineers can apply the described approach to…

Meta’s Muse Spark Open now available in Amazon SageMaker JumpStart
AWS ML Blog· 10 min read· Oct 15, 2026
Meta’s Muse Spark Open now available in Amazon SageMaker JumpStart

Meta’s Muse Spark Open, a coding‑optimized open‑weight large language model, has been added to Amazon SageMaker JumpStart, letting developers spin up an AI endpoint directly in their AWS account via SageMaker Studio or the SageMaker Python SDK and immediately send inference requests.

Building a Custom LLM Evaluation Harness in Python from Scratch
Machine Learning Mastery· Oct 14, 2026
Building a Custom LLM Evaluation Harness in Python from Scratch

This article walks engineers through building a custom LLM evaluation harness in Python from the ground up, organized around four modular components. It details how to structure the harness for extensibility and reproducibility, enabling systematic assessment of language model outputs. By following the guide,…

How to Fine-Tune Llama 3 for Custom Tool Calling with Unsloth in Python
Machine Learning Mastery· Oct 9, 2026
How to Fine-Tune Llama 3 for Custom Tool Calling with Unsloth in Python

The article demonstrates how to fine‑tune Meta’s Llama 3 model with the Unsloth library to reliably generate structured JSON for custom API tool calls in Python. By leveraging Unsloth’s lightweight training loop and 8‑bit quantization, the authors show that a single‑GPU setup can produce a tool‑calling head that…

How (and Why) to Build an AI Agent from Scratch in Python
Machine Learning Mastery· Oct 5, 2026
How (and Why) to Build an AI Agent from Scratch in Python

This article explains what an AI agent is and demonstrates how to construct one from the ground up using plain Python and the Anthropic API. It walks engineers through the core components needed to orchestrate prompts and responses, showing a minimal‑dependency approach. By leveraging Anthropic’s language model…

Use open weight models as your AI coding agent with Amazon Bedrock
AWS ML Blog· 16 min read· Sep 23, 2026
Use open weight models as your AI coding agent with Amazon Bedrock

OpenCode, a terminal‑native, open‑source AI coding agent, can be paired with Amazon Bedrock’s open‑weight models to deliver a secure, pay‑per‑use coding assistant. The integration supports multi‑model workflows, letting developers assign the most suitable model to each coding task while keeping all data within their…

Build And Understand a Vector Database From Scratch in 10 Easy Steps
Machine Learning Mastery· Sep 18, 2026
Build And Understand a Vector Database From Scratch in 10 Easy Steps

The article walks readers through 10 incremental steps to build a vector database from scratch in Python, covering data ingestion, indexing, query processing, and persistence. It demonstrates how to implement a simple vector similarity search engine using basic Python data structures, offering a clear, hands‑on…

Multilingual Text Classification with Scikit-LLM and Multilingual Embeddings
Machine Learning Mastery· Sep 17, 2026
Multilingual Text Classification with Scikit-LLM and Multilingual Embeddings

This article demonstrates how to construct a multilingual text classification pipeline by extracting multilingual large language model (LLM) embeddings and feeding them into Scikit‑learn classifiers, all without any model fine‑tuning. It shows that pre‑trained LLM embeddings can be leveraged directly for…

Bring your own model with Amazon SageMaker AI: Script mode in SDK v3
AWS ML Blog· 18 min read· Aug 26, 2026
Bring your own model with Amazon SageMaker AI: Script mode in SDK v3

** The SageMaker Python SDK v3 introduces a unified ModelTrainer and ModelBuilder API that replaces framework‑specific estimators, enabling true “bring‑your‑own‑model” workflows via script mode. By syncing a local source_dir into any container image (AWS DLC, custom ECR image, or third‑party) at runtime through the…

Learn Vectorized Thinking in Python Through Examples
Machine Learning Mastery· Aug 26, 2026
Learn Vectorized Thinking in Python Through Examples

The article introduces vectorized thinking in Python, demonstrating how to replace slow Python loops with efficient NumPy array operations. It focuses on leveraging NumPy’s broadcasting and array‑level functions to perform computations in bulk, thereby reducing code complexity and improving runtime performance. The…

EXPLORE AI NEWS

Daily hand-picked stories on LLMs, RAG, agents and production AI — curated for engineers who ship.

BROWSE NEWS

GET THE WEEKLY DIGEST

Join engineers getting the Monday signal-over-noise AI breakdown. No spam, unsubscribe anytime.

LEARN AI ENGINEERING

Curated courses, research papers, repos and tutorials built for engineers leveling up in AI.

START LEARNING