[api] bring back anthropic /v1/messages endpoint in OpenAI server#1595
Conversation
Signed-off-by: AlpinDale <alpindale@gmail.com>
There was a problem hiding this comment.
Code Review
This pull request refactors the Anthropic /v1/messages endpoint by merging it into the main OpenAI API server, which is a positive step towards code consolidation. The new implementation of the endpoint within aphrodite/endpoints/openai/api_server.py is an improvement, featuring more robust error handling. However, a critical issue has been introduced with duplicated protocol definitions for Anthropic models. This needs to be addressed to prevent future maintenance challenges and confusion.
| from aphrodite.endpoints.anthropic.protocol import ( | ||
| AnthropicError, | ||
| AnthropicErrorResponse, | ||
| AnthropicMessagesRequest, | ||
| AnthropicMessagesResponse, | ||
| ) | ||
| from aphrodite.endpoints.anthropic.serving_messages import AnthropicServingMessages |
There was a problem hiding this comment.
There is a significant duplication of protocol definitions. This file now imports Anthropic protocol definitions from aphrodite/endpoints/anthropic/protocol.py. However, it appears that similar, but slightly different, definitions have also been added to aphrodite/endpoints/openai/protocol.py.
This duplication can lead to maintenance issues and confusion. For example, AnthropicErrorResponse is defined in aphrodite/endpoints/anthropic/protocol.py and used in this file, but it's missing from the new definitions in aphrodite/endpoints/openai/protocol.py.
To resolve this, all Anthropic-related protocol definitions should be consolidated into a single, authoritative location. Given that the Anthropic endpoint is being moved into the OpenAI server, it would be logical to move all related definitions to aphrodite/endpoints/openai/protocol.py, ensuring they are complete and correct, and then remove aphrodite/endpoints/anthropic/protocol.py. An alternative is to keep the definitions in aphrodite/endpoints/anthropic/protocol.py and remove the duplicated code from aphrodite/endpoints/openai/protocol.py.
No description provided.