Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -2074,12 +2074,12 @@ def load_fields(backup_json: str):
|
|
| 2074 |
logging.error(f"load_fields error: {e}")
|
| 2075 |
return ("", "", "", "", "", "", [], 10, 4, 2, "", "", "", "", "", "")
|
| 2076 |
|
| 2077 |
-
def refine_query(query: str, openai_api_key: str) -> str:
|
| 2078 |
os.environ["OPENAI_API_KEY"] = openai_api_key
|
| 2079 |
if not query:
|
| 2080 |
logging.info("refine_query: Empty query provided.")
|
| 2081 |
return ""
|
| 2082 |
-
prompt = f"Reformulate the following research query in
|
| 2083 |
refined = openai_call(prompt, model="gpt-4o-mini", max_tokens_param=500)
|
| 2084 |
logging.info(f"refine_query: Refined query: {refined}")
|
| 2085 |
return refined
|
|
@@ -2892,7 +2892,7 @@ def main():
|
|
| 2892 |
# Button actions
|
| 2893 |
refine_query_button.click(
|
| 2894 |
fn=refine_query,
|
| 2895 |
-
inputs=[research_query, openai_api_key_input],
|
| 2896 |
outputs=[research_query]
|
| 2897 |
)
|
| 2898 |
gen_followups.click(
|
|
|
|
| 2074 |
logging.error(f"load_fields error: {e}")
|
| 2075 |
return ("", "", "", "", "", "", [], 10, 4, 2, "", "", "", "", "", "")
|
| 2076 |
|
| 2077 |
+
def refine_query(query: str, openai_api_key: str, style: str) -> str:
|
| 2078 |
os.environ["OPENAI_API_KEY"] = openai_api_key
|
| 2079 |
if not query:
|
| 2080 |
logging.info("refine_query: Empty query provided.")
|
| 2081 |
return ""
|
| 2082 |
+
prompt = f"Reformulate the following research query in more detailed format suitable for deep research: '{query}' \n Use this following style: {style}"
|
| 2083 |
refined = openai_call(prompt, model="gpt-4o-mini", max_tokens_param=500)
|
| 2084 |
logging.info(f"refine_query: Refined query: {refined}")
|
| 2085 |
return refined
|
|
|
|
| 2892 |
# Button actions
|
| 2893 |
refine_query_button.click(
|
| 2894 |
fn=refine_query,
|
| 2895 |
+
inputs=[research_query, openai_api_key_input, reportsyle],
|
| 2896 |
outputs=[research_query]
|
| 2897 |
)
|
| 2898 |
gen_followups.click(
|