-
Notifications
You must be signed in to change notification settings - Fork 19.7k
Description
Checked other resources
- This is a bug, not a usage question.
- I added a clear and descriptive title that summarizes this issue.
- I used the GitHub search to find a similar question and didn't find it.
- I am sure that this is a bug in LangChain rather than my code.
- The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
- This is not related to the langchain-community package.
- I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.
Package (Required)
- langchain
- langchain-openai
- langchain-anthropic
- langchain-classic
- langchain-core
- langchain-cli
- langchain-model-profiles
- langchain-tests
- langchain-text-splitters
- langchain-chroma
- langchain-deepseek
- langchain-exa
- langchain-fireworks
- langchain-groq
- langchain-huggingface
- langchain-mistralai
- langchain-nomic
- langchain-ollama
- langchain-perplexity
- langchain-prompty
- langchain-qdrant
- langchain-xai
- Other / not sure / general
Example Code (Python)
NoneError Message and Stack Trace (if applicable)
Description
In langchain_core.messages.get_buffer_string, when processing an AIMessage, it still relies on the old additional_kwargs["function_call"]. The problematic section is:
if isinstance(m, AIMessage) and "function_call" in m.additional_kwargs:
message += f"{m.additional_kwargs['function_call']}"
string_messages.append(message)
Issues:
function_callis deprecated.- Most providers (including the latest OpenAI, Anthropic, Gemini, etc.) no longer return this field.
- As a result, tool call information cannot be output.
🛠 Suggested fix:
if isinstance(m, AIMessage) and m.tool_calls:
message += f"{m.tool_calls}"
System Info
System Information
OS: Windows
OS Version: 10.0.26100
Python Version: 3.12.12 (main, Oct 14 2025, 21:24:50) [MSC v.1944 64 bit (AMD64)]
Package Information
langchain_core: 1.0.4
langchain: 1.0.5
langsmith: 0.4.38
langchain_mcp_adapters: 0.1.12
langchain_openai: 1.0.1
langgraph_api: 0.5.0
langgraph_cli: 0.4.4
langgraph_runtime_inmem: 0.15.0
langgraph_sdk: 0.2.9
Optional packages not installed
langserve
Other Dependencies
blockbuster: 1.5.25
click: 8.3.0
cloudpickle: 3.1.1
cryptography: 44.0.3
grpcio: 1.76.0
grpcio-tools: 1.75.1
httpx: 0.28.1
jsonpatch: 1.33
jsonschema-rs: 0.29.1
langgraph: 1.0.3
langgraph-checkpoint: 3.0.0
mcp: 1.20.0
openai: 2.6.1
opentelemetry-api: 1.38.0
opentelemetry-exporter-otlp-proto-http: 1.38.0
opentelemetry-sdk: 1.38.0
orjson: 3.11.4
packaging: 25.0
protobuf: 6.33.0
pydantic: 2.12.3
pyjwt: 2.10.1
python-dotenv: 1.2.1
pyyaml: 6.0.3
requests: 2.32.5
requests-toolbelt: 1.0.0
sse-starlette: 2.1.3
starlette: 0.49.1
structlog: 25.5.0
tenacity: 9.1.2
tiktoken: 0.12.0
truststore: 0.10.4
typing-extensions: 4.15.0
uvicorn: 0.38.0
watchfiles: 1.1.1
zstandard: 0.25.0