Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

community: Allow override of 'fetch_schema_from_transport' in the GraphQL tool #17649

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions libs/community/langchain_community/utilities/graphql.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class GraphQLAPIWrapper(BaseModel):
"""

custom_headers: Optional[Dict[str, str]] = None
fetch_schema_from_transport: Optional[bool] = None
graphql_endpoint: str
gql_client: Any #: :meta private:
gql_function: Callable[[str], Any] #: :meta private:
Expand Down
1 change: 1 addition & 0 deletions libs/community/tests/unit_tests/utilities/test_graphql.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def test_run() -> None:
graphql_wrapper = GraphQLAPIWrapper(
graphql_endpoint=TEST_ENDPOINT,
custom_headers={"Authorization": "Bearer testtoken"},
fetch_schema_from_transport=True,
)
result = graphql_wrapper.run(query)

Expand Down
5 changes: 4 additions & 1 deletion libs/langchain/langchain/agents/load_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,10 @@ def _get_reddit_search(**kwargs: Any) -> BaseTool:
),
"stackexchange": (_get_stackexchange, []),
"sceneXplain": (_get_scenexplain, []),
"graphql": (_get_graphql_tool, ["graphql_endpoint", "custom_headers"]),
"graphql": (
_get_graphql_tool,
["graphql_endpoint", "custom_headers", "fetch_schema_from_transport"],
),
"openweathermap-api": (_get_openweathermap, ["openweathermap_api_key"]),
"dataforseo-api-search": (
_get_dataforseo_api_search,
Expand Down