From 73fc1238dab5632407d524f7f1742b03920300b0 Mon Sep 17 00:00:00 2001 From: yym68686 Date: Wed, 15 Nov 2023 00:58:33 +0800 Subject: [PATCH] Adjust the default model to gpt-4-1106-preview, update the search prompt, and fix the formatting issue with the output markdown code block --- chatgpt2api/chatgpt2api.py | 7 ++++++- config.py | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/chatgpt2api/chatgpt2api.py b/chatgpt2api/chatgpt2api.py index 6556d305..48fd0bec 100644 --- a/chatgpt2api/chatgpt2api.py +++ b/chatgpt2api/chatgpt2api.py @@ -547,6 +547,11 @@ def search_summary( ans_ddg = search_thread.join() urls_set += ans_ddg engans_ddg = en_ddg_search_thread.join() + # try: + # engans_ddg = en_ddg_search_thread.join() + # except: + # print("error!!!!!!!!!!!!!") + # engans_ddg = "" urls_set += engans_ddg url_set_list = sorted(set(urls_set), key=lambda x: urls_set.index(x)) url_pdf_set_list = [item for item in url_set_list if item.endswith(".pdf")] @@ -611,7 +616,7 @@ def search_summary( input_variables=["web_summary", "question"], template=( # "You are a text analysis expert who can use a search engine. You need to response the following question: {question}. Search results: {web_summary}. Your task is to thoroughly digest all search results provided above and provide a detailed and in-depth response in Simplified Chinese to the question based on the search results. The response should meet the following requirements: 1. Be rigorous, clear, professional, scholarly, logical, and well-written. 2. If the search results do not mention relevant content, simply inform me that there is none. Do not fabricate, speculate, assume, or provide inaccurate response. 3. Use markdown syntax to format the response. Enclose any single or multi-line code examples or code usage examples in a pair of ``` symbols to achieve code formatting. 4. Detailed, precise and comprehensive response in Simplified Chinese and extensive use of the search results is required." - "You need to response the following question: {question}. Search results: {web_summary}. Your task is to think about the question step by step and then answer the above question in simplified Chinese based on the Search results provided. Please response in simplified Chinese and adopt a style that is logical, in-depth, and detailed. Note: In order to make the answer appear highly professional, you should be an expert in textual analysis, aiming to make the answer precise and comprehensive. Response in accordance with markdown format." + "You need to response the following question: {question}. Search results: {web_summary}. Your task is to think about the question step by step and then answer the above question in simplified Chinese based on the Search results provided. Please response in simplified Chinese and adopt a style that is logical, in-depth, and detailed. Note: In order to make the answer appear highly professional, you should be an expert in textual analysis, aiming to make the answer precise and comprehensive. Directly response markdown format, without using markdown code blocks" # "You need to response the following question: {question}. Search results: {web_summary}. Your task is to thoroughly digest the search results provided above, dig deep into search results for thorough exploration and analysis and provide a response to the question based on the search results. The response should meet the following requirements: 1. You are a text analysis expert, extensive use of the search results is required and carefully consider all the Search results to make the response be in-depth, rigorous, clear, organized, professional, detailed, scholarly, logical, precise, accurate, comprehensive, well-written and speak in Simplified Chinese. 2. If the search results do not mention relevant content, simply inform me that there is none. Do not fabricate, speculate, assume, or provide inaccurate response. 3. Use markdown syntax to format the response. Enclose any single or multi-line code examples or code usage examples in a pair of ``` symbols to achieve code formatting." ), ) diff --git a/config.py b/config.py index 8c517ec3..f3b36923 100644 --- a/config.py +++ b/config.py @@ -9,8 +9,8 @@ if os.environ.get('GOOGLE_API_KEY', None) == None and os.environ.get('GOOGLE_CSE_ID', None) == None: USE_GOOGLE = False temperature = float(os.environ.get('temperature', '0.5')) -GPT_ENGINE = os.environ.get('GPT_ENGINE', 'gpt-3.5-turbo-16k') -# DEFAULT_SEARCH_MODEL = os.environ.get('DEFAULT_SEARCH_MODEL', 'gpt-3.5-turbo-1106') +GPT_ENGINE = os.environ.get('GPT_ENGINE', 'gpt-4-1106-preview') +# DEFAULT_SEARCH_MODEL = os.environ.get('DEFAULT_SEARCH_MODEL', 'gpt-3.5-turbo-1106') gpt-3.5-turbo-16k SEARCH_USE_GPT = (os.environ.get('SEARCH_USE_GPT', "True") == "False") == False API_URL = os.environ.get('API_URL', 'https://api.openai.com/v1/chat/completions') PDF_EMBEDDING = (os.environ.get('PDF_EMBEDDING', "True") == "False") == False