diff --git a/.DS_Store b/.DS_Store index 423a5d1..a5014ab 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/.gitignore b/.gitignore index 43322df..d4c0277 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ .DS_Store .DS_Store +.DS_Store diff --git a/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/brain.py b/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/brain.py index 153d3af..09baf9f 100644 --- a/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/brain.py +++ b/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/brain.py @@ -1,7 +1,7 @@ import time, gc from config import * from agent.question.question_utils import preprocessing_question, process_question, process_dict, add_question_mark, question_rew -from agent.prompt import create_chat_completion, create_chat_completion_change_zhushi +from agent.llm_client import create_chat_completion, create_chat_completion_change_zhushi from agent.schema.schema_utils import get_table_schema, find_table_with_emb, get_table_schema_with_emb, deep_find_tables from agent.sql.exec import exec_sql_s from agent.sql.process_sql import to_select, extract_table_names, all_tables_in_prompt @@ -107,16 +107,6 @@ def run_conversation_xietong(question, org_question): all_tables_name_list += deep_tables_name_list all_tables_name_list = list(set(all_tables_name_list)) - # org_table_maps_LL, org_question_similarity_score_list = get_table_schema_with_emb(all_tables_name_list, org_question) - # # print(f"--------------org_table_maps_LL:{org_table_maps_LL}") - # if max(org_question_similarity_score_list) < START_DEEP_THRESHOLD: # 没有大于0.5的说明这个表可能不对,新增表 - # print(f"-----------Start org Deeping table search") - # org_deep_table_maps_LL = deep_find_tables(all_tables_name_list, org_question) - # print(f"--------------len(org_deep_table_maps_LL):{len(org_deep_table_maps_LL)}") - # org_deep_tables_name_list = [i.get('数据表名') for i in org_deep_table_maps_LL] - # all_tables_name_list += org_deep_tables_name_list - # all_tables_name_list = list(set(all_tables_name_list)) - if max(highest_similarity_score_list) < START_DEEP_THRESHOLD: table_maps_LL, highest_similarity_score_list = get_table_schema_with_emb(all_tables_name_list, question) if DEBUG_VER == 3: diff --git a/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/prompt.py b/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/llm_client.py similarity index 98% rename from LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/prompt.py rename to LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/llm_client.py index 5a0740a..d28de94 100644 --- a/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/prompt.py +++ b/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/llm_client.py @@ -1,8 +1,6 @@ from config import * from zhipuai import ZhipuAI -client = ZhipuAI(api_key=api_key) - def create_chat_completion(messages, model=MODEL): """ Create a chat completion using the provided messages and model. diff --git a/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/optimization.py b/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/optimization.py index 6e6c9ea..c6d0175 100644 --- a/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/optimization.py +++ b/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/optimization.py @@ -1,5 +1,5 @@ # agent/optimization.py -from agent.prompt import create_chat_completion +from agent.llm_client import create_chat_completion def optimize_answer(question_txt, answer_txt, org_answer): """ diff --git a/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/question/question_utils.py b/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/question/question_utils.py index 62be879..f03c490 100644 --- a/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/question/question_utils.py +++ b/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/question/question_utils.py @@ -1,7 +1,7 @@ # agent/question/question_utils.py import json from config import * -from agent.prompt import create_chat_completion +from agent.llm_client import create_chat_completion from agent.sql.exec import exec_sql_s from agent.utils import find_json, dict_to_sentence diff --git a/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/utils/async_util.py b/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/utils/async_util.py index 4825cd7..fb7551b 100644 --- a/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/utils/async_util.py +++ b/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/utils/async_util.py @@ -1,6 +1,6 @@ # agent/sql/exec.py from config import * -from agent.prompt import create_chat_completion +from agent.llm_client import create_chat_completion def async_llm_chain_call(messages, model=MODEL, tree_node=ASYNC_LLM_TIME): """ diff --git a/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/utils/json_utils.py b/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/utils/json_utils.py index f7cff26..a5ab069 100644 --- a/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/utils/json_utils.py +++ b/LLM大模型竞赛实战_优胜解决方案/2024金融行业·大模型挑战赛/code/agent/utils/json_utils.py @@ -1,6 +1,6 @@ # utils/json_utils.py from config import * -from agent.prompt import create_chat_completion +from agent.llm_client import create_chat_completion import re import json