Skip to content

chore: rename ChatCompletions to Completions#47

Merged
EggerMarc merged 4 commits into
mainfrom
chore/rename-chat-completions
Jun 3, 2026
Merged

chore: rename ChatCompletions to Completions#47
EggerMarc merged 4 commits into
mainfrom
chore/rename-chat-completions

Conversation

@EggerMarc

@EggerMarc EggerMarc commented Jun 3, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • Refactor

    • Renamed ChatCompletions* API surface to Completions* across docs, examples, and providers; updated corresponding request/response types and streaming implementations.
    • Example and documentation snippets updated to match new Completions* naming.
  • Chores

    • Bumped crate versions and updated completions dependency to the new release.
  • Breaking change

    • The previously available "streamed" response type was removed from the public API.

@coderabbitai

coderabbitai Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Warning

Review limit reached

@EggerMarc, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 38 minutes and 47 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 015bc3cd-10be-4665-adf6-29a6935d3509

📥 Commits

Reviewing files that changed from the base of the PR and between 7171de7 and 7e308ce.

📒 Files selected for processing (3)
  • docs/content/docs/capabilities/streaming.mdx
  • docs/content/docs/traits/index.mdx
  • docs/content/docs/traits/stream-provider.mdx
📝 Walkthrough

Walkthrough

This PR renames ChatCompletions* to Completions* across the completions provider crate, its request/response types, builder/client API, provider implementations, vendor wrappers, docs/examples, and bumps related crate versions; it also removes the Streamed marker and related builder transition.

Changes

Completions Type Rename Across Provider and Wrappers

Layer / File(s) Summary
Docs and examples update
docs/content/docs/providers/completions.mdx, examples/completions/completion.rs
Documentation and example code updated to use CompletionsBuilder / CompletionsClient in all shown snippets and explanations.
Core request/response types and client struct
providers/completions/src/client.rs, providers/completions/src/api/types/request.rs, providers/completions/src/api/types/response.rs
Renamed ChatCompletionsClientCompletionsClient, ChatCompletionsRequestCompletionsRequest, ChatCompletionsEmbeddingRequestCompletionsEmbeddingRequest, ChatCompletionsResponseCompletionsResponse, and ChatCompletionsEmbeddingResponseCompletionsEmbeddingResponse; moved/updated impls and tests accordingly.
Builder type and public module exports
providers/completions/src/lib.rs
Renamed ChatCompletionsBuilderCompletionsBuilder, updated Default impl, builder marker return types, with_transport, with_model, with_base_url, and build() now return Completions* types; crate docs updated.
Core provider trait implementations
providers/completions/src/api/completion.rs, providers/completions/src/api/embedding.rs, providers/completions/src/api/stream.rs
CompletionProvider, EmbeddingsProvider, and StreamProvider impls retargeted to CompletionsClient<T> and use CompletionsRequest/CompletionsResponse variants; error handling and control flow preserved.
Vendor provider wrappers
providers/cerebras/src/lib.rs, providers/deepseek/src/lib.rs, providers/huggingface/src/lib.rs, providers/ollama/src/lib.rs, providers/openrouter/src/lib.rs
Each wrapper imports and constructs CompletionsBuilder and now returns CompletionsClient<T> from their build() methods while preserving API key/model/base-url/transport/header wiring.
Cargo manifests and version bumps
Cargo.toml, core/Cargo.toml, and provider Cargo.toml files
Workspace and provider crate versions bumped and chat-completions dependency updated to 0.3.0; chat-core version bumped to 0.4.1.
Core stream feature/type-state adjustments
core/src/builder.rs, core/src/chat/state.rs, src/lib.rs
Removed Streamed marker and its with_streamed_response builder transition; InputStreamed import adjusted and Streamed no longer re-exported under stream feature.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • EggerMarc/chat-rs#45: Overlaps in OpenRouter provider builder/client wiring that previously used ChatCompletions types.
  • EggerMarc/chat-rs#36: Introduced ChatCompletions* types that are being renamed here.
  • EggerMarc/chat-rs#42: Related to stream/input streaming changes and type-state adjustments referenced in this PR.

Poem

🐰 From "Chat" to "Completions" the names hop anew,
Builders and clients dressed in a cleaner view,
Wrappers and docs follow, each import and test,
Versions bumped lightly — the repo looks its best,
A little rabbit cheers for the tidy refactor crew.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'chore: rename ChatCompletions to Completions' accurately summarizes the main change across the entire changeset, which systematically renames ChatCompletions-related types to Completions-related types throughout the codebase.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/rename-chat-completions

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

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.

