n4nAI

Topic

Function Calling in Python

13 posts on function calling in python — part of api integration on the n4n AI blog.

API integrationHow-to

Testing function calling logic in Python with pytest

Learn how to build reliable tests for LLM tool-use code with pytest, isolating function-calling logic from model responses in Python step by step.

3 min read
API integrationHow-to

Streaming function calls with the Python OpenAI SDK

Learn how to implement streaming function calls with the Python OpenAI SDK: accumulate tool call deltas, execute functions, and stream multi-turn agent responses.

3 min read
API integrationTutorial

Python function calling with instructor and Pydantic

Hands-on tutorial for python instructor pydantic function calling: build structured LLM tool calls with Pydantic models and dispatch to real functions.

3 min read
API integrationTutorial

Python function calling with Claude via the Messages API

Step-by-step tutorial for implementing python claude messages api function calling with the Anthropic SDK, from tool schema to multi-turn tool result loops.

3 min read
API integrationHow-to

Parsing function call arguments safely in Python

Step-by-step approach to parsing function call arguments python safely: validate JSON, handle errors, and bind LLM outputs to typed functions.

3 min read
API integrationTutorial

Multi-tool function calling in Python with GPT-4o

Hands-on Python tutorial for multi-tool function calling with GPT-4o: define schemas, run parallel tool calls, and merge results correctly.

3 min read
API integrationTutorial

Function calling with LangChain and Python: a walkthrough

Hands-on langchain python function calling walkthrough: define tools, bind them to ChatOpenAI, execute calls, and return results with runnable code.

3 min read
API integrationHow-to

Error handling for OpenAI function calls in Python

Practical patterns for error handling OpenAI function calls Python: catch API failures, validate arguments, retry safely, and recover from model mistakes.

3 min read
API integrationTutorial

Building a weather tool with OpenAI function calling

Step-by-step Python tutorial for a weather tool using OpenAI function calling: define schema, call API, execute function, and stream responses.

2 min read
API integrationHow-to

Using Pydantic to define OpenAI function calling schemas

Define OpenAI tool schemas from Python types using Pydantic to avoid JSON Schema drift, with runnable steps for generation, calling, and validation.

3 min read
API integrationTutorial

Python function calling with n4n.ai's chat completions API

Hands-on Python tutorial for function calling with the n4n.ai API: define tools, parse model responses, execute local functions, and handle errors.

4 min read
API integrationTutorial

Function calling with the OpenAI Python SDK: a tutorial

Hands-on openai python sdk function calling tutorial: define tools, parse model emissions, execute local functions, and handle errors in Python.

3 min read
API integrationHow-to

Async function calling in Python with openai-python

Learn how to implement async function calling in Python with openai-python: define tools, run concurrent tool calls, and verify the loop end to end.

3 min read