Skip to content

[feat] Add CentML as llm provider #11472

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

Closed
wants to merge 12 commits into from
Closed

Conversation

V2arK
Copy link

@V2arK V2arK commented Jun 6, 2025

Title

Add CentML provider support with granular function calling and JSON schema controls

Relevant issues

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Local test screenshot

image

Type

🆕 New Feature

Changes

Core Provider Integration

  • Added CentML provider support to LiteLLM's provider ecosystem
  • Added CENTML = "centml" to LlmProviders enum
  • Integrated CentML into provider detection logic and OpenAI-compatible handler routing
  • Added environment variable support (CENTML_API_KEY, CENTML_API_BASE)

Model Support & Capabilities Matrix

  • Added 12 CentML models with differentiated capability support:
    • JSON ✅ / Tool ✅: Llama-3.3-70B-Instruct, Llama-4-Scout-17B-16E-Instruct, Llama-4-Maverick-17B-128E-Instruct-FP8, Llama-3.2-3B-Instruct, Llama-3.2-11B-Vision-Instruct
    • JSON ✅ / Tool ❌: DeepSeek-R1, DeepSeek-V3-0324, Phi-4-mini-instruct, Qwen2.5-VL-7B-Instruct
    • JSON ❌ / Tool ❌: QwQ-32B, Llama-Guard-4-12B
  • Updated model pricing configuration in both main and backup JSON files

Granular Parameter Control

  • Separated function calling and JSON schema controls into independent parameters:
    • supports_function_calling: Controls tools, tool_choice, function_call parameters
    • supports_response_schema: Controls response_format parameter independently
  • Implemented CentmlConfig class with intelligent parameter validation based on model capabilities

Handler Implementation

  • Created OpenAI-compatible handlers for both chat and text completion endpoints
  • CentmlChatCompletion and CentmlTextCompletion classes extending OpenAI handlers
  • Added transformation logic in CentmlConfig and CentmlTextCompletionConfig

Comprehensive Testing

  • Added 20+ unit tests in tests/test_litellm/llms/centml/:
    • Chat completion transformation tests (20 tests)
    • Text completion transformation tests (18 tests)
  • Added integration tests in tests/local_testing/test_centml_integration.py:
    • Parameter validation matrix testing
    • CentML documentation example verification
    • Error handling and authentication testing
  • Added warning suppression for LiteLLM's Pydantic deprecation warnings

Technical Implementation Details

  • Fixed model name lookup issues by properly handling centml/ prefix construction
  • Added proper error handling for missing model capabilities
  • Implemented response_format filtering (removes {"type": "text"} default)
  • Added support for all standard OpenAI parameters where applicable

This implementation enables developers to use CentML's inference platform through LiteLLM with full parameter validation, ensuring that unsupported features are properly blocked while supported features work seamlessly with the existing LiteLLM ecosystem.

Copy link

vercel bot commented Jun 6, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 19, 2025 3:19pm

@CLAassistant
Copy link

CLAassistant commented Jun 6, 2025

CLA assistant check
All committers have signed the CLA.

@V2arK V2arK marked this pull request as ready for review June 19, 2025 15:19
@V2arK V2arK closed this Jul 8, 2025
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