cheesyFishes commited on
Commit
2c1cd4b
β€’
1 Parent(s): 0c1de5b

add verbose

Browse files
Files changed (1) hide show
  1. prompt_assistant.py +6 -1
prompt_assistant.py CHANGED
@@ -48,7 +48,7 @@ class Text2ImagePromptAssistant(Tool):
48
  outputs = ['image']
49
  description = PROMPT_ASSISTANT_DESCRIPTION
50
 
51
- def __init__(self, *args, openai_api_key='', model_name='text-davinci-003', temperature=0.3, **hub_kwargs):
52
  super().__init__()
53
  os.environ['OPENAI_API_KEY'] = openai_api_key
54
  if model_name == 'text-davinci-003':
@@ -64,6 +64,7 @@ class Text2ImagePromptAssistant(Tool):
64
  set_global_service_context(service_context)
65
 
66
  self.storage_path = os.path.dirname(__file__)
 
67
  self.hub_kwargs = hub_kwargs
68
 
69
  def setup(self):
@@ -84,6 +85,10 @@ class Text2ImagePromptAssistant(Tool):
84
  self.setup()
85
 
86
  better_prompt = str(self.query_engine.query(prompt)).strip()
 
 
 
 
87
 
88
  return self.text2image(better_prompt)
89
 
 
48
  outputs = ['image']
49
  description = PROMPT_ASSISTANT_DESCRIPTION
50
 
51
+ def __init__(self, *args, openai_api_key='', model_name='text-davinci-003', temperature=0.3, verbose=False, **hub_kwargs):
52
  super().__init__()
53
  os.environ['OPENAI_API_KEY'] = openai_api_key
54
  if model_name == 'text-davinci-003':
 
64
  set_global_service_context(service_context)
65
 
66
  self.storage_path = os.path.dirname(__file__)
67
+ self.verbose = verbose
68
  self.hub_kwargs = hub_kwargs
69
 
70
  def setup(self):
 
85
  self.setup()
86
 
87
  better_prompt = str(self.query_engine.query(prompt)).strip()
88
+
89
+ if self.verbose:
90
+ print('==New prompt generated by LlamaIndex==', flush=True)
91
+ print(better_prompt, '\n', flush=True)
92
 
93
  return self.text2image(better_prompt)
94