Skip to content

RAGQA

Bases: AliasIngredient

run(question, source='bing', options=None, modifier=None, output_type=None, *args, **kwargs)

Returns a subquery which first fetches relevant context from a source, and returns a retrieval-augmented LM generation.

Parameters:

Name Type Description Default
question str

The query string to use for both retrieval and generation

required
source Literal['bing']

The source of the retrieved information. Currently only supports 'bing'

'bing'

Examples:

from blendsql.ingredients import RAGQA
# Among the schools with the average score in Math over 560 in the SAT test, how many schools are in the bay area?
blendsql_query = """
SELECT COUNT(DISTINCT s.CDSCode)
    FROM schools s
    JOIN satscores sa ON s.CDSCode = sa.cds
    WHERE sa.AvgScrMath > 560
    AND s.County IN {{RAGQA('Which counties are in the Bay Area?')}}
"""
ingredients = {RAGQA}
...