Actionable comments posted: 6

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@providers/cerebras/src/lib.rs`:
- Around line 19-21: The import line `use chat_completions::{CompletionsBuilder,
CompletionsClient, ReqwestTransport, Transport};` is misformatted and failing
rustfmt in CI; reformat the import to conform to rustfmt (or run `cargo fmt
--all`) so the `use chat_completions::{...}` line matches project formatting
rules and the build passes.

In `@providers/completions/src/lib.rs`:
- Around line 34-35: Run rustfmt (cargo fmt) on the file to fix signature
formatting issues; specifically reformat the generic struct signature for
CompletionsBuilder (the declaration "pub struct CompletionsBuilder<M =
WithoutModel, U = WithoutUrl, T: Transport = ReqwestTransport>") and any other
misformatted signatures around the second occurrence (lines showing the same
generics at 114-117) so they conform to rustfmt style and compile cleanly.
- Around line 24-25: Keep backwards compatibility by adding deprecated aliases
that re-export the new types under the old crate-root names: add deprecated
re-exports so ChatCompletionsClient points to CompletionsClient and
ChatCompletionsBuilder points to the new builder type (e.g., CompletionsBuilder
or the builder struct in crate::client) wherever the current pub use
crate::client::CompletionsClient is declared (also mirror for the exports around
lines 34-35). Mark these aliases as deprecated (using the #[deprecated]
attribute) and update their doc comment to point consumers to the new names.

In `@providers/deepseek/src/lib.rs`:
- Around line 26-28: The import line using chat_completions (the use
chat_completions::{CompletionsBuilder, CompletionsClient, ReqwestTransport,
Transport}; statement) is misformatted; run rustfmt to fix it—execute cargo fmt
--all and commit the resulting formatting changes so the use statement and
surrounding code conform to rustfmt rules and CI passes.

In `@providers/huggingface/src/lib.rs`:
- Around line 33-35: The grouped import line using chat_completions
(CompletionsBuilder, CompletionsClient, ReqwestTransport, Transport) is
misformatted for rustfmt; run cargo fmt --all or reformat the use statement so
it matches rustfmt style (e.g., one-per-line or properly wrapped) ensuring the
identifiers CompletionsBuilder, CompletionsClient, ReqwestTransport, and
Transport in lib.rs are formatted correctly to satisfy CI.

In `@providers/ollama/src/lib.rs`:
- Around line 28-31: The import block using chat_completions (use
chat_completions::{CompletionsBuilder, CompletionsClient, ChatError, Request,
ReqwestTransport, Transport, TransportError};) is misformatted for rustfmt; run
rustfmt by executing cargo fmt --all (or apply rustfmt formatting) so the use
statement is formatted according to the project's style and CI will pass.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: dca64fbf-e130-499e-8cba-a4ea600c999b

📥 Commits

Reviewing files that changed from the base of the PR and between 1145f9d and 761d6ce.

📒 Files selected for processing (14)
  • docs/content/docs/providers/completions.mdx
  • examples/completions/completion.rs
  • providers/cerebras/src/lib.rs
  • providers/completions/src/api/completion.rs
  • providers/completions/src/api/embedding.rs
  • providers/completions/src/api/stream.rs
  • providers/completions/src/api/types/request.rs
  • providers/completions/src/api/types/response.rs
  • providers/completions/src/client.rs
  • providers/completions/src/lib.rs
  • providers/deepseek/src/lib.rs
  • providers/huggingface/src/lib.rs
  • providers/ollama/src/lib.rs
  • providers/openrouter/src/lib.rs

Comment thread providers/cerebras/src/lib.rs Outdated
Comment thread providers/completions/src/lib.rs
Comment thread providers/completions/src/lib.rs Outdated
Comment thread providers/deepseek/src/lib.rs Outdated
Comment thread providers/huggingface/src/lib.rs Outdated
Comment thread providers/ollama/src/lib.rs

@coderabbitai coderabbitai Bot left a comment

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.

🧹 Nitpick comments (2)
providers/cerebras/Cargo.toml (1)

3-3: 💤 Low value

Consider a minor bump (0.3.0) rather than patch for the rename.

This crate re-exports the renamed CompletionsBuilder/CompletionsClient, so chat_cerebras::ChatCompletions* paths break for downstream consumers. Under 0.x semver, a breaking public-API rename warrants a minor bump (0.2.40.3.0) rather than a patch.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@providers/cerebras/Cargo.toml` at line 3, Update the crate version to a minor
bump to reflect the breaking rename: change the version in Cargo.toml from
"0.2.5" to "0.3.0" so downstream consumers see the API-level change; this crate
re-exports the renamed CompletionsBuilder/CompletionsClient (affecting
chat_cerebras::ChatCompletions* paths), so publish as 0.3.0 to follow 0.x semver
rules.
providers/huggingface/Cargo.toml (1)

