test_create_retriever_tool_get_type_hints() — langchain Function Reference
Architecture documentation for the test_create_retriever_tool_get_type_hints() function in test_tools.py from the langchain codebase.
Entity Profile
Dependency Diagram
graph TD 3c140bbd_1e23_7686_ff06_6a252f05cd21["test_create_retriever_tool_get_type_hints()"] 8e7836ae_e72c_f670_72a5_4ca6d46e3555["test_tools.py"] 3c140bbd_1e23_7686_ff06_6a252f05cd21 -->|defined in| 8e7836ae_e72c_f670_72a5_4ca6d46e3555 8d5bd17d_0055_b4e9_b44a_08c070f779ab["_get_relevant_documents()"] 3c140bbd_1e23_7686_ff06_6a252f05cd21 -->|calls| 8d5bd17d_0055_b4e9_b44a_08c070f779ab style 3c140bbd_1e23_7686_ff06_6a252f05cd21 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
libs/core/tests/unit_tests/test_tools.py lines 2299–2322
def test_create_retriever_tool_get_type_hints() -> None:
"""Verify get_type_hints works on retriever tool's func.
This test ensures compatibility with Python 3.12+ where get_type_hints()
raises TypeError on functools.partial objects. Tools like LangGraph's
ToolNode call get_type_hints(tool.func) to generate schemas.
"""
class MyRetriever(BaseRetriever):
@override
def _get_relevant_documents(
self, query: str, *, run_manager: CallbackManagerForRetrieverRun
) -> list[Document]:
return [Document(page_content="test")]
retriever = MyRetriever()
retriever_tool = tools.create_retriever_tool(
retriever, "test_tool", "Test tool for type hints"
)
# This should not raise TypeError (as it did with functools.partial)
hints = get_type_hints(retriever_tool.func)
assert "query" in hints
assert hints["query"] is str
Domain
Subdomains
Defined In
Source
Frequently Asked Questions
What does test_create_retriever_tool_get_type_hints() do?
test_create_retriever_tool_get_type_hints() is a function in the langchain codebase, defined in libs/core/tests/unit_tests/test_tools.py.
Where is test_create_retriever_tool_get_type_hints() defined?
test_create_retriever_tool_get_type_hints() is defined in libs/core/tests/unit_tests/test_tools.py at line 2299.
What does test_create_retriever_tool_get_type_hints() call?
test_create_retriever_tool_get_type_hints() calls 1 function(s): _get_relevant_documents.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free