chore: add scaffoldings for Apple foundational model#48
Conversation
|
Warning Review limit reached
More reviews will be available in 18 minutes and 58 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 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (22)
📝 WalkthroughWalkthroughThis PR introduces an ChangesApple Foundation Model Availability Feature
Sequence DiagramsequenceDiagram
participant Caller as Example (main)
participant API as chat_rs::applefm::availability()
participant FFI as ffi::availability_json()
participant Bridge as Swift: afm_availability()
participant Models as FoundationModels
Caller->>API: availability()
API->>FFI: availability_json()
alt applefm_bridge enabled (macOS)
FFI->>Bridge: FFI call
Bridge->>Models: query FoundationModels
Models-->>Bridge: available or error reason
Bridge-->>FFI: JSON char* (allocated)
FFI->>FFI: convert and free
FFI-->>API: JSON String
else applefm_bridge disabled or non-macOS
FFI-->>API: static stub JSON
end
API->>API: serde_json::from_str
API-->>Caller: Availability { available, reason }
Caller->>Caller: print AVAILABLE or UNAVAILABLE
🎯 3 (Moderate) | ⏱️ ~20 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
providers/applefm/Cargo.toml (1)
1-14:⚠️ Potential issue | 🟠 Major | ⚡ Quick winAdd required provider feature contract (
default+stream).The crate is missing the required
default = []andstreamfeature wiring (chat-core/stream,dep:async-stream,dep:futures), which breaks workspace-wide feature consistency.Suggested features block
+[features] +default = [] +stream = ["chat-core/stream", "dep:async-stream", "dep:futures"]As per coding guidelines, "Provider crate
Cargo.tomlmust define astreamfeature that enables thestreamfeature inchat-core, includes optional dependencies onasync-streamandfutures, and defaults to an empty feature set."🤖 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/applefm/Cargo.toml` around lines 1 - 14, Add a features section to the Cargo.toml that sets default = [] and defines a stream feature that enables the chat-core "stream" feature and makes async-stream and futures optional dependencies for this crate; update the [dependencies] block to mark async-stream and futures as optional (and referenced by the stream feature) so the stream feature toggles chat-core/stream plus the optional deps (symbols: Cargo.toml, feature name "stream", default = [], dependency names "async-stream" and "futures", and enabling "chat-core/stream").Sources: Coding guidelines, Learnings
🤖 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 `@Cargo.toml`:
- Around line 120-122: The root Cargo.toml's "stream" feature list is missing
the conditional propagation for the AppleFM provider; update the stream array to
include "chat-applefm?/stream" so that enabling --features stream,applefm also
enables the provider's stream feature; specifically modify the stream feature
declaration (the entry containing "chat-core/stream",
"chat-completions?/stream", ... ) to add "chat-applefm?/stream" alongside the
other conditional provider entries.
In `@providers/applefm/Cargo.toml`:
- Around line 11-13: The Cargo.toml dependencies block is missing required
provider crates; update the [dependencies] section (where serde.workspace and
serde_json.workspace are declared) to add chat-core, transport-reqwest,
async-trait, tools-rs, and schemars, and also add optional/feature-gated
streaming deps futures and async-stream (mark them optional or behind a
"streaming" feature if your repo uses features); ensure versions match workspace
conventions or use workspace = true where appropriate and keep serde/serde_json
as currently declared.
---
Outside diff comments:
In `@providers/applefm/Cargo.toml`:
- Around line 1-14: Add a features section to the Cargo.toml that sets default =
[] and defines a stream feature that enables the chat-core "stream" feature and
makes async-stream and futures optional dependencies for this crate; update the
[dependencies] block to mark async-stream and futures as optional (and
referenced by the stream feature) so the stream feature toggles chat-core/stream
plus the optional deps (symbols: Cargo.toml, feature name "stream", default =
[], dependency names "async-stream" and "futures", and enabling
"chat-core/stream").
🪄 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: 424c38b1-6125-4324-8d83-05b2fb5b108f
⛔ Files ignored due to path filters (1)
Cargo.lockis excluded by!**/*.lock
📒 Files selected for processing (10)
.gitignoreCargo.tomlexamples/applefm/availability.rsproviders/applefm/Cargo.tomlproviders/applefm/bridge/Package.swiftproviders/applefm/bridge/Sources/AppleFMBridge/Exports.swiftproviders/applefm/build.rsproviders/applefm/src/ffi.rsproviders/applefm/src/lib.rssrc/lib.rs
|
@CodeRabbit review |
✅ Action performedReview finished.
|
Summary by CodeRabbit
applefmfeature for Apple foundation model integration.