Avoid creating provider-specific API implementations when generic, reusable solutions exist or can be developed. This principle improves code maintainability, reduces duplication, and ensures consistency across the API surface.
Key practices:
Example from the discussions:
# Instead of creating a new handler:
class HostedVLLMRerank(BaseLLM):
# custom implementation...
# Reuse existing patterns:
# "please follow the cohere integration, and use the base_llm_http_handler"
# Instead of hardcoded endpoints:
if "gateway.ai.cloudflare.com" in api_base:
# custom logic...
# Use generic configuration:
api_base = api_base or get_configurable_base_url()
This approach reduces technical debt, makes the codebase more predictable for developers, and ensures that improvements to core functionality benefit all providers rather than being siloed in provider-specific implementations.
Enter the URL of a public GitHub repository