SQL Join Query Engine

SQL Join query engine.

class llama_index.query_engine.sql_join_query_engine.SQLAugmentQueryTransform(llm_predictor: Optional[BaseLLMPredictor] = None, sql_augment_transform_prompt: Optional[BasePromptTemplate] = None, check_stop_parser: Optional[Callable[[QueryBundle], bool]] = None)

SQL Augment Query Transform.

This query transform will transform the query into a more specific query after augmenting with SQL results.

  • llm_predictor (LLMPredictor) – LLM predictor to use for query transformation.

  • sql_augment_transform_prompt (BasePromptTemplate) – PromptTemplate to use for query transformation.

  • check_stop_parser (Optional[Callable[[str], bool]]) – Check stop function.

check_stop(query_bundle: QueryBundle) bool

Check if query indicates stop.

run(query_bundle_or_str: Union[str, QueryBundle], metadata: Optional[Dict] = None) QueryBundle

Run query transform.

class llama_index.query_engine.sql_join_query_engine.SQLJoinQueryEngine(sql_query_tool: QueryEngineTool, other_query_tool: QueryEngineTool, selector: Optional[Union[LLMSingleSelector, PydanticSingleSelector]] = None, service_context: Optional[ServiceContext] = None, sql_join_synthesis_prompt: Optional[BasePromptTemplate] = None, sql_augment_query_transform: Optional[SQLAugmentQueryTransform] = None, use_sql_join_synthesis: bool = True, callback_manager: Optional[CallbackManager] = None, verbose: bool = True)

SQL Join Query Engine.

This query engine can β€œJoin” a SQL database results with another query engine. It can decide it needs to query the SQL database or the other query engine. If it decides to query the SQL database, it will first query the SQL database, whether to augment information with retrieved results from the other query engine.

  • sql_query_tool (QueryEngineTool) – Query engine tool for SQL database. other_query_tool (QueryEngineTool): Other query engine tool.

  • selector (Optional[Union[LLMSingleSelector, PydanticSingleSelector]]) – Selector to use.

  • service_context (Optional[ServiceContext]) – Service context to use.

  • sql_join_synthesis_prompt (Optional[BasePromptTemplate]) – PromptTemplate to use for SQL join synthesis.

  • sql_augment_query_transform (Optional[SQLAugmentQueryTransform]) – Query transform to use for SQL augmentation.

  • use_sql_join_synthesis (bool) – Whether to use SQL join synthesis.

  • callback_manager (Optional[CallbackManager]) – Callback manager to use.

  • verbose (bool) – Whether to print intermediate results.