Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save dsfaccini/23ad7695043329d81bef59907ba26aaf to your computer and use it in GitHub Desktop.

Select an option

Save dsfaccini/23ad7695043329d81bef59907ba26aaf to your computer and use it in GitHub Desktop.
LiteLLM vs GroqProvider comparison for Groq-routed models
"""
Compare LiteLLMProvider and GroqProvider for Groq-routed models.
"""
from pydantic_ai.providers.litellm import LiteLLMProvider
from pydantic_ai.providers.groq import GroqProvider
def main():
litellm = LiteLLMProvider(api_base='http://localhost:4000', api_key='test')
groq = GroqProvider(api_key='test')
models = [
('groq/llama3-70b', 'llama3-70b'),
('groq/gemma2-9b-it', 'gemma2-9b-it'),
('groq/deepseek-r1-distill-llama-70b', 'deepseek-r1-distill-llama-70b'),
('groq/compound-beta', 'compound-beta'),
]
print("Model LiteLLM Transformer Groq Transformer")
print("-" * 95)
for litellm_model, groq_model in models:
litellm_profile = litellm.model_profile(litellm_model)
groq_profile = groq.model_profile(groq_model)
litellm_trans = litellm_profile.json_schema_transformer.__name__ if litellm_profile.json_schema_transformer else "None"
groq_trans = groq_profile.json_schema_transformer.__name__ if groq_profile and groq_profile.json_schema_transformer else "None"
match = "✓" if litellm_trans == groq_trans else "✗"
print(f"{match} {groq_model:30s} {litellm_trans:30s} {groq_trans:30s}")
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment