Skip to content

Conversation

@stefanoamorelli
Copy link
Owner

@stefanoamorelli stefanoamorelli commented Dec 16, 2025

The tool classes had grown messy with duplicated helper methods across company, filings, financial, and insider modules. Each class had its own copy of _parse_date, _find_filing, and _build_sec_url doing the same thing.

Additionally, the LLM prompts used verbose CAPS formatting like "CRITICAL INSTRUCTIONS" and "NEVER DO THIS" which felt clunky and hard to read.

I've introduced a BaseTools class that all tool classes now inherit from, consolidating the shared utilities in one place. I also moved XBRL extraction logic out of financial.py into a dedicated xbrl.py module since financial.py had grown to 860+ lines and was difficult to navigate.

The LLM prompts now use XML tags like <instructions>, <when-to-use>, <tip>, and <presentation> which are cleaner and easier to parse. The base financial instructions are defined once and interpolated where needed via f-strings.

Note: types.py was removed since ToolResponse is now exported from base.py.

Shared helper methods were duplicated across tool classes.
BaseTools consolidates _parse_date, _find_filing, and _build_sec_url.

XBRL extraction moved to xbrl.py to reduce financial.py size.

LLM prompts now use XML tags instead of CAPS formatting.
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