sharsh02 commited on
Commit
b687950
1 Parent(s): 8920392

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -457,9 +457,10 @@ async def generate_function_call(prompt):
457
  template = env.get_template("function_calling.txt")
458
 
459
  content = template.render(question=prompt)
460
- response = client2.text_generation(content, **generate_kwargs, stream=False, details=True, return_full_text=True)
461
- output = response.generated_text
462
- logging.info(output)
 
463
  pattern = r'\{[^{}]*\}'
464
  # Find all matches
465
  match = re.search(pattern, output)
 
457
  template = env.get_template("function_calling.txt")
458
 
459
  content = template.render(question=prompt)
460
+ stream = client2.text_generation(content, **generate_kwargs, stream=True, details=True, return_full_text=True)
461
+ output = ""
462
+ for response in stream:
463
+ output += response.token.text
464
  pattern = r'\{[^{}]*\}'
465
  # Find all matches
466
  match = re.search(pattern, output)