Skip to content

V1 - #24

Merged
ApexYash11 merged 8 commits into
mainfrom
v1
Jun 19, 2026
Merged

V1#24
ApexYash11 merged 8 commits into
mainfrom
v1

Conversation

@ApexYash11

@ApexYash11 ApexYash11 commented Jun 19, 2026 •

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

Release Notes

  • New Features

    • Added support for Groq as the primary LLM provider.
    • Introduced Financial Modeling Prep (FMP) as a financial data provider option.
    • Implemented persistent disk-based caching for financial data queries.
    • Added provider health checks to verify data availability.
  • Bug Fixes

    • Improved handling of keyboard interrupts during research execution.
    • Enhanced concurrent request coordination to prevent duplicate API calls.
  • Chores

    • Updated LLM API key configuration from OpenRouter to Groq.
    • Added aiosqlite dependency for persistent caching.
    • Refined CLI output formatting and rendering performance.

… condition, TASK_COMPLETED description

- Issue 1: Fix lambda late-binding in executor.py by capturing ticker as default arg
- Issue 2: Add per-key asyncio.Lock to in-memory cache, hold lock across entire fetch cycle
- Issue 5: Add missing 'description' key to TASK_COMPLETED log event payload
- Add regression tests for all three fixes
…x sources, remove dead code, fix dual-Console

- Issue 3: Untrack dist/ artifacts, add to .gitignore (no history rewrite)
- Issue 4: Single-source __version__ via importlib.metadata in __init__.py
- Issue 14: Replace 'SEC EDGAR' fallback with 'Alpha Vantage', 'yfinance'
- Issue 16: Delete dead render_mission_board(), update tests to use build_persistent_board
- Issue 17: Remove module-level Console from render.py, pass as parameter
…undary preview, non-streaming fallback signal

Quick path (Issues 6+7+8+9+10):
- Issue 6: Lower 300-char gate to 60 for faster preview visibility
- Issue 7: Reduce debounce 200ms→80ms, Live 2fps→10fps for smooth rendering
- Issue 8: Replace tier-2 print dots with actual word output at sentence breaks
- Issue 9: Signal 'non-streaming mode' to UI before blocking ainvoke fallback
- Issue 10: Replace raw tail-slice preview with sentence-boundary extraction
…t, quarterly reports, CI cleanup

- Issue 11: Rename validator->Validator, validationresult->ValidationResult across all files
- Issue 12: AlphaVantageClient uses persistent httpx.AsyncClient (not per-request)
- Issue 13: AV returns quarterlyReports alongside annualReports for all 3 statement types
- Issue 15: Strip CI lint step of debug echos and fallback gymnastics
…ful exit

- Issue 18: Fix remaining LSP errors across the codebase
- Issue 19: Strip extraneous whitespace from TASK_COMPLETED streaming output
- Issue 20: Filter repeated markdown headings from board preview
- Issue 21: Add try/except for clean KeyboardInterrupt exit path
- Issue 22: Centralize ~/.jasper into JASPER_HOME in core/config.py
…heck, call tracking

- Issue 24: Add aiosqlite L2 disk cache that survives process restarts
- Issue 25: Create FMP provider (250 calls/day free) with persistent httpx client
- Issue 26: Add check_provider_health() and get_call_counts() to FinancialDataRouter
- Issue 27: Track per-provider API call counts for rate-limit awareness
- Add aiosqlite>=0.19.0 to pyproject.toml dependencies
@coderabbitai

coderabbitai Bot commented Jun 19, 2026 •

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 287d574e-5710-4047-943d-427d5d6bcbc0

📥 Commits

Reviewing files that changed from the base of the PR and between a131ca6 and 551935c.

⛔ Files ignored due to path filters (6)
  • dist/jasper_finance-1.1.1-py3-none-any.whl is excluded by !**/dist/**
  • dist/jasper_finance-1.1.1.tar.gz is excluded by !**/dist/**, !**/*.gz
  • dist/jasper_finance-1.1.4-py3-none-any.whl is excluded by !**/dist/**
  • dist/jasper_finance-1.1.4.tar.gz is excluded by !**/dist/**, !**/*.gz
  • dist/jasper_finance-1.1.6-py3-none-any.whl is excluded by !**/dist/**
  • dist/jasper_finance-1.1.6.tar.gz is excluded by !**/dist/**, !**/*.gz
