Skip to content
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

Suggestions: Use Readability (JSDOM) and Query de-structuring #3

Open
oliviermills opened this issue Mar 16, 2024 · 1 comment
Open
Labels
enhancement New feature or request

Comments

@oliviermills
Copy link

Suggestions:

  1. Use Mozilla's Readabiility (requires JSDOM) but does a great job reduce the size of content from the webpage for the context injection. https://github.com/mozilla/readability

  2. Use Query decomposition rather than rephrasing, and doing parallel searches, this helps for more complex queries (but does multiple the hits to brave/serarch engine by 3), e.g Your role is to generate a few short and specific search queries to answer the QUERY below. List 3 options, 1 per line. - then parse the response with a split on \n and remove numbers - or use json response.
    Unchecked code sample:

// get variations of input
const queryVariations = [...(await getVariations(input)), input]
// run the search for each variation
const braveTasks = queryVariations.map(q => searchWithBrave(q))
// remove any duplicates based on all 3 variations to avoid fetching the html of the same page more than one)
// you could use this to rerank instead of removing.. ie if the result showed more than one you could higher rank it for RAG
const uniqueResults = _.uniqBy(await Promise.all(braveTasks)), "url")
@developersdigest
Copy link
Owner

Thank you for this! Let me dive in and try this :)

@developersdigest developersdigest added the enhancement New feature or request label Apr 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants