Skip to content

docs(rust): add provider abstraction standards - #33865

Merged
ishaan-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_provider-coding-standards
Jul 18, 2026
Merged

docs(rust): add provider abstraction standards#33865
ishaan-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_provider-coding-standards

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Relevant issues

Linear ticket

Pre-Submission checklist

  • I have added meaningful tests
  • My PR passes all CI/CD checks (e.g., lint, format, unit tests)
  • My PR's scope is as isolated as possible; it only solves 1 specific problem
  • I have received a Greptile Confidence Score of at least 4/5 before requesting a maintainer review

Screenshots / Proof of Fix

Documentation-only change; no runtime proof is applicable

Type

📖 Documentation

Changes

Added the provider abstraction guidance to litellm-rust/CLAUDE.md and the provider onboarding guide. The guidance directs contributors to search for and extend shared bases, avoid duplicated provider flows, and document intentional deviations in the PR

Final Attestation

  • The documentation accurately captures the requested provider coding standard

Link to Devin session: https://app.devin.ai/sessions/5c46bf2e7662475aa32eb04f5a6f8aa4
Requested by: @ishaan-berri

Co-Authored-By: Ishaan Jaffer <155045088+ishaan-berri@users.noreply.github.com>
@ishaan-berri ishaan-berri self-assigned this Jul 18, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@greptile-apps

greptile-apps Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This documentation-only PR adds provider abstraction standards to two existing developer-guide files in the litellm-rust/ directory, directing contributors to find and extend shared bases rather than duplicating provider flows.

  • The same guidance block is added verbatim to both ADDING_A_PROVIDER.md and CLAUDE.md, creating a future sync risk if the standard evolves.
  • CLAUDE.md is scoped to Rust work, but the new section cites Python filesystem paths (litellm/llms/base_llm/, litellm_core_utils/) as concrete examples; this could mislead Rust contributors into looking for inheritable base classes that live in Python, rather than the equivalent Rust traits in crates/core/.

Confidence Score: 4/5

Documentation-only change with no production code impact; safe to merge after considering the cross-language path references.

Both files receive identical guidance prose, and the Rust-specific CLAUDE.md now points contributors at Python source paths that cannot be directly consumed from Rust. Neither issue breaks anything at runtime, but the duplication creates a maintenance hazard and the Python path references in a Rust-only guide may mislead contributors.

litellm-rust/CLAUDE.md — the Python path references in a Rust-only guide deserve a second look.

Important Files Changed

Filename Overview
litellm-rust/ADDING_A_PROVIDER.md Adds a "Coding standards" section with provider abstraction guidance; section is an exact copy of what's also added to CLAUDE.md, creating a duplication/maintenance burden.
litellm-rust/CLAUDE.md Adds a "Provider Coding Standards" section; references Python-specific paths (litellm/llms/base_llm/, litellm_core_utils/) that are not directly usable from Rust code, which may confuse contributors working in this Rust-only file.

Reviews (1): Last reviewed commit: "docs(rust): add provider abstraction sta..." | Re-trigger Greptile

Comment on lines +9 to +26
## Coding standards

Before writing new logic, look for an existing base to extend. When a change is
“the same behavior for one more provider/endpoint/integration”, the codebase
almost always already has a shared abstraction for it (for example, provider
`BaseConfig` transformation classes in `litellm/llms/base_llm/`, shared
helpers in `litellm_core_utils/`, typed request/response models, or factory
functions). Find it first with a search, then add the new variant by inheriting
from or composing that base, overriding only what genuinely differs (model
name, parameter mapping, or auth).

Never copy an existing implementation and edit it in place, and never hand-roll
a parallel version of logic a base already provides. If you catch yourself
writing a second copy of a pattern that exists twice already, stop and extract a
base instead: put the shared shape in one place and make both call sites thin
variants of it. The test for a good abstraction is that adding the next provider
is a few declarative lines, not a new file of duplicated flow. Only diverge from
the base when behavior is genuinely different, and say so explicitly in the PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Identical block duplicated across both files

The "Coding standards" section added here is character-for-character identical to the "Provider Coding Standards" block added to CLAUDE.md. If this guidance ever needs to change, both files must be updated in sync, and they will inevitably drift. Consider either keeping the canonical text in one file and having the other reference it (e.g., "See CLAUDE.md for provider coding standards"), or consolidating the two files so there is a single source of truth.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Comment thread litellm-rust/CLAUDE.md
Comment on lines +5 to +22
## Provider Coding Standards

Before writing new logic, look for an existing base to extend. When a change is
“the same behavior for one more provider/endpoint/integration”, the codebase
almost always already has a shared abstraction for it (for example, provider
`BaseConfig` transformation classes in `litellm/llms/base_llm/`, shared
helpers in `litellm_core_utils/`, typed request/response models, or factory
functions). Find it first with a search, then add the new variant by inheriting
from or composing that base, overriding only what genuinely differs (model
name, parameter mapping, or auth).

Never copy an existing implementation and edit it in place, and never hand-roll
a parallel version of logic a base already provides. If you catch yourself
writing a second copy of a pattern that exists twice already, stop and extract a
base instead: put the shared shape in one place and make both call sites thin
variants of it. The test for a good abstraction is that adding the next provider
is a few declarative lines, not a new file of duplicated flow. Only diverge from
the base when behavior is genuinely different, and say so explicitly in the PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Python paths referenced in Rust-specific documentation

The guidance references litellm/llms/base_llm/ and litellm_core_utils/ — Python filesystem paths — inside CLAUDE.md, which is declared as the guide for Rust work. A Rust contributor searching for BaseConfig in those paths will find Python classes that cannot be inherited or composed from Rust. It would be clearer to either state these paths as conceptual models to mirror (not reuse directly), or point to the corresponding Rust equivalents (e.g., the traits in crates/core/src/<route>/transformation.rs).

@ishaan-berri
ishaan-berri merged commit 366ec6f into litellm_internal_staging Jul 18, 2026
76 checks passed
@ishaan-berri
ishaan-berri deleted the litellm_provider-coding-standards branch July 18, 2026 22:31
@codspeed-hq

codspeed-hq Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 31 untouched benchmarks


Comparing litellm_provider-coding-standards (9b3d371) with litellm_internal_staging (e238e89)1

Open in CodSpeed

Footnotes

  1. No successful run was found on litellm_internal_staging (3f9b71c) during the generation of this report, so e238e89 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

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