Python guides
Every published Python guide, newest first, with practical examples you can copy into your own project.
3,965 guides across 14 topics
Topics
Popular Python guides
Most readLatest Python guides
Page 31 of 179Python LangChain Document Loaders and Text Splitters Explained
python langchain document loaders and text splitters: Learn how LangChain document loaders ingest files and how text splitters prepare content for embeddings, with pra...
Building Python LangChain Tools and Agents
Learn how to build Python LangChain tools and agents: defining tools, structuring arguments, running the agent loop, handling errors, and controlling cost.
Python LangChain Structured Output and Parsers
Learn how to get typed, structured LLM responses in Python with LangChain output parsers, including Pydantic and JSON examples, retry logic, and production tips.
Python LangChain Prompt Templates and Chat Models
Learn how to use LangChain prompt templates with chat models in Python, including ChatPromptTemplate, message roles, partial variables, and output parsing.
Python OpenAI API: Timeouts, Retries, and Error Handling
Learn how to set timeouts, control retries, and handle errors when calling the OpenAI API from Python to build resilient applications.
Python OpenAI Batch API: Submit and Process Jobs
Learn how to submit and process OpenAI batch jobs from Python: upload a JSONL request file, create a batch job, poll for status, and retrieve results.
Using OpenAI Embeddings in Python for Semantic Search
Create embeddings with the OpenAI Python client, understand the response structure, compute cosine similarity, and build semantic search over your documents.
Python OpenAI File Upload: How to Upload Files with the API
Learn how to upload files to the OpenAI API with Python using files.create, including parameters, error handling, and use in fine-tuning and assistants.
Python OpenAI Image Input and Multimodal Requests
Use the OpenAI Python SDK to send images to vision-capable models: URL images, base64 local files, multiple images, response handling, and cost considerations.
Using the Python OpenAI Async Client
Practical guide to the Python OpenAI async client: concurrent requests, streaming, retries, timeouts, and client lifecycle management in production.