mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-12 04:37:51 +02:00
chore(prebuilt): remove support for models that used bind_X (#5958)
Remove support for models w/ `.bind` used to streamline public API + recommendations Also cleaning up `typing.py` file as requested :)
This commit is contained in:
@@ -35,7 +35,6 @@ from langgraph.prebuilt.chat_agent_executor import (
|
||||
AgentState,
|
||||
AgentStatePydantic,
|
||||
StateSchemaType,
|
||||
_get_model,
|
||||
_validate_chat_history,
|
||||
)
|
||||
from langgraph.prebuilt.tool_node import (
|
||||
@@ -304,24 +303,6 @@ def test_model_with_tools(tool_style: str, version: str, include_builtin: bool)
|
||||
)
|
||||
|
||||
|
||||
def test_support_preconfigured_models_but_not_for_tools() -> None:
|
||||
"""Support (at least temporarily) some model pre-configuration.
|
||||
|
||||
This is a temporary workaround to support pre-configured models
|
||||
for things like temperature or api keys (done via .bind).
|
||||
|
||||
We do not want users to pre-bind tools to the models.
|
||||
"""
|
||||
model = FakeToolCallingModel()
|
||||
|
||||
@dec_tool
|
||||
def tool1(some_val: int) -> str:
|
||||
"""Tool 1 docstring."""
|
||||
return f"Tool 1: {some_val}"
|
||||
|
||||
create_react_agent(model.bind(temperature=3), [tool1])
|
||||
|
||||
|
||||
def test__validate_messages():
|
||||
# empty input
|
||||
_validate_chat_history([])
|
||||
@@ -1229,30 +1210,6 @@ def test_tool_node_node_interrupt(
|
||||
)
|
||||
|
||||
|
||||
def test_get_model() -> None:
|
||||
model = FakeToolCallingModel(tool_calls=[])
|
||||
assert _get_model(model) == model
|
||||
|
||||
@dec_tool
|
||||
def some_tool(some_val: int) -> str:
|
||||
"""Tool docstring."""
|
||||
return "meow"
|
||||
|
||||
model_with_tools = model.bind_tools([some_tool])
|
||||
assert _get_model(model_with_tools) == model
|
||||
|
||||
seq = model | RunnableLambda(lambda message: message)
|
||||
assert _get_model(seq) == model
|
||||
|
||||
seq_with_tools = model.bind_tools([some_tool]) | RunnableLambda(
|
||||
lambda message: message
|
||||
)
|
||||
assert _get_model(seq_with_tools) == model
|
||||
|
||||
with pytest.raises(TypeError):
|
||||
_get_model(RunnableLambda(lambda message: message))
|
||||
|
||||
|
||||
@pytest.mark.parametrize("version", REACT_TOOL_CALL_VERSIONS)
|
||||
def test_dynamic_model_basic(version: str) -> None:
|
||||
"""Test basic dynamic model functionality."""
|
||||
|
||||
Reference in New Issue
Block a user