diff --git a/headless/python/services/s2sql/auto_cot_run.py b/headless/python/services/s2sql/auto_cot_run.py index d9ef8ce8a..ac8e8be15 100644 --- a/headless/python/services/s2sql/auto_cot_run.py +++ b/headless/python/services/s2sql/auto_cot_run.py @@ -62,7 +62,7 @@ def transform_sql_example(question:str, current_date:str, table_name:str, field_ - question_augmented = """{question} (补充信息:{prior_linking}。{current_date}。{terms_desc}) (备注: {prior_exts})""".format(question=question, prior_linking=prior_linkings_str, prior_exts=prior_exts, current_date=current_data_str) + question_augmented = """{question} (补充信息:{prior_linking}。{current_date}。{terms_desc}) (备注: {prior_exts})""".format(question=question, prior_linking=prior_linkings_str, prior_exts=prior_exts, current_date=current_data_str, terms_desc=terms_desc) return question_augmented, db_schema, sql diff --git a/headless/python/services/s2sql/sql_agent.py b/headless/python/services/s2sql/sql_agent.py index 9d9d912a5..c20bb35ec 100644 --- a/headless/python/services/s2sql/sql_agent.py +++ b/headless/python/services/s2sql/sql_agent.py @@ -402,7 +402,7 @@ class Text2DSLAgentAutoCoT(Text2DSLAgentBase): fewshot_example_meta_list = self.get_examples_candidates(question, filter_condition, self.num_examples) fewshot_example_list_combo = self.get_fewshot_example_combos(fewshot_example_meta_list, self.num_fewshots) - schema_linking_sql_output_candidates, schema_linking_sql_prompt_list, _ = await self.generate_schema_linking_sql_tasks(question, model_name, fields_list, current_date, prior_schema_links, prior_exts, fewshot_example_list_combo, terms_list=terms_list) + schema_linking_sql_output_candidates, schema_linking_sql_prompt_list, _ = await self.generate_schema_linking_sql_tasks(question, model_name, fields_list, current_date, prior_schema_links, prior_exts, fewshot_example_list_combo, llm_config=llm_config, terms_list=terms_list) logger.debug(f'schema_linking_sql_output_candidates:{schema_linking_sql_output_candidates}') schema_linking_output_candidate_list = [combo_schema_link_parse(schema_linking_sql_output_candidate) for schema_linking_sql_output_candidate in schema_linking_sql_output_candidates] logger.debug(f'schema_linking_sql_output_candidate_list:{schema_linking_output_candidate_list}') diff --git a/headless/python/services_router/query2sql_service.py b/headless/python/services_router/query2sql_service.py index b21437134..037ece4a4 100644 --- a/headless/python/services_router/query2sql_service.py +++ b/headless/python/services_router/query2sql_service.py @@ -46,10 +46,10 @@ async def query2sql(query_body: Mapping[str, Any]): else: filter_condition = query_body['filterCondition'] - if 'sqlGenerationMode' not in query_body: - raise HTTPException(status_code=400, detail="sql_generation_mode is not in query_body") + if 'sqlGenType' not in query_body: + raise HTTPException(status_code=400, detail="sqlGenType is not in query_body") else: - sql_generation_mode = query_body['sqlGenerationMode'] + sqlGenType = query_body['sqlGenType'] if 'llmConfig' in query_body: llm_config = ast.literal_eval(str(query_body['llmConfig'])) @@ -64,8 +64,8 @@ async def query2sql(query_body: Mapping[str, Any]): resp = await text2sql_agent_router.async_query2sql(question=query_text, filter_condition=filter_condition, model_name=dataset_name, fields_list=fields_list, data_date=current_date, prior_schema_links=prior_schema_links, - prior_exts=prior_exts, sql_generation_mode=sql_generation_mode, - llm_config=llm_config) + prior_exts=prior_exts, sql_generation_mode=sqlGenType, + llm_config=llm_config, terms_list=terms_list) return resp