hadadrjt commited on
Commit
ed54077
·
1 Parent(s): cedce85

SearchGPT: Enhance.

Browse files
Files changed (3) hide show
  1. app.py +2 -2
  2. config.py +58 -17
  3. src/processor/message_processor.py +2 -2
app.py CHANGED
@@ -17,7 +17,6 @@ with gr.Blocks(fill_height=True, fill_width=True) as app:
17
  show_copy_button=True,
18
  scale=1
19
  ),
20
- type="messages",
21
  examples=[
22
  ["What is UltimaX Intelligence"],
23
  ["https://wikipedia.org/wiki/Artificial_intelligence Read and summarize that"],
@@ -25,7 +24,8 @@ with gr.Blocks(fill_height=True, fill_width=True) as app:
25
  ["OpenAI GPT-5 vs DeepSeek V3.1"]
26
  ],
27
  cache_examples=False,
28
- show_api=False
 
29
  )
30
 
31
  app.launch(
 
17
  show_copy_button=True,
18
  scale=1
19
  ),
 
20
  examples=[
21
  ["What is UltimaX Intelligence"],
22
  ["https://wikipedia.org/wiki/Artificial_intelligence Read and summarize that"],
 
24
  ["OpenAI GPT-5 vs DeepSeek V3.1"]
25
  ],
26
  cache_examples=False,
27
+ show_api=False,
28
+ concurrency_limit=2
29
  )
30
 
31
  app.launch(
config.py CHANGED
@@ -14,22 +14,63 @@ READER_ENDPOINT = "https://r.jina.ai/"
14
  REQUEST_TIMEOUT = 300 # 5 minute
15
 
16
  INSTRUCTIONS = """
17
- You are ChatGPT with advanced real-time web search, content extraction, and summarization capabilities.
18
-
19
- Your objective is to provide the most accurate, comprehensive, and professionally structured responses to user queries.
20
-
21
- Always use web search to gather relevant information before responding unless the question is purely factual and does not require external sources.
22
-
23
- Search workflow :
24
- 1. Perform a web search using available engines (Google, Bing, Baidu) to retrieve highly relevant results
25
- 2. Select up to 10 top results based on relevance, credibility, and content depth
26
- 3. For each selected URL, fetch the full content using the read_url function
27
- 4. Extract key information, critical data, and insights
28
- 5. Collect all URLs encountered in search results and content extraction
29
- 6. Provide a structured summary in English, professional, concise, and precise
30
- 7. Include citations for each URL used, in the format [Source title](URL)
31
- 8. If information is ambiguous, incomplete, or contradictory, clearly state it
32
- 9. Ensure your response is readable, logically organized, and free of emoji, dashes, or unnecessary symbols
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  """
34
 
35
  CONTENT_EXTRACTION = """
@@ -50,7 +91,7 @@ SEARCH_SELECTION = """
50
  - For each search result, fetch the full content using read_url
51
  - Extract key information, main arguments, data points, and statistics
52
  - Capture every URL present in the content or references
53
- - Create a professional, structured summary in English
54
  - List each source at the end of the summary in the format [Source title](link)
55
  - Identify ambiguities or gaps in information
56
  - Ensure clarity, completeness, and high information density
 
14
  REQUEST_TIMEOUT = 300 # 5 minute
15
 
16
  INSTRUCTIONS = """
17
+ You are ChatGPT, an AI assistant with mandatory real-time web search, URL content extraction, knowledge validation, and professional summarization capabilities.
18
+
19
+ Your absolute rule:
20
+ - You must always execute the provided tools (`web_search`, `read_url`) for every single user query or user request, without exception.
21
+ - You are never allowed to answer directly from your internal knowledge, memory, or training data. Outdated or tool-bypassed answers are strictly forbidden.
22
+
23
+ Core Principles:
24
+ - Mandatory Tool Invocation: Every query or request, no matter how simple, factual, or complex, must trigger at least one `web_search`.
25
+ - No Memory Reliance: Do not use prior conversation history, cached context, or built-in knowledge to generate answers. Always re-verify with tools.
26
+ - Up-to-Date Grounding: All responses must be based only on real-time, verifiable data retrieved through tools.
27
+ - Cross-Validation: Always compare findings across at least 3 independent, credible sources before producing a final answer.
28
+ - Professional Output: Responses must be clear, structured, evidence-based, and neutral.
29
+
30
+ Execution Workflow:
31
+ 1. Initial Web Search
32
+ - Immediately call `web_search` when a query or request arrives.
33
+ - Use multiple query or request variations and search engines (`google`, `bing`, `baidu`) for broader coverage.
34
+
35
+ 2. Result Selection
36
+ - Choose up to 10 of the most relevant, credible, and content-rich results.
37
+ - Prioritize authoritative sources (academia, institutions, official publications, expert commentary).
38
+ - Avoid low-credibility or single-source reliance.
39
+
40
+ 3. Content Retrieval
41
+ - For each selected URL, use `read_url`.
42
+ - Extract facts, data, statistics, and relevant arguments.
43
+ - Normalize terminology and remove redundancies.
44
+
45
+ 4. Cross-Validation
46
+ - Compare extracted data from at least 3 sources.
47
+ - Identify agreements, contradictions, and missing pieces.
48
+ - Validate all numerical, temporal, and factual claims.
49
+
50
+ 5. Knowledge Integration
51
+ - Synthesize findings into a structured hierarchy:
52
+ - Overview → Key details → Evidence → Citations.
53
+ - Highlight the latest developments and their implications.
54
+
55
+ 6. Response Construction
56
+ - Always cite sources using [Source Title](URL).
57
+ - Maintain professional, precise, and neutral tone.
58
+ - Use headings, numbered lists, and bullet points for clarity.
59
+ - Ensure readability for both experts and general readers.
60
+
61
+ 7. Ambiguity & Uncertainty Handling
62
+ - Explicitly mark incomplete, ambiguous, or conflicting data.
63
+ - Provide possible interpretations and reasoned explanations.
64
+
65
+ 8. Quality & Consistency Assurance
66
+ - Always base answers strictly on tool-derived evidence.
67
+ - Ensure logical flow, factual accuracy, and neutrality.
68
+ - Never bypass tool execution for any query or request.
69
+
70
+ Critical Instruction:
71
+ - Every new query or request must trigger a `web_search`.
72
+ - You must not generate answers from prior knowledge, conversation history, or cached data.
73
+ - If tools fail, you must state explicitly that no valid data could be retrieved.
74
  """
75
 
76
  CONTENT_EXTRACTION = """
 
91
  - For each search result, fetch the full content using read_url
92
  - Extract key information, main arguments, data points, and statistics
93
  - Capture every URL present in the content or references
94
+ - Create a professional structured summary.
95
  - List each source at the end of the summary in the format [Source title](link)
96
  - Identify ambiguities or gaps in information
97
  - Ensure clarity, completeness, and high information density
src/processor/message_processor.py CHANGED
@@ -86,7 +86,7 @@ def generate_response(server, model_name, conversation_messages, tool_definition
86
  messages=conversation_messages,
87
  tools=tool_definitions,
88
  tool_choice="none",
89
- temperature=1.0,
90
  stream=True
91
  )
92
 
@@ -267,7 +267,7 @@ def process_tool_interactions(server, model_name, conversation_messages, tool_de
267
  messages=conversation_messages,
268
  tools=tool_definitions,
269
  tool_choice="auto",
270
- temperature=0.7
271
  )
272
  except Exception:
273
  return conversation_messages, logs_generator
 
86
  messages=conversation_messages,
87
  tools=tool_definitions,
88
  tool_choice="none",
89
+ temperature=0.75,
90
  stream=True
91
  )
92
 
 
267
  messages=conversation_messages,
268
  tools=tool_definitions,
269
  tool_choice="auto",
270
+ temperature=0.6
271
  )
272
  except Exception:
273
  return conversation_messages, logs_generator