Skip to content

Dev#24

Merged
ozanunal0 merged 2 commits intomainfrom
dev
Jul 7, 2025
Merged

Dev#24
ozanunal0 merged 2 commits intomainfrom
dev

Conversation

@ozanunal0
Copy link
Copy Markdown
Owner

No description provided.

ozanunal0 and others added 2 commits July 7, 2025 20:20
- Consolidated docs deployment into main CI workflow
- Prevents conflicts between multiple deployment workflows
- All documentation deployment now handled in ci.yml

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
- Fixed Anthropic provider to use message.role and message.content instead of dict access
- Fixed Google provider to use message.role and message.content instead of dict access
- Fixed prompt token estimation in Google provider to use Pydantic attributes
- This resolves the "'ChatMessage' object is not subscriptable" errors in tests

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 7, 2025 17:34
@ozanunal0 ozanunal0 merged commit c9dd1ab into main Jul 7, 2025
7 of 13 checks passed
@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented Jul 7, 2025

Copy link
Copy Markdown

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 Google and Anthropic provider methods to operate on Pydantic ChatMessage objects instead of plain dictionaries and removes the simple docs deployment workflow.

  • Switch dict-style message access to model attribute access
  • Adjusted method signatures and docstrings to reflect ChatMessage inputs
  • Deleted the .github/workflows/deploy-docs-simple.yml file

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
app/providers/google/provider.py Changed _translate_messages_to_google to use message.role/message.content and updated type hints
app/providers/anthropic/provider.py Changed _prepare_messages_for_anthropic to use message.role/message.content and updated type hints
.github/workflows/deploy-docs-simple.yml Removed unused documentation deployment workflow

genai.configure(api_key=self.api_key)

def _translate_messages_to_google(self, messages: List[Dict[str, str]]) -> List[Dict[str, str]]:
def _translate_messages_to_google(self, messages: List) -> List[Dict[str, str]]:
Copy link

Copilot AI Jul 7, 2025

Choose a reason for hiding this comment

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

[nitpick] The parameter type hint uses an untyped List; consider specifying List[ChatMessage] for clarity and type safety.

Suggested change
def _translate_messages_to_google(self, messages: List) -> List[Dict[str, str]]:
def _translate_messages_to_google(self, messages: List[ChatMessage]) -> List[Dict[str, str]]:

Copilot uses AI. Check for mistakes.
genai.configure(api_key=self.api_key)

def _translate_messages_to_google(self, messages: List[Dict[str, str]]) -> List[Dict[str, str]]:
def _translate_messages_to_google(self, messages: List) -> List[Dict[str, str]]:
Copy link

Copilot AI Jul 7, 2025

Choose a reason for hiding this comment

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

The return type List[Dict[str, str]] doesn’t match the actual structure (parts is a List[str]); update to reflect Dict[str, List[str]] or a proper model.

Suggested change
def _translate_messages_to_google(self, messages: List) -> List[Dict[str, str]]:
def _translate_messages_to_google(self, messages: List) -> List[Dict[str, List[str]]]:

Copilot uses AI. Check for mistakes.
for message in messages:
role = message["role"]
content = message["content"]
# Access Pydantic model attributes
Copy link

Copilot AI Jul 7, 2025

Choose a reason for hiding this comment

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

[nitpick] This comment adds little value and could be removed to reduce noise; the code is self-explanatory.

Suggested change
# Access Pydantic model attributes

Copilot uses AI. Check for mistakes.
self.client = anthropic.AsyncAnthropic(api_key=self.api_key)

def _prepare_messages_for_anthropic(self, messages: List[Dict[str, str]]) -> List[Dict[str, str]]:
def _prepare_messages_for_anthropic(self, messages: List) -> List[Dict[str, str]]:
Copy link

Copilot AI Jul 7, 2025

Choose a reason for hiding this comment

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

[nitpick] The parameter type hint is now a generic List; consider using List[ChatMessage] to make the expected input explicit.

Suggested change
def _prepare_messages_for_anthropic(self, messages: List) -> List[Dict[str, str]]:
def _prepare_messages_for_anthropic(self, messages: List[ChatMessage]) -> List[Dict[str, str]]:

Copilot uses AI. Check for mistakes.
for message in messages:
role = message["role"]
content = message["content"]
# Access Pydantic model attributes
Copy link

Copilot AI Jul 7, 2025

Choose a reason for hiding this comment

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

[nitpick] This inline comment is redundant given the clear attribute access; consider removing it to keep the code concise.

Suggested change
# Access Pydantic model attributes

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