📒 Files selected for processing (27)
  • .github/workflows/ci.yml
  • .gitignore
  • jasper/__init__.py
  • jasper/agent/executor.py
  • jasper/agent/synthesizer.py
  • jasper/agent/validator.py
  • jasper/cli/interface.py
  • jasper/cli/main.py
  • jasper/cli/render.py
  • jasper/core/config.py
  • jasper/core/controller.py
  • jasper/core/llm.py
  • jasper/core/state.py
  • jasper/observability/logger.py
  • jasper/tools/financials.py
  • jasper/tools/providers/alpha_vantage.py
  • jasper/tools/providers/fmp.py
  • pyproject.toml
  • tests/smoke_test.py
  • tests/test_cache_concurrency.py
  • tests/test_cli_integration.py
  • tests/test_critical_fixes.py
  • tests/test_edge_case_fixes.py
  • tests/test_executor_lambda.py
  • tests/test_logger_events.py
  • tests/test_rich_live_rendering.py
  • tests/test_rich_logger_fixes.py

📝 Walkthrough

Walkthrough

Switches LLM backend from OpenRouter to Groq, adds FMPClient as a third financial data provider, introduces two-tier async SQLite caching with per-key asyncio.Lock in FinancialDataRouter, renames validationresult → ValidationResult, wires all providers through the controller and CLI, overhauls RichLogger synthesis preview and debouncing, adds disk-backed report caching, and adds concurrency/regression tests.

Changes

Jasper: Groq LLM, FMP provider, async caching, Validator rename, CLI overhaul

Layer / File(s) Summary
Config foundation: JASPER_HOME, Groq API key, LLM backend
jasper/core/config.py, jasper/core/llm.py, jasper/observability/logger.py
Adds JASPER_HOME = Path("~/.jasper").expanduser() as the shared home path constant. Switches get_llm_api_key() to read GROQ_API_KEY. Reconfigures get_llm() to use Groq's OpenAI-compatible endpoint with a new default model, removing OpenRouter headers. Migrates logger to use JASPER_HOME / "logs" via pathlib.
State schema: ValidationResult rename and field wiring
jasper/core/state.py
Renames validationresult → ValidationResult (PascalCase). Updates Jasperstate.validation type to Optional[ValidationResult]. Reformats ReportMode, Task, ConfidenceBreakdown, and InferenceLink field declarations.
New FMPClient financial data provider
jasper/tools/providers/fmp.py, pyproject.toml
Introduces FMPClient with a reusable httpx.AsyncClient, HTTP/FMP error validation, and income_statement, balance_sheet, cash_flow methods that fetch 5 records and normalize all fields to strings. Adds aiosqlite>=0.19.0 to runtime dependencies.
AlphaVantageClient: persistent HTTP client and annual+quarterly aggregation
jasper/tools/providers/alpha_vantage.py
Adds a cached httpx.AsyncClient via _get_client() and close(). Updates all three statement methods to aggregate annualReports + quarterlyReports and validate the combined list is non-empty.
FinancialDataRouter: async SQLite disk cache, per-key locks, provider health
jasper/tools/financials.py
Adds _cache_locks dict and _get_cache_lock() for per-key concurrency. Replaces synchronous cache helpers with async variants and an aiosqlite-backed disk cache with TTL eviction. Extends FinancialDataRouter with check_provider_health() and get_call_counts(). Rewrites _fetch_with_fallback to use a two-tier L1/L2 cache guarded by asyncio.Lock; realtime_quote bypasses caching.
Agent pipeline: Validator rename, confidence scoring, executor lambda fix, synthesizer fallback
jasper/agent/validator.py, jasper/agent/executor.py, jasper/agent/synthesizer.py
Renames class validator → Validator; validate() return type → ValidationResult. Replaces fixed data_quality=0.85 with a query-length-derived base + modifier formula. Fixes executor ticker lambda to use default-argument capture (lambda t=ticker: ...). Adds a token_callback status emit before chain.ainvoke in the synthesizer's non-streaming fallback path.
Controller & pipeline wiring
jasper/core/controller.py, jasper/__init__.py
Updates JasperController.__init__ parameter type to Validator. Adds PLAN_CREATED logging and richer TASK_STARTED/TASK_COMPLETED telemetry with task_id/status/description. Restructures synthesis error classification. Reworks _build_final_report with list-result capping and qualitative evidence fallbacks; FinalReport now includes confidence_breakdown. In __init__.py: dynamic __version__ via importlib.metadata, optional FMPClient insertion, Validator/Synthesizer instantiation in run_research.
CLI render helpers: console injection and interface overhaul
jasper/cli/render.py, jasper/cli/interface.py
Removes module-level Console() singleton; render_status/error/warning/success now accept an explicit console parameter. Removes render_mission_board. Rewrites _fix_markdown_tables / _parse_financial_table with multi-pass normalization and row reconstruction. Reformats build_persistent_board, update_phase_node, render_final_report, and render_forensic_report.
CLI main: disk report cache, FMP wiring, RichLogger synthesis preview
jasper/cli/main.py
Adds _save_report_to_disk / _load_report_from_disk under JASPER_HOME. Updates RichLogger debounce to 80ms and preview threshold to 60 chars; replaces dot-printing with throttled \r in-place stdout preview using sentence splitting. Increases Live refresh to 10 Hz. Wraps controller.run to handle KeyboardInterrupt. Optionally inserts FMPClient when FMP_API_KEY is set.
Tests: new regression tests and updated assertions
tests/test_cache_concurrency.py, tests/test_executor_lambda.py, tests/test_logger_events.py, tests/smoke_test.py, tests/test_cli_integration.py, tests/test_critical_fixes.py, tests/test_edge_case_fixes.py, tests/test_rich_live_rendering.py, tests/test_rich_logger_fixes.py
Adds concurrency dedup test (10 concurrent fetches → 1 API call), ticker-isolation test for executor lambdas, and TASK_COMPLETED description field regression test. Updates all suites for Validator rename, removed render_mission_board, 10 Hz refresh, 80ms debounce, 60-char preview threshold, setup_method SQLite cache clearing, and new FinalReport fields.
CI and build artifact hygiene
.github/workflows/ci.yml, .gitignore
Simplifies ruff lint step to python -m ruff check .. Adds dist/, *.whl, *.egg-info/, and exports/ to .gitignore.

