Skip to content

docs(litellm-rust): add provider coding standards - #33833

Merged
ishaan-berri merged 2 commits into
litellm_internal_stagingfrom
litellm_rust_provider_coding_standards
Jul 18, 2026
Merged

docs(litellm-rust): add provider coding standards#33833
ishaan-berri merged 2 commits into
litellm_internal_stagingfrom
litellm_rust_provider_coding_standards

Conversation

@devin-ai-integration

Copy link
Copy Markdown
Contributor

Linear ticket

Pre-Submission checklist

  • My PR's scope is as isolated as possible; it only solves 1 specific problem

Type

📖 Documentation

Changes

Adds litellm-rust/crates/CODING_STANDARDS/PROVIDER_CODING_STANDARDS.md, a numbered ruleset for adding or changing an LLM provider/route in litellm-rust, derived from the existing AGENTS.md / CLAUDE.md conventions and the OCR reference port.

The rules are grouped so a contributor can follow them top-to-bottom:

  • Provider resolution: always resolve provider/model first via get_custom_llm_provider, resolve once in prepare.rs
  • Transforms and base config: a route defines a base config trait with transform_request/transform_response; each provider implements it as a const <PROVIDER>_<ROUTE>_CONFIG, implementing only the transforms while inheriting shared trait defaults so future providers reuse existing logic
  • Boundaries: core pure, ai-gateway I/O, python-bridge thin; no provider branches in generic files; thin entry point delegating to CallLifecycle::run_request; constants in constants.rs
  • Types and errors: typed contracts only (no bare serde_json::Value), failures as typed CoreError values, no panics, no mutation, early returns, intentional Python-parity output shape
  • Safety: never log bodies/secrets, treat blank config as absent, host I/O sets timeouts and reuses a shared client
  • Tests and rollout: required transform test set plus *_match_python parity, lifecycle/hook tests, off-by-default behind Python parity tests
  • Checks: the cargo fmt/clippy/test commands to keep green

Docs-only; no code paths change.

QA runbook

N/A (docs-only)

Final Attestation

  • The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR

Link to Devin session: https://app.devin.ai/sessions/db90b4ee508f4e81b5c19568c03cd157
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.

@ishaan-berri
ishaan-berri enabled auto-merge (squash) July 18, 2026 18:26
@greptile-apps

greptile-apps Bot commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This is a docs-only PR adding litellm-rust/crates/CODING_STANDARDS/PROVIDER_CODING_STANDARDS.md, a 22-rule guide for how to add or change an LLM provider in the Rust port of litellm. No production code paths are modified.

  • Defines provider resolution, transform/config, boundary, typing, safety, test, and pre-push check rules for the litellm-rust crate, using the OCR provider as a reference implementation.
  • Adds the doc as a new file inside litellm-rust/crates/CODING_STANDARDS/ rather than in the dedicated litellm-docs repo, which conflicts with the repository's rule that documentation must live there.

Confidence Score: 3/5

No production code changes, but the single added file is placed in this repo contrary to the team's stated policy for documentation.

The coding standards document is well-structured and its content looks reasonable, but it is being added directly to this repo in violation of the rule that docs must go into the litellm-docs repo. The right location needs to be confirmed by a maintainer before merging.

litellm-rust/crates/CODING_STANDARDS/PROVIDER_CODING_STANDARDS.md — confirm with maintainers whether this belongs here or in litellm-docs.

Important Files Changed

Filename Overview
litellm-rust/crates/CODING_STANDARDS/PROVIDER_CODING_STANDARDS.md New markdown coding standards doc for litellm-rust provider development; violates the repo rule that documentation must live in the litellm-docs repo rather than this repository.

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

@@ -0,0 +1,53 @@
# Provider coding standards (litellm-rust)

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.

P1 Documentation should live in the litellm-docs repo

This repository has a rule that documentation additions must go into the litellm-docs repo, not this one. Adding PROVIDER_CODING_STANDARDS.md here adds prose docs directly to the main repo rather than the dedicated docs location. The file should be moved to the litellm-docs repo, or — if the intent is for it to serve as a machine-readable/tooling artifact for contributors working in this repo (similar to AGENTS.md / CLAUDE.md) — that distinction should be clarified in the PR description and confirmed by a maintainer.

Rule Used: Prevent documentation from being added - needs to ... (source)

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!

…ist guard

Co-Authored-By: Ishaan Jaffer <155045088+ishaan-berri@users.noreply.github.com>
@codecov

codecov Bot commented Jul 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@ishaan-berri
ishaan-berri merged commit 6d5f24f into litellm_internal_staging Jul 18, 2026
77 checks passed
@ishaan-berri
ishaan-berri deleted the litellm_rust_provider_coding_standards branch July 18, 2026 18:38
@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_rust_provider_coding_standards (867575a) with litellm_internal_staging (010b200)1

Open in CodSpeed

Footnotes

  1. No successful run was found on litellm_internal_staging (6f4f4f6) during the generation of this report, so 010b200 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