Skip to content

Fix deep_research method to convert camelCase to snake_case and add dot notation access #1536

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

devin-ai-integration[bot]
Copy link
Contributor

Fix deep_research method to convert camelCase to snake_case and add dot notation access

Changes

  • Added utility functions to convert camelCase to snake_case recursively
  • Implemented a DotDict class to provide dot notation access to response objects
  • Modified the deep_research method to use these utilities
  • Updated the check_deep_research_status method to convert API responses
  • Bumped version from 2.5.4 to 2.6.0
  • Added a test script to verify the changes

Testing

The changes have been tested with the example code provided in the issue. The deep_research method now returns responses with snake_case keys and dot notation access.

Example usage:

results = firecrawl.deep_research(
    query="What are the latest developments in quantum computing?",
    max_depth=5,
    time_limit=180,
    max_urls=15,
    on_activity=on_activity
)

# Access research findings using dot notation and snake_case
print(f"Final Analysis: {results.data.final_analysis}")
print(f"Sources: {len(results.data.sources)} references")

Link to Devin run

https://app.devin.ai/sessions/e3aae736a2b84391915cc8e7e8568757

Requested by

Nicolas Camara

Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Contributor Author

After reviewing other endpoints in the SDK, I found that most methods use Pydantic models for response handling, which provides a more structured approach compared to deep_research that was returning raw JSON. The utility functions implemented in this PR (convert_dict_keys_to_snake_case and convert_to_dot_dict) could potentially be useful for other methods in the future if they need similar functionality, but currently the deep_research method was the main one needing this fix.

Copy link
Contributor Author

Added type hints for the deep_research response structure using TypedDict classes. This provides better IDE autocompletion for the response fields, including the final_analysis field. The type hints are defined in utils.py and imported in firecrawl.py.

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.

0 participants