peterpeter8585 commited on
Commit
a6db119
·
verified ·
1 Parent(s): 7b89462

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +36 -40
app.py CHANGED
@@ -22,50 +22,46 @@ with open(path_hf,"r") as f:
22
  with open(path_hf,"w") as f:
23
  f.write(s.replace(" model = model_cls.from_pretrained(model_id, **_model_kwargs)"," model = torch.compile(model_cls.from_pretrained(model_id, **_model_kwargs),mode='max-autotune')"))
24
  from langchain_core.prompts.chat import ChatPromptTemplate, MessagesPlaceholder
25
- system = '''Respond to the human as helpfully and accurately as possible. You have access to the following tools:
26
-
27
- {tools}
28
-
29
- Use a json blob to specify a tool by providing an action key (tool name) and an action_input key (tool input).
30
-
31
- Valid "action" values: "Final Answer" or {tool_names}
32
-
33
- Provide only ONE action per $JSON_BLOB, as shown:
34
-
35
- ```
36
- {{
37
- "action": $TOOL_NAME,
38
- "action_input": $INPUT
39
- }}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  ```
 
 
 
 
41
 
42
- Follow this format:
43
-
44
- Question: input question to answer
45
- Thought: consider previous and subsequent steps
46
- Action:
47
- ```
48
- $JSON_BLOB
49
- ```
50
- Observation: action result
51
- ... (repeat Thought/Action/Observation N times)
52
- Thought: I know what to respond
53
- Action:
54
- ```
55
- {{
56
- "action": "Final Answer",
57
- "action_input": "Final response to human"
58
- }}
59
-
60
- Begin! Reminder to ALWAYS respond with a valid json blob of a single action. Use tools if necessary. Respond directly if appropriate. Format is Action:```$JSON_BLOB```then Observation'''
61
-
62
- human = '''
63
-
64
- {input}
65
 
66
- {agent_scratchpad}
67
 
68
- (reminder to respond in a JSON blob no matter what)'''
69
 
70
  prompt = ChatPromptTemplate.from_messages(
71
  [
 
22
  with open(path_hf,"w") as f:
23
  f.write(s.replace(" model = model_cls.from_pretrained(model_id, **_model_kwargs)"," model = torch.compile(model_cls.from_pretrained(model_id, **_model_kwargs),mode='max-autotune')"))
24
  from langchain_core.prompts.chat import ChatPromptTemplate, MessagesPlaceholder
25
+ #system = '''Respond to the human as helpfully and accurately as possible. You have access to the following tools:
26
+
27
+ #{tools}
28
+
29
+ #Use a json blob to specify a tool by providing an action key (tool name) and an action_input key (tool input).
30
+
31
+ #Valid "action" values: "Final Answer" or {tool_names}
32
+
33
+ #Provide only ONE action per $JSON_BLOB, as shown:
34
+
35
+ #```
36
+ #{{
37
+ #"action": $TOOL_NAME,
38
+ # "action_input": $INPUT
39
+ #}}
40
+ #```
41
+ #'''
42
+ #Follow this format:
43
+
44
+ #Question: input question to answer
45
+ #Thought: consider previous and subsequent steps
46
+ #Action:
47
+ #```
48
+ #$JSON_BLOB
49
+ #```
50
+ #Observation: action result
51
+ #... (repeat Thought/Action/Observation N times)
52
+ #Thought: I know what to respond
53
+ #Action:
54
  ```
55
+ #{
56
+ #"action": "Final Answer",
57
+ #"action_input": "Final response to human"
58
+ #}}
59
 
60
+ #Begin! Reminder to ALWAYS respond with a valid json blob of a single action. Use tools if necessary. Respond directly if appropriate. Format is Action:```$JSON_BLOB```then Observation'''
61
+ #'''
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
 
 
63
 
64
+ #(reminder to respond in a JSON blob no matter what)'''
65
 
66
  prompt = ChatPromptTemplate.from_messages(
67
  [