Skip to content

features:Added new tools to the FinancialDatasetAPI#532

Open
Jonathan Reynold Gomes (devgomesai) wants to merge 4 commits intolangchain-ai:mainfrom
devgomesai:devgomesai/fianacial_datasets_features
Open

features:Added new tools to the FinancialDatasetAPI#532
Jonathan Reynold Gomes (devgomesai) wants to merge 4 commits intolangchain-ai:mainfrom
devgomesai:devgomesai/fianacial_datasets_features

Conversation

@devgomesai

Description

This PR extends the FinancialDatasetsToolkit by adding two new tools:

  • FinancialMetrics — exposes metrics-related endpoints via the shared FinancialDatasetsAPIWrapper
  • FinancialSnapshots — enables snapshot-based financial data access using the same wrapper

Both tools are initialized with the existing api_wrapper, ensuring consistent authentication, configuration, and reuse across the toolkit.
These additions make commonly used Financial Datasets endpoints available as first-class LangChain tools.

Issue

N/A

Dependencies

None.
No new dependencies were added and no existing dependency versions were modified.

Lint and test
make format
make lint
make test
All relevant checks have been run locally.

Additional notes

  • Changes are backwards compatible
  • No updates to pyproject.toml or uv.lock
  • Optional dependencies follow existing LangChain import patterns
  • API keys are resolved via environment variables, consistent with other integrations

Comment on lines +46 to +47
def __init__(self, api_wrapper: FinancialDatasetsAPIWrapper):
super().__init__(api_wrapper=api_wrapper)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The init method violates the 'Use Google-Style Docstrings (with Args section)' rule. This public method lacks a Google-style docstring with an Args section. It should include documentation explaining the api_wrapper parameter. Add a docstring like: '''Initialize the FinancialMetrics tool.

Args:
api_wrapper: The FinancialDatasetsAPIWrapper instance for API calls.'''

Suggested change
def __init__(self, api_wrapper: FinancialDatasetsAPIWrapper):
super().__init__(api_wrapper=api_wrapper)
def __init__(self, api_wrapper: FinancialDatasetsAPIWrapper):
"""Initialize the FinancialMetrics tool.
Args:
api_wrapper: The FinancialDatasetsAPIWrapper instance for API calls.
"""
super().__init__(api_wrapper=api_wrapper)

Spotted by Graphite Agent (based on custom rule: Code quality)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Comment on lines +34 to +35
def __init__(self, api_wrapper: FinancialDatasetsAPIWrapper):
super().__init__(api_wrapper=api_wrapper)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The init method violates the 'Use Google-Style Docstrings (with Args section)' rule. This public method lacks a Google-style docstring with an Args section. It should include documentation explaining the api_wrapper parameter. Add a docstring like: '''Initialize the FinancialSnapshots tool.

Args:
api_wrapper: The FinancialDatasetsAPIWrapper instance for API calls.'''

Suggested change
def __init__(self, api_wrapper: FinancialDatasetsAPIWrapper):
super().__init__(api_wrapper=api_wrapper)
def __init__(self, api_wrapper: FinancialDatasetsAPIWrapper):
"""Initialize the FinancialSnapshots tool.
Args:
api_wrapper: The FinancialDatasetsAPIWrapper instance for API calls.
"""
super().__init__(api_wrapper=api_wrapper)

Spotted by Graphite Agent (based on custom rule: Code quality)

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Comment on lines +16 to +21
period: str = Field(
description="The period of the financial metrics. "
"Possible values are: "
"annual, quarterly, ttm. "
"Default is 'annual'.",
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The period field in the schema is required (no default value) but the implementation treats it as optional with a default of 'annual'. This mismatch will force users to always provide a period value even though the description says "Default is 'annual'" and the API wrapper uses kwargs.get("period", "annual") on line 203. This will cause the tool to fail validation when users expect to rely on the default.

Fix by making the field optional with a default:

period: str = Field(
    default="annual",
    description="The period of the financial metrics. "
    "Possible values are: "
    "annual, quarterly, ttm.",
)
Suggested change
period: str = Field(
description="The period of the financial metrics. "
"Possible values are: "
"annual, quarterly, ttm. "
"Default is 'annual'.",
)
period: str = Field(
default="annual",
description="The period of the financial metrics. "
"Possible values are: "
"annual, quarterly, ttm.",
)

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

Comment on lines +22 to +24
limit: int = Field(
description="The number of financial metrics to return. Default is 10.",
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The limit field in the schema is required (no default value) but the implementation treats it as optional with a default of 10. The _run method signature shows limit: Optional[int] on line 53, and the API wrapper uses kwargs.get("limit", 10) on line 204. This mismatch will force users to always provide a limit value even though the description says "Default is 10." This will cause validation errors when users expect to rely on the default.

Fix by making the field optional with a default:

limit: int = Field(
    default=10,
    description="The number of financial metrics to return.",
)
Suggested change
limit: int = Field(
description="The number of financial metrics to return. Default is 10.",
)
limit: int = Field(
default=10,
description="The number of financial metrics to return.",
)

Spotted by Graphite Agent

Fix in Graphite


Is this helpful? React 👍 or 👎 to let us know.

@keenborder786
Copy link
Contributor

Linked to following Issue: #531

@keenborder786
Copy link
Contributor

Jonathan Reynold Gomes (@devgomesai) it would be really good for the community if you can post the Docs that you have followed.

@devgomesai
Copy link
Author

Jonathan Reynold Gomes (devgomesai) commented Feb 18, 2026

Jonathan Reynold Gomes (Jonathan Reynold Gomes (@devgomesai)) it would be really good for the community if you can post the Docs that you have followed.
The Docs regarding the api's
https://docs.financialdatasets.ai/api/financial-metrics/historical
https://docs.financialdatasets.ai/api/financial-metrics/snapshot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants