Skip to content

Conversation

@zzstoatzz
Copy link
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings May 29, 2025 17:59
@zzstoatzz zzstoatzz merged commit 5ff7746 into main May 29, 2025
4 checks passed
@zzstoatzz zzstoatzz deleted the slackbot-1 branch May 29, 2025 17:59
@github-actions github-actions bot added enhancement New feature or request feature Pull requests that add features labels May 29, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for loading the OpenAI API key from a Prefect Secret into the environment when starting the Slackbot example.

  • Introduce openai_api_key_secret_name in settings with a default secret block name.
  • In start.py, conditionally load the OpenAI key from Prefect Secrets if the OPENAI_API_KEY env var is missing.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
examples/slackbot/start.py Import os and Secret, load OpenAI key into OPENAI_API_KEY if unset
examples/slackbot/settings.py Add openai_api_key_secret_name field to settings
Comments suppressed due to low confidence (1)

examples/slackbot/start.py:9

  • This new fallback logic for loading the OpenAI API key from a Prefect Secret isn’t covered by any tests; consider adding a unit test to verify both existing and fallback behavior.
if not (openai_api_key := os.getenv("OPENAI_API_KEY")):

import uvicorn
from settings import settings

if not (openai_api_key := os.getenv("OPENAI_API_KEY")):
Copy link

Copilot AI May 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assigned openai_api_key variable isn’t used after this check and may trigger a linter warning; consider simplifying to if not os.getenv("OPENAI_API_KEY"): or using the retrieved value.

Suggested change
if not (openai_api_key := os.getenv("OPENAI_API_KEY")):
if not os.getenv("OPENAI_API_KEY"):

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request example feature Pull requests that add features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants