langchain-ai
langchain
BlogDocsChangelog

fix: Add bind_tools support to RunnableSequence for structured output chains

#32175Closed
Comparing
20ns:master
(
d24af2b
) with
master
(
10996a2
)
CodSpeed Performance Gauge
0%
Untouched
14

Benchmarks

Passed

test_init_time
libs/partners/groq/tests/unit_tests/test_standard.py::TestGroqStandard
CodSpeed Performance Gauge
0%
1.6 s1.6 s
test_init_time
libs/partners/anthropic/tests/unit_tests/test_standard.py::TestAnthropicStandard
CodSpeed Performance Gauge
0%
3.7 ms3.7 ms
test_init_time
libs/partners/openai/tests/unit_tests/chat_models/test_responses_standard.py::TestOpenAIResponses
CodSpeed Performance Gauge
0%
17.1 ms17.1 ms
test_init_time
libs/partners/mistralai/tests/unit_tests/test_standard.py::TestMistralStandard
CodSpeed Performance Gauge
0%
12.5 ms12.5 ms
test_init_time
libs/partners/openai/tests/unit_tests/chat_models/test_base_standard.py::TestOpenAIStandard
CodSpeed Performance Gauge
0%
17 ms17 ms
test_init_time
libs/partners/xai/tests/unit_tests/test_chat_models_standard.py::TestXAIStandard
CodSpeed Performance Gauge
0%
3.3 s3.3 s
test_init_time
libs/partners/deepseek/tests/unit_tests/test_chat_models.py::TestChatDeepSeekUnit
CodSpeed Performance Gauge
0%
1.6 s1.6 s
test_init_time
libs/partners/fireworks/tests/unit_tests/test_standard.py::TestFireworksStandard
CodSpeed Performance Gauge
0%
6.6 s6.6 s
test_init_time
libs/partners/openai/tests/unit_tests/chat_models/test_azure_standard.py::TestOpenAIStandard
CodSpeed Performance Gauge
0%
1.7 s1.7 s
test_stream_time
libs/partners/openai/tests/integration_tests/chat_models/test_responses_standard.py::TestOpenAIStandard
CodSpeed Performance Gauge
0%
1.1 s1.1 s
test_stream_time
libs/partners/openai/tests/integration_tests/chat_models/test_responses_standard.py::TestOpenAIResponses
CodSpeed Performance Gauge
0%
518.7 ms519.1 ms
test_stream_time
libs/partners/openai/tests/integration_tests/chat_models/test_base_standard.py::TestOpenAIStandard
CodSpeed Performance Gauge
0%
1.1 s1.1 s
test_stream_time
libs/partners/anthropic/tests/integration_tests/test_standard.py::TestAnthropicStandard
CodSpeed Performance Gauge
0%
15.9 ms15.9 ms
test_init_time_with_client
libs/partners/anthropic/tests/unit_tests/test_standard.py
CodSpeed Performance Gauge
0%
5.2 ms5.2 ms

Commits

Click on a commit to change the comparison range
Base
master
10996a2
+0.73%
fix: Add bind_tools support to RunnableSequence for structured output chains This resolves issue #28848 where calling bind_tools() on a RunnableSequence created by with_structured_output() would fail with AttributeError. The fix enables the combination of structured output and tool binding, which is essential for modern AI applications that need both: - Structured JSON output formatting - External function calling capabilities **Changes:** - Added bind_tools() method to RunnableSequence class - Method intelligently detects structured output patterns - Delegates tool binding to the underlying ChatModel - Preserves existing sequence structure and behavior - Added comprehensive unit tests **Technical Details:** - Detects 2-step sequences (Model < /dev/null | Parser) from with_structured_output() - Binds tools to the first step if it supports bind_tools() - Returns new RunnableSequence with updated model + same parser - Falls back gracefully with helpful error messages **Impact:** This enables previously impossible workflows like ChatGPT-style apps that need both structured UI responses and tool calling capabilities. Fixes #28848 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
941344c
4 months ago
by 20ns
-4.45%
style: Fix linting issues in RunnableSequence.bind_tools method - Remove quoted type annotations - Fix line length violations - Remove trailing whitespace - Use double quotes consistently - Improve error message formatting for better readability The S110 warnings about try-except-pass are intentional - we want silent fallback behavior before raising the final helpful error.
e6a4c4c
4 months ago
by 20ns
+3.69%
fix: Resolve all linting and type checking issues - Replace broad Exception catching with specific exceptions (AttributeError, TypeError, ValueError) - Add proper type annotations to test functions and variables - Add type: ignore comments for dynamic method assignment in tests - Fix line length violations and formatting issues - Ensure all MyPy checks pass All lint checks now pass successfully. The S110 warnings are resolved by using more specific exception handling instead of bare try-except-pass.
d24af2b
4 months ago
by 20ns
© 2025 CodSpeed Technology
Home Terms Privacy Docs