Archive

1290 posts · Page 34 of 108. ← Blog

Pratik Dhanave · ·5 min read

Building an MCP Server from Scratch

Everything in the series so far comes together here: a small but complete Model Context Protocol server, in Python, exposing a tool, a resource, and a prompt, runnable and testable in minutes.

Build a complete MCP server in Python with the official SDK — a notes service with a tool, a resource, and a prompt — and test it end to end with the MCP Inspector.

Pratik Dhanave · ·6 min read

Learning to Rank — When Machine Learning Takes Over Relevance

BM25 ranks by a fixed formula, but real search engines have hundreds of relevance signals — freshness, popularity, personalization, link quality, and dozens of text features — and no human can hand-tune how to weigh them all. Learning to rank hands that job to machine learning: train a model on examples of good and bad rankings, and let it discover the optimal combination of signals. This post is where search ranking becomes a machine-learning problem, and the bridge to the neural retrieval behind modern AI.

Real engines have hundreds of relevance signals no human can hand-weight — so learning to rank trains a model on good/bad rankings. Pointwise/pairwise/listwise framings, gradient-boosted rankers, and the bridge to neural ranking, embedding retrieval, and the rerankers behind modern RAG.

Pratik Dhanave · ·6 min read

LLM-as-a-Judge

When there's no reference answer and no rule to check, you can ask a strong model to grade the output — LLM-as-a-judge. It's the technique that made open-ended evaluation practical at scale, and it's also a minefield: judges have systematic biases, can be gamed, and agree with humans only when you design the grading carefully. Used well it's indispensable; used naively it produces confident numbers that mean nothing.

When there's no reference and no rule to check, you can ask a strong model to grade the output — LLM-as-a-judge. It made open-ended evaluation practical at scale, and it's a minefield: judges have systematic biases (position, verbosity, self-preference), can be gamed, and agree with humans only when you design the grading carefully.

Pratik Dhanave · ·8 min read

Digital Signatures and Public-Key Infrastructure

A public key lets anyone encrypt to you and verify your signatures — but it raises a new question: how do you know a public key really belongs to who it claims? If an attacker can substitute their own public key for the bank's, all the cryptography in the world protects your connection to the attacker. Solving "whose key is this?" is what certificates, certificate authorities, and chains of trust exist for — the plumbing that makes public keys into verifiable identities.

A public key lets anyone verify your signatures — but how do you know a public key really belongs to who it claims? If an attacker substitutes their key for the bank's, all the cryptography protects your connection to the attacker. Certificates, CAs, and chains of trust solve 'whose key is this?'

Pratik Dhanave · ·6 min read

The Four Governing Frameworks

Before any tactic, know the map. Four cloud and industry frameworks now govern AI cost — AWS, Azure, Google, and the FinOps Foundation — and they converge more than they differ. Every specific lever in this playbook sits underneath one of them, so starting with the constitutional documents is what turns a bag of cost tricks into a coherent discipline.

Before any tactic, know the map. Four cloud and industry frameworks now govern AI cost — AWS, Azure, Google, and the FinOps Foundation — and they converge more than they differ. Every specific lever sits underneath one of them.

Pratik Dhanave · ·6 min read

What Is LangChain?

LangChain is the framework everyone starts with and everyone has opinions about — a vast toolkit for building LLM applications whose real value isn't any one feature but the standardization it brings: one interface across every model, vector store, and tool, so you write your application once and swap the pieces underneath. Understanding what it is (and its relationship to LangGraph) cuts through the confusion.

LangChain is the framework everyone starts with and everyone has opinions about — a vast toolkit whose real value is the standardization it brings: one interface across every model, vector store, and tool, so you write your application once and swap the pieces underneath.

Pratik Dhanave · ·5 min read

What Is Pydantic AI?

Most agent frameworks treat the LLM's output as text you hope to parse. Pydantic AI treats it as typed, validated data — bringing the discipline that made Pydantic the backbone of Python data validation to the messy world of LLM agents. If you've ever wished your agent's output was a real typed object instead of a string you cross your fingers over, this framework was built for you.

Most agent frameworks treat the LLM's output as text you hope to parse. Pydantic AI treats it as typed, validated data — bringing the discipline that made Pydantic the backbone of Python data validation to the messy world of LLM agents.

Pratik Dhanave · ·6 min read

KYC and Identity Verification

Before you can serve a customer in a regulated business, you have to answer a deceptively hard question: are they really who they claim to be? KYC turns that question into an engineering pipeline — collect, verify, screen, risk-assess — and getting it right means balancing legal rigor against an onboarding experience that doesn't drive legitimate customers away.

Before you can serve a customer in a regulated business, you have to answer a deceptively hard question: are they really who they claim to be? KYC turns that into a pipeline — collect, verify, screen, risk-assess — balancing legal rigor against onboarding friction.

Pratik Dhanave · ·6 min read

IP and Routing

The internet layer performs a small miracle billions of times a second: it gets a packet from any machine to any other machine on Earth, across networks owned by thousands of independent organizations, with no central controller and no guarantee it'll arrive. Understanding IP — addresses, packets, routing, and why it's deliberately unreliable — is understanding the foundation everything else is built on.

The internet layer performs a small miracle billions of times a second: it gets a packet from any machine to any other on Earth, across networks owned by thousands of organizations, with no central controller and no guarantee it'll arrive.

Pratik Dhanave · ·6 min read

Metrics

Metrics are the cheapest, most efficient telemetry you have — a handful of numbers that summarize millions of events and tell you, at a glance, whether your system is healthy. Their power is aggregation; their trap is cardinality; and knowing which numbers to watch (and how to read percentiles) is the difference between a dashboard that warns you and one that lies to you.

Metrics are the cheapest, most efficient telemetry — a handful of numbers summarizing millions of events. Their power is aggregation; their trap is cardinality; and knowing which numbers to watch (and how to read percentiles) is the difference between a dashboard that warns you and one that lies.

Pratik Dhanave · ·5 min read

OAuth 2.0: Delegated Authorization

OAuth solved a specific, once-terrible problem: how does an app access your data on another service without you handing over your password? Its answer — a scoped, revocable token granted through a trusted intermediary — is elegant, but only if you remember what OAuth actually is. It's authorization, not login, and everything about it makes sense once you hold that firmly.

OAuth solved a once-terrible problem: how does an app access your data on another service without your password? Its answer — a scoped, revocable token through a trusted intermediary — is elegant, but only if you remember it's authorization, not login.