-
Notifications
You must be signed in to change notification settings - Fork 0
Dev #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Dev #24
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||
|---|---|---|---|---|
|
|
@@ -25,24 +25,25 @@ def __init__(self, api_key: str): | |||
| self.api_key = api_key | ||||
| 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]]: | ||||
| """ | ||||
| Prepare messages for Anthropic API format. | ||||
|
|
||||
| Anthropic's Messages API uses a similar format to OpenAI, but we need to | ||||
| ensure proper structure and handle any system messages appropriately. | ||||
|
|
||||
| Args: | ||||
| messages: List of messages in OpenAI format. | ||||
| messages: List of ChatMessage objects. | ||||
|
|
||||
| Returns: | ||||
| List of messages formatted for Anthropic API. | ||||
| """ | ||||
| anthropic_messages = [] | ||||
|
|
||||
| for message in messages: | ||||
| role = message["role"] | ||||
| content = message["content"] | ||||
| # Access Pydantic model attributes | ||||
|
||||
| # Access Pydantic model attributes |
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -25,24 +25,25 @@ def __init__(self, api_key: str): | |||||||||
| self.api_key = api_key | ||||||||||
| 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]]: | ||||||||||
|
||||||||||
| 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
AI
Jul 7, 2025
There was a problem hiding this comment.
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.
| 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
AI
Jul 7, 2025
There was a problem hiding this comment.
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.
| # Access Pydantic model attributes |
There was a problem hiding this comment.
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 usingList[ChatMessage]to make the expected input explicit.