Conversation
- 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>
|
There was a problem hiding this comment.
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
ChatMessageinputs - Deleted the
.github/workflows/deploy-docs-simple.ymlfile
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]]: |
There was a problem hiding this comment.
[nitpick] The parameter type hint uses an untyped List; consider specifying List[ChatMessage] for clarity and type safety.
| 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]]: |
| 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]]: |
There was a problem hiding this comment.
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.
| 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]]]: |
| for message in messages: | ||
| role = message["role"] | ||
| content = message["content"] | ||
| # Access Pydantic model attributes |
There was a problem hiding this comment.
[nitpick] This comment adds little value and could be removed to reduce noise; the code is self-explanatory.
| # Access Pydantic model attributes |
| 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]]: |
There was a problem hiding this comment.
[nitpick] The parameter type hint is now a generic List; consider using List[ChatMessage] to make the expected input explicit.
| 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]]: |
| for message in messages: | ||
| role = message["role"] | ||
| content = message["content"] | ||
| # Access Pydantic model attributes |
There was a problem hiding this comment.
[nitpick] This inline comment is redundant given the clear attribute access; consider removing it to keep the code concise.
| # Access Pydantic model attributes |



No description provided.