Spaces:
Sleeping
Sleeping
microstronger
commited on
Commit
•
79213c0
1
Parent(s):
999c1bb
Delete terminal.py
Browse files- terminal.py +0 -50
terminal.py
DELETED
@@ -1,50 +0,0 @@
|
|
1 |
-
from datetime import datetime
|
2 |
-
|
3 |
-
from lagent.actions import ActionExecutor, BingBrowser
|
4 |
-
from lagent.llms import INTERNLM2_META, LMDeployServer
|
5 |
-
|
6 |
-
from mindsearch.agent.mindsearch_agent import (MindSearchAgent,
|
7 |
-
MindSearchProtocol)
|
8 |
-
from mindsearch.agent.mindsearch_prompt import (
|
9 |
-
FINAL_RESPONSE_CN, FINAL_RESPONSE_EN, GRAPH_PROMPT_CN, GRAPH_PROMPT_EN,
|
10 |
-
searcher_context_template_cn, searcher_context_template_en,
|
11 |
-
searcher_input_template_cn, searcher_input_template_en,
|
12 |
-
searcher_system_prompt_cn, searcher_system_prompt_en)
|
13 |
-
|
14 |
-
lang = 'cn'
|
15 |
-
llm = LMDeployServer(path='internlm/internlm2_5-7b-chat',
|
16 |
-
model_name='internlm2',
|
17 |
-
meta_template=INTERNLM2_META,
|
18 |
-
top_p=0.8,
|
19 |
-
top_k=1,
|
20 |
-
temperature=0,
|
21 |
-
max_new_tokens=8192,
|
22 |
-
repetition_penalty=1.02,
|
23 |
-
stop_words=['<|im_end|>'])
|
24 |
-
|
25 |
-
agent = MindSearchAgent(
|
26 |
-
llm=llm,
|
27 |
-
protocol=MindSearchProtocol(
|
28 |
-
meta_prompt=datetime.now().strftime('The current date is %Y-%m-%d.'),
|
29 |
-
interpreter_prompt=GRAPH_PROMPT_CN
|
30 |
-
if lang == 'cn' else GRAPH_PROMPT_EN,
|
31 |
-
response_prompt=FINAL_RESPONSE_CN
|
32 |
-
if lang == 'cn' else FINAL_RESPONSE_EN),
|
33 |
-
searcher_cfg=dict(
|
34 |
-
llm=llm,
|
35 |
-
plugin_executor=ActionExecutor(
|
36 |
-
BingBrowser(searcher_type='DuckDuckGoSearch', topk=6)),
|
37 |
-
protocol=MindSearchProtocol(
|
38 |
-
meta_prompt=datetime.now().strftime(
|
39 |
-
'The current date is %Y-%m-%d.'),
|
40 |
-
plugin_prompt=searcher_system_prompt_cn
|
41 |
-
if lang == 'cn' else searcher_system_prompt_en,
|
42 |
-
),
|
43 |
-
template=dict(input=searcher_input_template_cn
|
44 |
-
if lang == 'cn' else searcher_input_template_en,
|
45 |
-
context=searcher_context_template_cn
|
46 |
-
if lang == 'cn' else searcher_context_template_en)),
|
47 |
-
max_turn=10)
|
48 |
-
|
49 |
-
for agent_return in agent.stream_chat('上海今天适合穿什么衣服'):
|
50 |
-
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|