Skip to content

Make approval guard gemini oai api compatible#277

Merged
husseinmozannar merged 6 commits intomicrosoft:mainfrom
bordeauxred:fix/approval_guard_google_oai_api
Jul 24, 2025
Merged

Make approval guard gemini oai api compatible#277
husseinmozannar merged 6 commits intomicrosoft:mainfrom
bordeauxred:fix/approval_guard_google_oai_api

Conversation

@bordeauxred
Copy link
Copy Markdown
Contributor

Restructure approval guard prompt to always include a system AND user message, which is required by the gemini open ai api
This fixes #260

@bordeauxred
Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@bordeauxred
Copy link
Copy Markdown
Contributor Author

bordeauxred commented Jul 19, 2025 via email

Copy link
Copy Markdown
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 restructures the approval guard prompt to ensure compatibility with the Gemini OpenAI API by always including both a system message and a user message, addressing issue #260.

Key changes:

  • Refactored prompt structure to separate system instructions from action content
  • Added logic to handle different content types (string, list) for action proposals
  • Implemented proper message structure with distinct system and user messages
Comments suppressed due to low confidence (1)

src/magentic_ui/approval_guard.py:226

  • [nitpick] The variable name 'action_content_str' could be more concise. Consider renaming to 'action_content' since the string type is evident from the context.
            action_content_str = ""

Comment thread src/magentic_ui/approval_guard.py Outdated
Comment thread src/magentic_ui/approval_guard.py Outdated
Copy link
Copy Markdown
Contributor

@husseinmozannar husseinmozannar left a comment

Choose a reason for hiding this comment

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

thank you so much for the fix!

@husseinmozannar husseinmozannar merged commit 863274a into microsoft:main Jul 24, 2025
9 checks passed
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.

Make Action Guard Gemini Compatible

3 participants