Skip to content

Conversation

dworthen
Copy link
Contributor

Add LiteLLM chat and embedding model providers.

@jgbradley1
Copy link
Collaborator

Just adding a note here that this PR should close #1575.

@AlonsoGuevara AlonsoGuevara requested a review from Copilot August 19, 2025 22:39
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds LiteLLM as a new provider for both chat and embedding models in GraphRAG, significantly expanding the library's model support to include many additional providers through LiteLLM's unified interface.

  • Implements LiteLLM chat and embedding model classes with comprehensive request wrappers
  • Adds robust retry mechanisms with multiple strategies (native, exponential backoff, random wait, incremental wait)
  • Implements static rate limiting with RPM/TPM controls and threading support

Reviewed Changes

Copilot reviewed 32 out of 33 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pyproject.toml Adds litellm dependency to the project
graphrag/config/enums.py Adds new LitellmChat and LitellmEmbedding model types
graphrag/config/models/language_model_config.py Extends configuration to support LiteLLM with model_provider field and validation
graphrag/config/defaults.py Adds model_provider default configuration
graphrag/language_model/factory.py Registers new LiteLLM model types in the factory
graphrag/language_model/providers/litellm/ Complete LiteLLM implementation including chat/embedding models, retry services, rate limiting, and request wrappers
tests/unit/litellm_services/ Comprehensive test suite covering retry mechanisms and rate limiting functionality
dictionary.txt Adds litellm to the project dictionary
.semversioner/next-release/ Marks this as a minor version release

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@dworthen dworthen marked this pull request as ready for review August 27, 2025 17:04
@dworthen dworthen requested a review from a team as a code owner August 27, 2025 17:04
Comment on lines +57 to +68
if model_config.api_base:
base_args["api_base"] = model_config.api_base
if model_config.api_version:
base_args["api_version"] = model_config.api_version
if model_config.api_key:
base_args["api_key"] = model_config.api_key
if model_config.organization:
base_args["organization"] = model_config.organization
if model_config.proxy:
base_args["proxy"] = model_config.proxy
if model_config.audience:
base_args["audience"] = model_config.audience
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could this be replaced by something like:

base_args.update({
    "api_base": model_config.api_base,
    ...
})

?

@dworthen
Copy link
Contributor Author

Closing in favor of #2051

@dworthen dworthen closed this Sep 10, 2025
@dworthen dworthen deleted the litellm branch September 10, 2025 18:51
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.

3 participants