Skip to content

Vendor TinyInference and extract inference APIs - #133

Draft
senamakel wants to merge 23 commits into
tinyhumansai:mainfrom
senamakel:vendor-tinyinference-api
Draft

Vendor TinyInference and extract inference APIs#133
senamakel wants to merge 23 commits into
tinyhumansai:mainfrom
senamakel:vendor-tinyinference-api

Conversation

@senamakel

Copy link
Copy Markdown
Member

Summary

  • vendor tinyhumansai/tinyinference as the vendor/tinyinference git submodule
  • move model/message APIs, model streaming, provider adapters, request caching, usage, tool-call wire types, and embeddings into TinyInference
  • keep agent loops, middleware, tool execution, registries, graphs, and orchestration in TinyAgents
  • preserve existing tinyagents::harness::* import paths with compatibility re-exports
  • normalize TinyInference errors at TinyAgents runtime boundaries and keep optional REPL/RLM paths working
  • update architecture and harness documentation for the new ownership boundary

API change

Custom ChatModel implementations now return tinyinference::Result<ModelResponse> / tinyinference::Result<ModelStream>. TinyAgents converts those failures into TinyAgentsError at runtime boundaries.

Dependency

Depends on tinyhumansai/tinyinference#1. Mark this PR ready after that PR lands so the submodule commit is present on TinyInference main before merge.

Validation

  • cargo fmt --check
  • cargo clippy --all-targets -- -D warnings
  • cargo build --all-targets
  • cargo test (default features, including live OpenAI integration tests)
  • cargo test --all-features (969 unit tests, every integration/live test, and 37 doctests passed)
  • TinyInference: format, clippy, all-target build, 231 unit tests, 7 doctests, and rustdoc with warnings denied

senamakeland others added 22 commits August 30, 2026 18:22
Adds the tinynference repository as a submodule under vendor/tinyinference to include its inference capabilities as a dependency of the project.
Auto-committed-on: macbook
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…rs,src/harness/cache/types.rs,s
Auto-committed-on: macbook
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Add the vendored tinynference crate as a dependency to re-export its provider-neutral model, streaming, provider, and embedding APIs through the harness module for source compatibility.
Auto-committed-on: macbook
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…nference
The harness was defining its own `ToolFormat`, `ToolSchema`, `ToolCall`, and `ToolDelta` structs, duplicating the types now provided by the `tinyinference` crate. This change removes the local definitions and replaces them with a single `pub use` re-export, eliminating the maintenance burden of keeping two sets of identical types in sync.
Auto-committed-on: macbook
Co-authored-by: Medulla <medulla@tinyhumans.ai>
… and ToolCall
Remove the `ToolSchema`, `ToolFormat`, and `ToolCall` implementation blocks from the harness tool module. These types and their associated methods are no longer used within the codebase, so the dead code is being cleaned up to reduce maintenance burden and improve clarity.
Auto-committed-on: macbook
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The `validate_schema_value`, `validate_type_spec`, `json_value_matches_type`, and `json_value_kind` functions were dead code with no remaining callers in the codebase. Removing them eliminates unnecessary compilation overhead and clarifies that the harness tool registry no longer performs inline schema validation.
Auto-committed-on: macbook
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…onstruction
Add a From implementation to convert tinyinference errors into TinyAgentsError, mapping each variant appropriately. Extract the model profile construction from ModelCatalog into a standalone function to make the conversion logic reusable and to prepare for future capability-based profile generation.
Auto-committed-on: macbook
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The change replaces the previous conversion that wrapped a serialization error into a model error with a direct mapping to a dedicated serialization error variant, preserving the original error type instead of losing it in a generic model error.
Auto-committed-on: macbook
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The Cargo.lock file is updated to include the new tinyinference package at version 0.2.1 along with its dependencies, which are required for an upcoming feature.
Auto-committed-on: macbook
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Removed the import of `Result` and `TinyAgentsError` from the harness tool module, as these types are no longer referenced in the code.
Auto-committed-on: macbook
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Updated the return type of ChatModel trait implementations across test files from the local Result alias to tinyinference::Result, aligning test code with the upstream crate's error type.
Auto-committed-on: macbook
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Convert model, tool validation, and scripted model failures into the common harness error type. Propagate accumulator finalization errors instead of treating them as successful results.
Auto-committed-on: macbook
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Update test model implementations to return the error type expected by tinyinference results. This keeps retry, validation, and provider failure scenarios compatible with the current API.
Auto-committed-on: macbook
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Update the pinned commit for the tinytinference vendor dependency to include recent changes.
Auto-committed-on: macbook
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Update the pinned commit for the tinyinference subproject to incorporate upstream changes.
Auto-committed-on: macbook
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The `tinyagents::Result` import in the live cache test file was no longer referenced by any code in the module, so it has been removed to keep the imports clean and avoid compiler warnings.
Auto-committed-on: macbook
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Update the pinned commit for the tinytinference vendor dependency to a newer version, incorporating upstream changes.
Auto-committed-on: macbook
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Auto-committed-on: macbook
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…exports
The documentation now reflects that the provider-neutral model, message, streaming, usage, caching, and embeddings implementation has moved to the vendored TinyInference crate, with TinyAgents' harness modules becoming compatibility re-exports. The README, spec, and module docs are updated to describe this ownership shift and the new layout under `vendor/tinyinference/`.
Auto-committed-on: macbook
Co-authored-by: Medulla <medulla@tinyhumans.ai>
…dules/harness/embeddings.md
Auto-committed-on: macbook
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Reformat multi-line async function signatures in test files and a registry file to improve readability by placing each parameter on its own line. This change is purely cosmetic and does not alter any behavior.
Auto-committed-on: macbook
Co-authored-by: Medulla <medulla@tinyhumans.ai>
The model invocation is now wrapped in an async block that maps any error to a `TinyAgentsError` before being passed to `bridge_block_on`, ensuring consistent error handling across the codebase.
Auto-committed-on: macbook
Co-authored-by: Medulla <medulla@tinyhumans.ai>
@coderabbitai

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
auto_review:
drafts: true

Warning

Your free Security trial is over. An organization admin can activate Security or dismiss this notice.


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

Updated the pinned commit for the tinyinference vendored dependency to incorporate upstream fixes or improvements.
Auto-committed-on: macbook
Co-authored-by: Medulla <medulla@tinyhumans.ai>
Sign up for freeto 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

@senamakel