burr icon indicating copy to clipboard operation
burr copied to clipboard

deep researcher example

Open margaretlange opened this issue 8 months ago • 11 comments

In the project's discord server, I discussed the possibility of contributing an example I wrote as a PR with the maintainers, so I did.

Changes

I added an example to the folder of examples.

How I tested this

I installed from local requirements.txt and ran the application.py file in examples.

Notes

Checklist

  • [ x] PR has an informative and human-readable title (this will be pulled into the release notes)
  • [ x] Changes are limited to a single goal (no scope creep)
  • [ ] Code passed the pre-commit check & code is left cleaner/nicer than when first encountered.
  • [x] Any change in functionality is tested
  • [ ] New functions are documented (with a description, list of inputs, and expected output)
  • [ ] Placeholder code is flagged / future TODOs are captured in comments
  • [ ] Project documentation has been updated if adding/changing functionality.

[!IMPORTANT] Adds a deep-researcher example using the Burr framework, demonstrating a research assistant workflow with OpenAI and Tavily API integration.

  • New Example:
    • Adds deep-researcher example in examples/.
    • Implements a research assistant using Burr framework in application.py.
  • Functionality:
    • query_openai() in application.py to interact with OpenAI API.
    • generate_query(), web_research(), summarize_sources(), reflect_on_summary(), finalize_summary() actions in application.py for research workflow.
    • Uses tavily_search() in utils.py to perform web searches.
  • Prompts and Utilities:
    • prompts.py contains instructions for query generation, summarization, and reflection.
    • utils.py provides functions for formatting and deduplicating search results.
  • Documentation:
    • README.md provides setup and usage instructions.
    • requirements.txt lists dependencies.

This description was created by Ellipsis for 4f34744cb9c8c1d262848da76ee49cbb75483995. You can customize this summary. It will automatically update as commits are pushed.

margaretlange avatar Apr 18 '25 23:04 margaretlange

@margaretlange sorry been a bit busy. Will try to take a look at this coming weekend.

skrawcz avatar Apr 28 '25 18:04 skrawcz

@margaretlange sorry been a bit busy. Will try to take a look at this coming weekend.

thanks. I have a version now with the basic deep researcher added to the UI/examples. Is that something you might be interested in? (I was getting it set up as a preliminary to testing the planned streaming version since I think visualizing through react is helpful.)

margaretlange avatar May 01 '25 01:05 margaretlange

nice, sure. Happy to take a look at that as well.

On Wed, Apr 30, 2025 at 6:34 PM Margaret Lange @.***> wrote:

margaretlange left a comment (DAGWorks-Inc/burr#530) https://github.com/DAGWorks-Inc/burr/pull/530#issuecomment-2843880850

@margaretlange https://github.com/margaretlange sorry been a bit busy. Will try to take a look at this coming weekend.

thanks. I have a version now with the basic deep researcher added to the UI/examples. Is that something you might be interested in? (I was getting it set up as a preliminary to testing the planned streaming version since I think visualizing through react is helpful.)

— Reply to this email directly, view it on GitHub https://github.com/DAGWorks-Inc/burr/pull/530#issuecomment-2843880850, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARYMB63O5X5PDQFRVIB54T24F223AVCNFSM6AAAAAB3N3YMOGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQNBTHA4DAOBVGA . You are receiving this because you commented.Message ID: @.***>

skrawcz avatar May 01 '25 15:05 skrawcz

OK, I added that change. If you aren't interested in it, but do want the original example, the last commit without the server/npm integration is 9df9c820aac2e4737c44215f6d5a6cd5369358c2. By the way, when I recreated the react api code with scripts/client-gen.sh, which I needed to do to add my changes easily, I did run the linters and formatters afterwards. But I still am seeing a bunch of changes in react files that are just indentations. If you can tell me how to get rid of those I can clean up the commit.

margaretlange avatar May 01 '25 20:05 margaretlange

I'm sorry a few things came up this weekend that I needed to handle and want able to get to this. This week 🤞.

On Thu, May 1, 2025, 1:29 PM Margaret Lange @.***> wrote:

margaretlange left a comment (DAGWorks-Inc/burr#530) https://github.com/DAGWorks-Inc/burr/pull/530#issuecomment-2845703375

OK, I added that change. By the way, when I recreated the react api code with scripts/client-gen.sh, which I needed to do to add my changes easily, I did run the linters and formatters afterwards. But I still am seeing a bunch of changes in react files that are just indentations. If you can tell me how to get rid of those I can clean up the commit.

— Reply to this email directly, view it on GitHub https://github.com/DAGWorks-Inc/burr/pull/530#issuecomment-2845703375, or unsubscribe https://github.com/notifications/unsubscribe-auth/AARYMBY7FQJET7YHVNDA3IL24J7Y3AVCNFSM6AAAAAB3N3YMOGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDQNBVG4YDGMZXGU . You are receiving this because you commented.Message ID: @.***>

skrawcz avatar May 05 '25 15:05 skrawcz

thanks. let me know if there's anything you need from me.

margaretlange avatar May 05 '25 19:05 margaretlange

would it help if I walked you through this? I could schedule a time. let me know.

margaretlange avatar May 12 '25 01:05 margaretlange

Oh and one more request -- could you please modify the description of this PR with an explanation of this PR and whether there were any "design decisions" you made with it? (i.e. what would you want to mention about this code to someone else coming after you?) I'll then use this as part of the commit message when I do a squash merge (right now there are too many commits so we'd squash them into one on merge).

skrawcz avatar May 12 '25 04:05 skrawcz

Thanks for looking at this. I'll get back to you tomorrow.

margaretlange avatar May 12 '25 04:05 margaretlange

no worries @margaretlange!

Also another thing to fix up for the pre-commit failure:

black....................................................................Failed
- hook id: black
- files were modified by this hook

reformatted examples/deep-researcher/application.py

So if you run black on that then the pre-commit hooks should pass too.

skrawcz avatar May 12 '25 04:05 skrawcz

Sorry for the delay. I tried to address all your comments.

  • model_costs.json has been reverted to the latest file on the main branch. I just downloaded it and overwrote my own.
  • the MIT license has been moved from the README to the two files I used from the other repository. I mention the other codebase in the README but don't include the license, as you suggest.
  • I did some additions to the react code for the deep researcher based on the email assistant and it should show an error message now when one or both of the keys are not present.
  • I ran black on application.py
  • I wrote a longer commit message for commit 053b87c77e6dc517f9616ca3c75500a48f7647c0. Feel free to use this as the message when you squash my commits. Or if it's not quite what you wanted, you can edit it or let me know.

re: the whitespace. When I generated the code using client-gen.sh, I got some changes based on there being four rather than two spaces in the generated API wrapper. So I ran npm run format:fix, which changed all the api files to have two spaces. However, some came in with four spaces, so there's a change. This is a minor inconsistency in the existing codebase, see for instance BackendSpec.ts (2 spaces) versus BeginEntryModel.ts (4 spaces) on the main branch. I wasn't quite sure how to resolve it. Let me know if you want me to try something else.

Thanks for all these comments and great documentation online that let me write this.

margaretlange avatar May 13 '25 20:05 margaretlange

thanks that's great!

margaretlange avatar May 27 '25 03:05 margaretlange