Skip to content

Conversation

@redreceipt
Copy link
Member

No description provided.

Copilot AI review requested due to automatic review settings July 17, 2025 19:28
@redreceipt redreceipt merged commit 6c96dd0 into main Jul 17, 2025
2 checks passed
@redreceipt redreceipt deleted the openai-import branch July 17, 2025 19:28
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 updates the OpenAI client implementation to use the legacy OpenAI Python library API instead of the newer client-based approach. The changes switch from using the OpenAI class constructor to the older global API key configuration pattern.

  • Changes import from from openai import OpenAI to import openai
  • Replaces client instantiation with global API key assignment
  • Updates API call from client method to module-level method

load_dotenv()

_client = OpenAI(api_key=os.getenv("OPENAI_API_KEY"))
openai.api_key = os.getenv("OPENAI_API_KEY")
Copy link

Copilot AI Jul 17, 2025

Choose a reason for hiding this comment

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

This change reverts to the deprecated OpenAI v0.x API pattern. The newer OpenAI v1.x+ client-based approach (using OpenAI() constructor) is the recommended and supported method. Consider keeping the modern client pattern instead.

Copilot uses AI. Check for mistakes.
def get_chat_completion(instructions, input, model="gpt-4o", temperature=0.2):
"""Return the assistant message from an OpenAI responses API call."""
resp = _client.responses.create(
resp = openai.responses.create(
Copy link

Copilot AI Jul 17, 2025

Choose a reason for hiding this comment

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

The API endpoint 'responses.create' does not exist in the OpenAI API. This should likely be 'chat.completions.create' or 'completions.create' depending on the intended functionality.

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants