hadadrjt commited on
Commit
29dc222
·
1 Parent(s): cbb5ba6

SearchGPT: Allow LLM to access local time.

Browse files

* Use Asia/Jakarta as the default timezone.

* Add more examples for users to try.

app.py CHANGED
@@ -19,13 +19,15 @@ with gr.Blocks(fill_height=True, fill_width=True) as app:
19
  ),
20
  type="messages", # 2025-09-10: Shut up!
21
  examples=[
22
- ["What is UltimaX Intelligence"],
23
  ["https://wikipedia.org/wiki/Artificial_intelligence Read and summarize that"],
24
  ["What's the latest AI development in 2025?"],
25
  ["OpenAI GPT-5 vs DeepSeek V3.1"],
26
  ["Find the source link for the GPT-OSS model"],
27
  ["https://huggingface.co/papers Extract the most popular papers"],
28
- ["How to run Gemma 3 (270M) on CPU only"]
 
 
29
  ],
30
  cache_examples=False,
31
  show_api=False,
 
19
  ),
20
  type="messages", # 2025-09-10: Shut up!
21
  examples=[
22
+ ["What is UltimaX Intelligence?"],
23
  ["https://wikipedia.org/wiki/Artificial_intelligence Read and summarize that"],
24
  ["What's the latest AI development in 2025?"],
25
  ["OpenAI GPT-5 vs DeepSeek V3.1"],
26
  ["Find the source link for the GPT-OSS model"],
27
  ["https://huggingface.co/papers Extract the most popular papers"],
28
+ ["How to run Gemma 3 (270M) on CPU only?"],
29
+ ["What are the latest trends this year?"],
30
+ ["What caused World War 1 and 2?"]
31
  ],
32
  cache_examples=False,
33
  show_api=False,
src/processor/message_processor.py CHANGED
@@ -4,7 +4,7 @@
4
  #
5
 
6
  import traceback
7
- from config import MODEL, INSTRUCTIONS_START
8
  from src.core.web_configuration import WebConfiguration
9
  from src.engine.browser_engine import BrowserEngine
10
  from src.tools.tool_manager import construct_tool_definitions
@@ -32,7 +32,6 @@ def process_user_request(user_message, chat_history):
32
  available_tools = construct_tool_definitions()
33
 
34
  conversation_messages = setup_response(
35
- INSTRUCTIONS_START,
36
  chat_history,
37
  user_message
38
  )
 
4
  #
5
 
6
  import traceback
7
+ from config import MODEL
8
  from src.core.web_configuration import WebConfiguration
9
  from src.engine.browser_engine import BrowserEngine
10
  from src.tools.tool_manager import construct_tool_definitions
 
32
  available_tools = construct_tool_definitions()
33
 
34
  conversation_messages = setup_response(
 
35
  chat_history,
36
  user_message
37
  )
src/processor/response/setup.py CHANGED
@@ -3,11 +3,23 @@
3
  # SPDX-License-Identifier: Apache-2.0
4
  #
5
 
6
- def setup_response(system_instruction, conversation_history, user_input):
 
 
 
7
  history = []
8
-
9
- if system_instruction:
10
- history.append({"role": "system", "content": system_instruction})
 
 
 
 
 
 
 
 
 
11
 
12
  if isinstance(conversation_history, list):
13
  for history_item in conversation_history:
 
3
  # SPDX-License-Identifier: Apache-2.0
4
  #
5
 
6
+ from ...utils.time import get_current_time
7
+ from config import INSTRUCTIONS_START
8
+
9
+ def setup_response(conversation_history, user_input):
10
  history = []
11
+
12
+ history.insert(
13
+ 0,
14
+ {
15
+ "role": "system",
16
+ "content": (
17
+ f"Today is: {get_current_time()}"
18
+ + "\n\n\n"
19
+ + INSTRUCTIONS_START
20
+ )
21
+ }
22
+ )
23
 
24
  if isinstance(conversation_history, list):
25
  for history_item in conversation_history:
src/utils/__init__.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # SPDX-FileCopyrightText: Hadad <hadad@linuxmail.org>
3
+ # SPDX-License-Identifier: Apache-2.0
4
+ #
5
+
6
+ from .time import get_current_time
7
+
8
+ __all__ = ['get_current_time']
src/utils/time.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #
2
+ # SPDX-FileCopyrightText: Hadad <hadad@linuxmail.org>
3
+ # SPDX-License-Identifier: Apache-2.0
4
+ #
5
+
6
+ from datetime import datetime
7
+ from zoneinfo import ZoneInfo
8
+
9
+ def get_current_time() -> str:
10
+ return datetime.now(ZoneInfo(
11
+ "Asia/Jakarta"
12
+ )).strftime(
13
+ "%H:%M %Z. %A, %d %B %Y."
14
+ )