3-3: 💤 Low value

Same semver concern as the Cerebras wrapper.

The Hugging Face wrapper re-exports the renamed CompletionsBuilder/CompletionsClient (breaking the old ChatCompletions* paths for consumers), so consider a minor bump (0.2.40.3.0) instead of patch.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@providers/huggingface/Cargo.toml` at line 3, The crate version in Cargo.toml
should be bumped to a new minor release because the public API re-exports
renamed types (CompletionsBuilder and CompletionsClient) which break the old
ChatCompletions* paths; update the version from "0.2.5" to "0.3.0" in
providers/huggingface/Cargo.toml and ensure any related package metadata (e.g.,
workspace/Cargo.lock notes or changelog/release notes) reflect the API change so
consumers get a minor-version update.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@providers/cerebras/Cargo.toml`:
- Line 3: Update the crate version to a minor bump to reflect the breaking
rename: change the version in Cargo.toml from "0.2.5" to "0.3.0" so downstream
consumers see the API-level change; this crate re-exports the renamed
CompletionsBuilder/CompletionsClient (affecting chat_cerebras::ChatCompletions*
paths), so publish as 0.3.0 to follow 0.x semver rules.

In `@providers/huggingface/Cargo.toml`:
- Line 3: The crate version in Cargo.toml should be bumped to a new minor
release because the public API re-exports renamed types (CompletionsBuilder and
CompletionsClient) which break the old ChatCompletions* paths; update the
version from "0.2.5" to "0.3.0" in providers/huggingface/Cargo.toml and ensure
any related package metadata (e.g., workspace/Cargo.lock notes or
changelog/release notes) reflect the API change so consumers get a minor-version
update.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: fd4730ec-f45d-421a-a35c-9beefb8d82b5

📥 Commits

Reviewing files that changed from the base of the PR and between 761d6ce and 7171de7.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (22)
  • Cargo.toml
  • core/Cargo.toml
  • core/src/builder.rs
  • core/src/chat/state.rs
  • docs/public/icon-dark.webp
  • docs/public/icon-light.webp
  • docs/public/logo-dark.webp
  • docs/public/logo-light.webp
  • providers/cerebras/Cargo.toml
  • providers/cerebras/src/lib.rs
  • providers/claude/Cargo.toml
  • providers/completions/Cargo.toml
  • providers/completions/src/lib.rs
  • providers/deepseek/Cargo.toml
  • providers/deepseek/src/lib.rs
  • providers/gemini/Cargo.toml
  • providers/huggingface/Cargo.toml
  • providers/huggingface/src/lib.rs
  • providers/ollama/Cargo.toml
  • providers/ollama/src/lib.rs
  • providers/openrouter/Cargo.toml
  • src/lib.rs
💤 Files with no reviewable changes (1)
  • core/src/chat/state.rs
✅ Files skipped from review due to trivial changes (7)
  • providers/gemini/Cargo.toml
  • providers/completions/Cargo.toml
  • core/Cargo.toml
  • providers/claude/Cargo.toml
  • providers/openrouter/Cargo.toml
  • providers/ollama/Cargo.toml
  • providers/deepseek/Cargo.toml
🚧 Files skipped from review as they are similar to previous changes (5)
  • providers/cerebras/src/lib.rs
  • providers/deepseek/src/lib.rs
  • providers/ollama/src/lib.rs
  • providers/huggingface/src/lib.rs
  • providers/completions/src/lib.rs

@EggerMarc EggerMarc merged commit 3ca7d2c into main Jun 3, 2026
1 check was pending
@EggerMarc EggerMarc deleted the chore/rename-chat-completions branch June 10, 2026 17:47
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.

1 participant