Browse by Topic

Popular

Latest

Latest Python Posts

Illustration of a Python script uploading a file to the OpenAI API, showing a file icon moving to a cloud with OpenAI branding.
Python

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.

OpenAI APIFile UploadPythonFine-tuning
Illustration of a Python script sending an image and text to an OpenAI model, with a visual representation of multimodal input.
Python

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.

OpenAI APIMultimodalPython SDKImage Input
Diagram showing an async OpenAI client sending multiple concurrent API requests through an event loop
Python

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.

OpenAIasyncioPythonasync/await
Python code streaming tokens from OpenAI API as a chat completion response
Python

How to Stream OpenAI Chat Completions in Python

Learn how to stream OpenAI chat completions in Python, handle token chunks, manage errors, and use async streaming for real-time responses.

OpenAI APIStreamingPythonAsync
A diagram showing a Python application receiving a tool call request from the OpenAI API and executing a function
Python

Python OpenAI Tool Calling and Function Calling

python openai tool calling and function calling: Implement OpenAI tool calling in Python: define tool schemas, detect tool_calls in responses, execute functions, and r...

OpenAITool CallingFunction CallingPython SDK
Illustration of a Python code block transforming into a structured JSON object with a schema diagram, symbolizing OpenAI structured outputs.
Python

Python OpenAI Structured Outputs with JSON Schema

Learn how to use OpenAI structured outputs in Python to enforce a JSON schema on model responses, parse the returned JSON, and validate it with Pydantic.

OpenAI APIJSON SchemaStructured OutputsPython
Diagram of a Python script sending a request to the OpenAI Responses API and receiving generated text.
Python

Python OpenAI Responses API for Text Generation

python openai responses api text generation: Learn how to use the OpenAI Responses API in Python for text generation, including request parameters, response handling,...

OpenAIPythonText GenerationResponses API
Python code interacting with the OpenAI Responses API, showing a request and response flow.
Python

Python OpenAI Responses API Usage: Practical Examples

Learn how to use the OpenAI Responses API from Python: making requests, handling responses, streaming, error handling, and production considerations.

OpenAIResponses APIPythonLLM
A visual representation of sentence embeddings being normalized to unit length for cosine similarity computation.
Python

How to Normalize Embeddings with Python Sentence Transformers

python sentence transformers normalize embeddings: Learn how to normalize embeddings from Python sentence-transformers for cosine similarity, including the normalize_e...

sentence-transformersembeddingsnormalizationcosine similarity
Illustration of multiple sentence embeddings being generated in parallel on a GPU chip
Python

Python Sentence Transformers Batch Encoding and GPU

Learn how to batch encode texts with sentence-transformers on a GPU, control batch size, avoid out-of-memory errors, and choose the right output format for embeddings.

sentence-transformersGPUbatch encodingembeddings