Skip to content

Commit

Permalink
Merge pull request TransformerOptimus#1151 from TransformerOptimus/da…
Browse files Browse the repository at this point in the history
…lle_api_fix_main

added tool config for dalle
  • Loading branch information
Tarraann authored Aug 30, 2023
2 parents cc2e508 + ba71598 commit fecd315
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 1 addition & 4 deletions superagi/tools/image_generation/dalle_image_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,7 @@ def _execute(self, prompt: str, image_names: list, size: int = 512, num: int = 2

api_key = self.get_tool_config("OPENAI_API_KEY")
if api_key is None:
model_source = Configuration.fetch_configuration(session, organisation_id, "model_source")
if model_source != "OpenAi":
return "Enter your OpenAi api key in the configuration"
api_key = Configuration.fetch_configuration(session, organisation_id, "model_api_key")
return "Enter your OpenAi api key in the configuration"

response = OpenAiDalle(api_key=api_key, number_of_results=num).generate_image(
prompt, size)
Expand Down
5 changes: 3 additions & 2 deletions superagi/tools/image_generation/image_generation_toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def get_tools(self) -> List[BaseTool]:

def get_env_keys(self) -> List[ToolConfiguration]:
return [
ToolConfiguration(key="STABILITY_API_KEY", key_type=ToolConfigKeyType.STRING, is_required= True, is_secret = True),
ToolConfiguration(key="ENGINE_ID", key_type=ToolConfigKeyType.STRING, is_required=False, is_secret=False)
ToolConfiguration(key="STABILITY_API_KEY", key_type=ToolConfigKeyType.STRING, is_required= False, is_secret = True),
ToolConfiguration(key="ENGINE_ID", key_type=ToolConfigKeyType.STRING, is_required=False, is_secret=False),
ToolConfiguration(key= "OPENAI_API_KEY", key_type=ToolConfigKeyType.STRING, is_required=False, is_secret=True),
]

0 comments on commit fecd315

Please sign in to comment.