Sequence Diagram(s)

sequenceDiagram
  participant User as User (CLI ask)
  participant Main as cli/main.py (execute_research)
  participant Controller as JasperController.run()
  participant Executor as Executor.execute_task()
  participant Router as FinancialDataRouter._fetch_with_fallback()
  participant Cache as SQLite / in-memory cache
  participant Provider as AlphaVantage / FMP / yfinance
  participant Validator as Validator.validate()
  participant Synthesizer as Synthesizer.synthesize()
  participant Groq as Groq API

  User->>Main: ask(query)
  Main->>Controller: run(query)
  Controller->>Controller: log PLAN_CREATED
  loop parallel tasks
    Controller->>Executor: execute_task(task)
    Controller->>Controller: log TASK_STARTED
    Executor->>Router: _fetch_with_fallback(method, ticker)
    Router->>Cache: check L1 in-memory
    alt cache miss
      Router->>Cache: check L2 SQLite (TTL)
      alt disk miss
        Router->>Provider: income_statement / balance_sheet / cash_flow
        Provider-->>Router: data
        Router->>Cache: write L1 + L2
      end
    end
    Router-->>Executor: result
    Executor-->>Controller: completed task
    Controller->>Controller: log TASK_COMPLETED (task_id, description)
  end
  Controller->>Validator: validate(state)
  Validator-->>Controller: ValidationResult
  Controller->>Synthesizer: synthesize(state, token_callback)
  Synthesizer->>Groq: chain.astream / chain.ainvoke
  Groq-->>Synthesizer: tokens
  Synthesizer-->>Controller: report text
  Controller->>Main: Jasperstate with FinalReport
  Main->>Main: _save_report_to_disk(report)
  Main-->>User: rendered report
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Poem

🐇 Hop, hop! The LLM switched to Groq today,
Three providers fetch the data — FMP joins the fray!
SQLite locks keep concurrent paws in line,
ValidationResult now spelled with caps so fine.
Dot-printing gone, a smooth \r preview streams,
The rabbit ships it all — or so it seems! 🎉

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch v1

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@ApexYash11
ApexYash11 merged commit 0726a76 into main Jun 19, 2026
2 of 7 checks passed
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.

1 participant