Tag: Python
Streamlining LLM Integration with LiteLLM
In the rapidly evolving landscape of Large Language Model (LLM) applications, developers often face significant challenges when integrating multiple LLM providers. Each provider—whether OpenAI, Anthropic, Cohere, or others—comes with its own API structure, authentication methods, and response formats, creating a complex integration landscape. What is LiteLLM? LiteLLM is an open-source library that provides a unified…
Enhancing Python Code Quality with Ruff, Black, and Mypy
Introduction In the ever-evolving landscape of Python development, maintaining code quality is paramount. This guide focuses on three powerful tools that have become essential in the Python ecosystem: Ruff, Black, and Mypy. Each of these tools serves a unique purpose in ensuring your Python code is clean, consistent, and error-free. Ruff has emerged as an extremely fast linter…
Building a MCP Server So LLMs Can Count Letters
Large Language Models (LLMs) sometimes struggle with simple counting tasks like determining the number of ‘r’s in words like “strawberry” or “raspberry”. While this is often used as a gotcha test for LLMs, there’s a practical solution – creating a Model Context Protocol (MCP) server to handle these counting tasks reliably. MCP is an innovative…
Creating a REST API using Python and Flask
Introduction to Flask and REST APIs Flask is a lightweight and versatile web framework for Python that allows developers to easily build web applications, including REST APIs. It provides a simple and intuitive way to create web services that can be consumed by other applications. Flask is known for its flexibility, making it a popular…
LangGraph Basics: Building Advanced AI Agents with Graph Architecture
Why LangGraph? Before diving into installation, let’s understand why LangGraph is a powerful tool for building AI agents: Installation and Setup with uv Please see our uv tutorial for instructions on installing and setting up uv. These commands will work with pip and a standard virtual environment as well. Installation Steps Here’s how to set up your…
Python Data Validation with Pydantic
Installing and Setting Up Pydantic Pydantic has become one of the most popular data validation libraries in the Python ecosystem. Before we dive into its powerful features, let’s get it installed and ready to use. Basic Installation Installing Pydantic is straightforward using pip: Version Considerations As of this writing, Pydantic has two major versions available:…
Classifying Technical Documentation with TensorFlow: Building a GitHub README Classifier
In this tutorial, I’ll walk you through how to build a machine learning system that automatically classifies GitHub README files by programming language. This practical application of natural language processing demonstrates how to use TensorFlow to analyze and categorize technical documentation. To provide a simple development environment we’re going to use a Jupyter Notebook. Each…
Interactive Mapping with Python: Building a Transit Visualization using Folium
Folium makes it easy to create beautiful interactive web maps in Python by combining the power of Python’s data handling with the Leaflet.js mapping library. While there are many ways to showcase Folium’s capabilities, building a transit system visualization provides a perfect practical example – combining real world data and various layer types. In this…