johann22 commited on
Commit
b03b18d
·
1 Parent(s): 31c044f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +24 -2
app.py CHANGED
@@ -8,6 +8,7 @@ from i_search import google
8
  from i_search import i_search as i_s
9
  from agent import (
10
  ACTION_PROMPT,
 
11
  ADD_PROMPT,
12
  COMPRESS_HISTORY_PROMPT,
13
  LOG_PROMPT,
@@ -63,8 +64,6 @@ def run_gpt(
63
  do_sample=True,
64
  seed=seed,
65
  )
66
-
67
-
68
  content = PREFIX.format(
69
  date_time_str=date_time_str,
70
  purpose=purpose,
@@ -168,6 +167,29 @@ def call_set_task(purpose, task, history, directory, action_input):
168
  return "MAIN", None, history, task
169
 
170
  def end_fn(purpose, task, history, directory, action_input):
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
171
  task = "END"
172
  return "COMPLETE", "COMPLETE", history, task
173
 
 
8
  from i_search import i_search as i_s
9
  from agent import (
10
  ACTION_PROMPT,
11
+ CONTENT_WRITER_EDITOR,
12
  ADD_PROMPT,
13
  COMPRESS_HISTORY_PROMPT,
14
  LOG_PROMPT,
 
64
  do_sample=True,
65
  seed=seed,
66
  )
 
 
67
  content = PREFIX.format(
68
  date_time_str=date_time_str,
69
  purpose=purpose,
 
167
  return "MAIN", None, history, task
168
 
169
  def end_fn(purpose, task, history, directory, action_input):
170
+
171
+ seed = random.randint(1,1111111111111111)
172
+ print (seed)
173
+ generate_kwargs = dict(
174
+ temperature=1.0,
175
+ max_new_tokens=8000,
176
+ top_p=0.99,
177
+ repetition_penalty=1.0,
178
+ do_sample=True,
179
+ seed=seed,
180
+ )
181
+ content = CONTENT_WRITER_EDITOR.format(
182
+ document=history,
183
+ purpose=purpose,
184
+ )
185
+
186
+ stream = client.text_generation(content, **generate_kwargs, stream=True, details=True, return_full_text=False)
187
+ resp = ""
188
+ for response in stream:
189
+ resp += response.token.text
190
+
191
+ history += "observation: puspose is now COMPLETE
192
+ history += resp
193
  task = "END"
194
  return "COMPLETE", "COMPLETE", history, task
195