Skip to content

Commit

Permalink
get protection
Browse files Browse the repository at this point in the history
  • Loading branch information
mrT23 committed Sep 21, 2024
1 parent a70fe27 commit 1e51acf
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pr_agent/tools/pr_help_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ async def run(self):
if self.question_str:
get_logger().info(f'Answering a PR question about the PR {self.git_provider.pr_url} ')

if not get_settings().openai.key:
if not get_settings().get('openai.key'):
if get_settings().config.publish_output:
self.git_provider.publish_comment(
"The `Help` tool chat requires an OpenAI API key, which is not configured.")
"The `Help` tool chat feature requires an OpenAI API key for calculating embeddings")
else:
get_logger().error("The `Help` tool chat requires an OpenAI API key, which is not configured.")
get_logger().error("The `Help` tool chat feature requires an OpenAI API key for calculating embeddings")
return

# Initialize embeddings
Expand All @@ -158,7 +158,7 @@ async def run(self):
# Get similar snippets via similarity search
if get_settings().pr_help.force_local_db:
sim_results = self.get_sim_results_from_local_db(embeddings)
elif get_settings().pinecone.api_key:
elif get_settings().get('pinecone.api_key'):
sim_results = self.get_sim_results_from_pinecone_db(embeddings)
else:
sim_results = self.get_sim_results_from_s3_db(embeddings)
Expand Down

0 comments on commit 1e51acf

Please sign in to comment.