core/src/hosts the core traits (llm,embedding,audio,image,moderation) pluscore/src/lib.rsfor re-exports; rootsrc/lib.rsis theaitherfacade crate.derive/is theaither-deriveproc-macro crate—limit it to macro glue and avoid depending on provider code.openai/contains the integration crate that maps the traits onto OpenAI endpoints; keep it lean so other providers can re-use the core API.examples/(notablytool_macro.rs) provides runnable flows; extend it and validate viacargo run --example tool_macro.
cargo fmt --all— formats every crate exactly as CI expects.cargo clippy --all-targets --all-features --workspace -- -D warnings— pedantic lint gate mirrored in.github/workflows/ci.yml.cargo test --all-features --workspace— runs unit and doc tests, including async cases backed bytokio-test.cargo doc --all-features --no-deps --workspace— ensures docs compile under thedocsrscfg.cargo run --example tool_macro— smoke-tests the showcased example when changing macros or request builders.
- Public trait methods return
impl Future; never exposePin<Box<dyn Future>>or boxed-future aliases in public signatures. - When a trait must be stored dynamically, define a private object-safe twin
[Trait]Implplus a public wrapperAny[Trait](e.g.AnyChatActionSender,AnyHandler,AnyContainerExec;Toolsplays that role forTool). Boxing lives inside the wrapper — callers only see the concrete API. anyhowis banned: every error is athiserrorenum so callers can match on failure kinds.Box<dyn Error>is acceptable only at a binary's outermost boundary.
Follow rustfmt defaults (4 spaces, trailing commas) and keep modules snake_case, traits/types UpperCamelCase, and feature flags kebab-case (serde, derive). Public APIs need /// docs because cargo doc --cfg docsrs runs in CI. Favor builders such as Request::new([...]), keep provider-only structs behind feature flags, and align with clippy::pedantic expectations before raising a PR.
Text the model reads — tool results, notices, alerts and reminders — is natural language rendered from a typed template; no serializer output (JSON, XML) reaches the model, except data a command or an external tool itself produced and the schema of output the model must emit.
Co-locate unit tests inside each module using #[cfg(test)] mod tests so traits stay covered near their definitions. Async logic should use #[tokio::test] (multi-thread flavor when polling streams) and exercise futures_lite::StreamExt when verifying streaming traits. Every new capability needs at least one success path, one failure path, and—when user facing—a doc test or example that mirrors realistic prompts.
History favors short, imperative subjects (see Add serde support, Rename ai-types to aither); follow that pattern and explain breaking changes in the body. Pull requests should provide a concise description, link to the motivating issue, paste the results of cargo fmt, clippy, and test, and call out any docs/examples touched. Attach logs or transcripts when altering provider behavior so reviewers can reproduce the call.
main is the only long-lived branch. Topic branches start from origin/main and land through the merge queue, whose required check is CI result. release-plz keeps a release PR against main; merging it publishes, and it is never set to merge automatically.
Never commit provider secrets; inject them via environment variables such as OPENAI_API_KEY when hacking on aither-openai. Keep .env* files out of Git and strip identifiers from captured responses before committing examples.