textgen-silence-output-feature in terminal (#10402)

Hello,
Added the new feature to silence TextGen's output in the terminal.

- Description: Added a new feature to control printing of TextGen's
output to the terminal.,
- Issue: the issue #TextGen parameter to silence the print in terminal
#10337 it fixes (if applicable)
  
  Thanks;

---------

Co-authored-by: Abonia SOJASINGARAYAR <abonia.sojasingarayar@loreal.com>
Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
This commit is contained in:
Abonia Sojasingarayar 2023-09-11 23:20:36 +02:00 committed by GitHub
parent 2bd9f5da7f
commit 31739577c2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -208,7 +208,6 @@ class TextGen(LLM):
prompt=prompt, stop=stop, run_manager=run_manager, **kwargs prompt=prompt, stop=stop, run_manager=run_manager, **kwargs
): ):
combined_text_output += chunk.text combined_text_output += chunk.text
print(prompt + combined_text_output)
result = combined_text_output result = combined_text_output
else: else:
@ -220,7 +219,6 @@ class TextGen(LLM):
if response.status_code == 200: if response.status_code == 200:
result = response.json()["results"][0]["text"] result = response.json()["results"][0]["text"]
print(prompt + result)
else: else:
print(f"ERROR: response: {response}") print(f"ERROR: response: {response}")
result = "" result = ""
@ -256,7 +254,6 @@ class TextGen(LLM):
prompt=prompt, stop=stop, run_manager=run_manager, **kwargs prompt=prompt, stop=stop, run_manager=run_manager, **kwargs
): ):
combined_text_output += chunk.text combined_text_output += chunk.text
print(prompt + combined_text_output)
result = combined_text_output result = combined_text_output
else: else:
@ -268,7 +265,6 @@ class TextGen(LLM):
if response.status_code == 200: if response.status_code == 200:
result = response.json()["results"][0]["text"] result = response.json()["results"][0]["text"]
print(prompt + result)
else: else:
print(f"ERROR: response: {response}") print(f"ERROR: response: {response}")
result = "" result = ""