diff --git a/Cargo.lock b/Cargo.lock index c73e0fa4..08de8c9b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -194,9 +194,9 @@ checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" [[package]] name = "chacha20" -version = "0.10.1" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d524456ba66e72eb8b115ff89e01e497f8e6d11d78b70b1aa13c0fbd97540a81" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" dependencies = [ "cfg-if", "cpufeatures 0.3.0", @@ -302,6 +302,15 @@ dependencies = [ "dirs-sys", ] +[[package]] +name = "dirs" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d57d423b3c82e89b9a24ca3091fee61f456a26edbd28d26c65906f4bc1dcd8f" +dependencies = [ + "dirs-sys", +] + [[package]] name = "dirs-sys" version = "0.5.0" @@ -1360,9 +1369,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.43" +version = "0.23.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0283386ce02abc0151e1761d08802dfe86c173b0b494af5cbc086574e453da06" +checksum = "0d41d731c7d2f962d1ccc364cec258de3c0e93b38c2fb3ba97ac74513048d634" dependencies = [ "once_cell", "ring", @@ -1384,9 +1393,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.103.13" +version = "0.103.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61c429a8649f110dddef65e2a5ad240f747e85f7758a6bccc7e5777bd33f756e" +checksum = "f3c3cf1d8b1e7d4927e2d154c3fcb02979afb9939629c62cd9048d4f07b60ac2" dependencies = [ "ring", "rustls-pki-types", @@ -1664,7 +1673,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" dependencies = [ "fastrand", - "getrandom 0.3.4", + "getrandom 0.4.3", "once_cell", "rustix", "windows-sys 0.61.2", @@ -1698,7 +1707,7 @@ dependencies = [ "async-trait", "block2", "chrono", - "dirs", + "dirs 7.0.0", "futures", "git2", "hex", @@ -1717,7 +1726,8 @@ dependencies = [ "sha2 0.10.9", "thiserror", "tinycortex-api", - "tinyinference", + "tinyinference-embeddings", + "tinyinference-llm", "tokio", "toml", "tracing", @@ -1733,19 +1743,47 @@ dependencies = [ ] [[package]] -name = "tinyinference" -version = "0.2.1" +name = "tinyinference-core" +version = "0.3.0" +dependencies = [ + "anyhow", + "httpdate", + "url", +] + +[[package]] +name = "tinyinference-embeddings" +version = "0.3.0" +dependencies = [ + "async-trait", + "once_cell", + "regex", + "reqwest", + "serde", + "serde_json", + "thiserror", + "tinyinference-core", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "tinyinference-llm" +version = "0.3.0" dependencies = [ "async-trait", "bytes", "futures", - "httpdate", "reqwest", "serde", "serde_json", "sha2 0.11.0", "thiserror", + "tinyinference-core", + "tinytools-agent", "tokio", + "tracing", ] [[package]] @@ -1814,7 +1852,7 @@ dependencies = [ "async-trait", "axum", "chrono", - "dirs", + "dirs 6.0.0", "log", "parking_lot", "rand 0.10.2", @@ -1827,7 +1865,8 @@ dependencies = [ "tempfile", "thiserror", "tinycortex", - "tinyinference", + "tinyinference-embeddings", + "tinyinference-llm", "tinymemory", "tinymemory-api", "tinymemory-conformance", @@ -1942,6 +1981,28 @@ dependencies = [ "uuid", ] +[[package]] +name = "tinytools" +version = "0.3.0" +source = "git+https://github.com/tinyhumansai/tinytools?rev=a5d04a7f3af0abc1dd748f87f94871b36ae9fe71#a5d04a7f3af0abc1dd748f87f94871b36ae9fe71" +dependencies = [ + "anyhow", + "async-trait", + "serde", + "serde_json", +] + +[[package]] +name = "tinytools-agent" +version = "0.3.0" +source = "git+https://github.com/tinyhumansai/tinytools?rev=a5d04a7f3af0abc1dd748f87f94871b36ae9fe71#a5d04a7f3af0abc1dd748f87f94871b36ae9fe71" +dependencies = [ + "regex", + "serde", + "serde_json", + "tinytools", +] + [[package]] name = "tinyvec" version = "1.12.0" diff --git a/Cargo.toml b/Cargo.toml index 64aee772..eef04fb2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -78,7 +78,9 @@ tinymemory-api = { path = "crates/tinymemory-api" } # source onto the same checkout `tinymemory-core` resolves through crates.io so # both crates share one trait identity. [patch."https://github.com/tinyhumansai/tinyinference"] -tinyinference = { path = "vendor/tinyinference/crates/tinyinference" } +tinyinference-core = { path = "vendor/tinyinference/crates/tinyinference-core" } +tinyinference-embeddings = { path = "vendor/tinyinference/crates/tinyinference-embeddings" } +tinyinference-llm = { path = "vendor/tinyinference/crates/tinyinference-llm" } [patch.crates-io] tinycortex = { path = "vendor/tinycortex" } @@ -86,7 +88,9 @@ tinycortex-api = { path = "vendor/tinycortex/api" } # `tinymemory-core` names the provider-neutral chat and embedding contracts # from TinyInference. It is not published, so standalone builds resolve the # version requirement to the pinned checkout here. -tinyinference = { path = "vendor/tinyinference/crates/tinyinference" } +tinyinference-core = { path = "vendor/tinyinference/crates/tinyinference-core" } +tinyinference-embeddings = { path = "vendor/tinyinference/crates/tinyinference-embeddings" } +tinyinference-llm = { path = "vendor/tinyinference/crates/tinyinference-llm" } [profile.release] # Cross-crate optimization and smaller, faster binaries for release builds. diff --git a/crates/tinymemory-core/Cargo.toml b/crates/tinymemory-core/Cargo.toml index 4c782456..b9d79dba 100644 --- a/crates/tinymemory-core/Cargo.toml +++ b/crates/tinymemory-core/Cargo.toml @@ -32,7 +32,8 @@ tinycortex = { version = "0.1", features = ["obsidian", "persona", "people", "sy # Provider-neutral chat-model and embedding primitives used by the tree # summarizer and embedding factory. Agent runtime and session behavior do not # belong in the memory layer. -tinyinference = "0.2" +tinyinference-embeddings = "0.3" +tinyinference-llm = "0.3" anyhow = "1.0" async-trait = "0.1" # NO `git2` HERE, DELIBERATELY — do not add it back. `diff/` holds the ops and diff --git a/crates/tinymemory-core/src/chat.rs b/crates/tinymemory-core/src/chat.rs index ae3137ce..bb20ee7f 100644 --- a/crates/tinymemory-core/src/chat.rs +++ b/crates/tinymemory-core/src/chat.rs @@ -13,8 +13,8 @@ use async_trait::async_trait; use crate::chat_host::{create_chat_model_with_model_id, provider_for_role, UsageInfo}; use crate::Config; -use tinyinference::message::Message; -use tinyinference::model::{ChatModel, ModelRequest}; +use tinyinference_llm::message::Message; +use tinyinference_llm::model::{ChatModel, ModelRequest}; /// One pair of prompt messages handed to the memory LLM backend. #[derive(Debug, Clone)] diff --git a/crates/tinymemory-core/src/chat_host.rs b/crates/tinymemory-core/src/chat_host.rs index 076779f4..f82912b3 100644 --- a/crates/tinymemory-core/src/chat_host.rs +++ b/crates/tinymemory-core/src/chat_host.rs @@ -8,7 +8,7 @@ //! //! # Why this trait is here and not in `tinymemory-api` //! -//! It names [`tinyinference::model::ChatModel`], and the contract crate is +//! It names [`tinyinference_llm::model::ChatModel`], and the contract crate is //! deliberately dependency-light — it must not pull in an inference SDK. This //! crate already depends on TinyInference, so it is the one place that can name //! both the model trait and the config seam. The host implements it here. @@ -20,7 +20,7 @@ use std::sync::Arc; use parking_lot::RwLock; -use tinyinference::model::{ChatModel, ModelResponse}; +use tinyinference_llm::model::{ChatModel, ModelResponse}; use crate::Config; diff --git a/crates/tinymemory-core/src/embedding_adapter.rs b/crates/tinymemory-core/src/embedding_adapter.rs index 037f33c2..a9497a80 100644 --- a/crates/tinymemory-core/src/embedding_adapter.rs +++ b/crates/tinymemory-core/src/embedding_adapter.rs @@ -2,14 +2,14 @@ //! model trait onto the seam's [`EmbeddingProvider`]. //! //! It lives in this crate rather than in `tinymemory-api` because the contract -//! crate must stay dependency-light and cannot name `tinyinference`; and rather +//! crate must stay dependency-light and cannot name `tinyinference-llm`; and rather //! than in the host because the tree's embedder factory — which is core code — //! builds Ollama models directly and needs to wrap them. The host re-exports it //! from `inference::embeddings`, so every existing path there keeps resolving //! and keeps naming this one type. use async_trait::async_trait; -use tinyinference::embeddings::EmbeddingModel; +use tinyinference_embeddings::EmbeddingModel; pub use tinymemory_api::host::{format_embedding_signature, EmbeddingProvider}; diff --git a/crates/tinymemory-core/src/store/factories.rs b/crates/tinymemory-core/src/store/factories.rs index 9272bde3..827447aa 100644 --- a/crates/tinymemory-core/src/store/factories.rs +++ b/crates/tinymemory-core/src/store/factories.rs @@ -18,7 +18,7 @@ use rusqlite::Connection; use crate::embedding_host::require_embedding_host; use crate::store::namespace_store::UnifiedMemory; use crate::traits::Memory; -use tinyinference::embeddings::{DEFAULT_OLLAMA_DIMENSIONS, DEFAULT_OLLAMA_MODEL}; +use tinyinference_embeddings::{DEFAULT_OLLAMA_DIMENSIONS, DEFAULT_OLLAMA_MODEL}; use tinymemory_api::host::MemoryConfig; use tinymemory_api::host::{format_embedding_signature, EmbeddingProvider}; use tinymemory_api::host::{EmbeddingRouteConfig, StorageProviderConfig}; diff --git a/crates/tinymemory-core/src/store/factories_tests.rs b/crates/tinymemory-core/src/store/factories_tests.rs index f3a993aa..44fa0940 100644 --- a/crates/tinymemory-core/src/store/factories_tests.rs +++ b/crates/tinymemory-core/src/store/factories_tests.rs @@ -91,7 +91,7 @@ fn embedding_settings_local_overrides_memory_config() { assert_eq!(model, "nomic-embed-text:latest"); assert_eq!( dims, - tinyinference::embeddings::DEFAULT_OLLAMA_DIMENSIONS, + tinyinference_embeddings::DEFAULT_OLLAMA_DIMENSIONS, "dimensions must default to Ollama default" ); } @@ -105,10 +105,10 @@ fn embedding_settings_local_with_empty_model_uses_default() { assert_eq!(provider, "ollama"); assert_eq!( model, - tinyinference::embeddings::DEFAULT_OLLAMA_MODEL, + tinyinference_embeddings::DEFAULT_OLLAMA_MODEL, "empty model ID must fall back to default Ollama model" ); - assert_eq!(dims, tinyinference::embeddings::DEFAULT_OLLAMA_DIMENSIONS); + assert_eq!(dims, tinyinference_embeddings::DEFAULT_OLLAMA_DIMENSIONS); } #[test] @@ -223,7 +223,7 @@ async fn start_mock_ollama() -> String { /// the legacy `local_ai.usage.embeddings = true` flag was set. Used so /// the existing test scenarios continue to drive the local code path. fn local_embedding_for_test() -> &'static str { - tinyinference::embeddings::DEFAULT_OLLAMA_MODEL + tinyinference_embeddings::DEFAULT_OLLAMA_MODEL } #[tokio::test] diff --git a/crates/tinymemory-core/src/test_seams.rs b/crates/tinymemory-core/src/test_seams.rs index 6f6defad..8d9ace53 100644 --- a/crates/tinymemory-core/src/test_seams.rs +++ b/crates/tinymemory-core/src/test_seams.rs @@ -72,13 +72,13 @@ impl crate::chat_host::ChatHost for TestChatHost { _role: &str, _config: &Config, _temperature: f64, - ) -> Result<(Arc>, String), String> { + ) -> Result<(Arc>, String), String> { Err("TestChatHost does not build models — model routing is host behaviour".to_string()) } fn usage_from_response( &self, - _response: &tinyinference::model::ModelResponse, + _response: &tinyinference_llm::model::ModelResponse, ) -> Option { None } diff --git a/crates/tinymemory-core/src/tree/score/embed/factory.rs b/crates/tinymemory-core/src/tree/score/embed/factory.rs index 72aa74e5..87e52119 100644 --- a/crates/tinymemory-core/src/tree/score/embed/factory.rs +++ b/crates/tinymemory-core/src/tree/score/embed/factory.rs @@ -39,7 +39,7 @@ use tinymemory_api::host::test_support::TestHostConfig; use super::{Embedder, InertEmbedder, ProviderEmbedder, EMBEDDING_DIM}; use crate::embedding_host::require_embedding_host; use crate::Config; -use tinyinference::embeddings::{OllamaEmbeddingModel, RECOMMENDED_OLLAMA_CONTEXT_TOKENS}; +use tinyinference_embeddings::{OllamaEmbeddingModel, RECOMMENDED_OLLAMA_CONTEXT_TOKENS}; /// Cheap heuristic for "is a backend session reachable?" — the cloud /// embedder needs one and bails on first embed call without it. We use diff --git a/crates/tinymemory-core/src/tree/score/embed/mod.rs b/crates/tinymemory-core/src/tree/score/embed/mod.rs index 56cc6b75..3e5b2061 100644 --- a/crates/tinymemory-core/src/tree/score/embed/mod.rs +++ b/crates/tinymemory-core/src/tree/score/embed/mod.rs @@ -87,7 +87,7 @@ pub trait Embedder: Send + Sync { /// Adapts the canonical host embedding-provider contract to the legacy /// memory-tree embedder shape. Concrete network implementations live in -/// `tinyinference::embeddings`; this bridge owns only dimension checks +/// `tinyinference_llm::embeddings`; this bridge owns only dimension checks /// and the memory tree's per-position batch fallback contract. pub struct ProviderEmbedder { inner: Box, diff --git a/crates/tinymemory-core/src/tree/tree_runtime/engine.rs b/crates/tinymemory-core/src/tree/tree_runtime/engine.rs index 6d00d3f2..1c4c0b37 100644 --- a/crates/tinymemory-core/src/tree/tree_runtime/engine.rs +++ b/crates/tinymemory-core/src/tree/tree_runtime/engine.rs @@ -8,8 +8,8 @@ use crate::engine::backend::tree::runtime::{ use anyhow::{Context, Result}; use async_trait::async_trait; use chrono::{DateTime, Timelike, Utc}; -use tinyinference::message::Message; -use tinyinference::model::{ChatModel, ModelRequest}; +use tinyinference_llm::message::Message; +use tinyinference_llm::model::{ChatModel, ModelRequest}; use crate::engine::engine_config; use crate::Config; diff --git a/crates/tinymemory-core/src/tree/tree_runtime/engine_tests.rs b/crates/tinymemory-core/src/tree/tree_runtime/engine_tests.rs index 54691fe6..3853f002 100644 --- a/crates/tinymemory-core/src/tree/tree_runtime/engine_tests.rs +++ b/crates/tinymemory-core/src/tree/tree_runtime/engine_tests.rs @@ -5,7 +5,7 @@ use crate::tree::tree_runtime::store; use chrono::TimeZone; use std::sync::Mutex; use tempfile::TempDir; -use tinyinference::model::ModelResponse; +use tinyinference_llm::model::ModelResponse; use tinymemory_api::host::test_support::TestHostConfig; struct RecordingModel { @@ -28,11 +28,11 @@ impl ChatModel<()> for RecordingModel { &self, _state: &(), request: ModelRequest, - ) -> tinyinference::Result { + ) -> tinyinference_llm::Result { self.requests.lock().unwrap().push(request); match &self.reply { Ok(reply) => Ok(ModelResponse::assistant(reply.clone())), - Err(message) => Err(tinyinference::Error::Model(message.clone())), + Err(message) => Err(tinyinference_llm::Error::Model(message.clone())), } } } diff --git a/crates/tinymemory-module/Cargo.lock b/crates/tinymemory-module/Cargo.lock index d8f83c79..84e40d33 100644 --- a/crates/tinymemory-module/Cargo.lock +++ b/crates/tinymemory-module/Cargo.lock @@ -275,6 +275,15 @@ dependencies = [ "dirs-sys", ] +[[package]] +name = "dirs" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d57d423b3c82e89b9a24ca3091fee61f456a26edbd28d26c65906f4bc1dcd8f" +dependencies = [ + "dirs-sys", +] + [[package]] name = "dirs-sys" version = "0.5.0" @@ -1349,9 +1358,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.43" +version = "0.23.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0283386ce02abc0151e1761d08802dfe86c173b0b494af5cbc086574e453da06" +checksum = "0d41d731c7d2f962d1ccc364cec258de3c0e93b38c2fb3ba97ac74513048d634" dependencies = [ "log", "once_cell", @@ -1489,15 +1498,6 @@ dependencies = [ "zmij", ] -[[package]] -name = "serde_spanned" -version = "0.6.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" -dependencies = [ - "serde", -] - [[package]] name = "serde_spanned" version = "1.1.1" @@ -1708,7 +1708,7 @@ dependencies = [ "thiserror", "tinybus-macros", "tokio", - "toml 0.8.23", + "toml", "tracing", "ureq", "zip", @@ -1743,7 +1743,7 @@ dependencies = [ "async-trait", "block2", "chrono", - "dirs", + "dirs 7.0.0", "futures", "git2", "hex", @@ -1762,9 +1762,10 @@ dependencies = [ "sha2 0.10.9", "thiserror", "tinycortex-api", - "tinyinference", + "tinyinference-embeddings", + "tinyinference-llm", "tokio", - "toml 1.1.4+spec-1.1.0", + "toml", "tracing", "uuid", "walkdir", @@ -1778,19 +1779,47 @@ dependencies = [ ] [[package]] -name = "tinyinference" -version = "0.2.1" +name = "tinyinference-core" +version = "0.3.0" +dependencies = [ + "anyhow", + "httpdate", + "url", +] + +[[package]] +name = "tinyinference-embeddings" +version = "0.3.0" +dependencies = [ + "async-trait", + "once_cell", + "regex", + "reqwest", + "serde", + "serde_json", + "thiserror", + "tinyinference-core", + "tokio", + "tracing", + "url", +] + +[[package]] +name = "tinyinference-llm" +version = "0.3.0" dependencies = [ "async-trait", "bytes", "futures", - "httpdate", "reqwest", "serde", "serde_json", "sha2 0.11.0", "thiserror", + "tinyinference-core", + "tinytools-agent", "tokio", + "tracing", ] [[package]] @@ -1799,7 +1828,6 @@ version = "1.16.0" dependencies = [ "anyhow", "async-trait", - "log", "serde", "serde_json", "tinymemory-api", @@ -1838,8 +1866,7 @@ dependencies = [ "anyhow", "async-trait", "chrono", - "dirs", - "futures", + "dirs 6.0.0", "log", "parking_lot", "rand", @@ -1851,14 +1878,12 @@ dependencies = [ "sha2 0.11.0", "thiserror", "tinycortex", - "tinycortex-api", - "tinyinference", + "tinyinference-embeddings", + "tinyinference-llm", "tinymemory-api", "tinymemory-sources", - "tinymemory-sync", "tokio", "tracing", - "url", "uuid", "walkdir", ] @@ -1877,7 +1902,7 @@ dependencies = [ "tinybus", "tinybus-module", "tinycortex", - "tinyinference", + "tinyinference-llm", "tinymemory", "tinymemory-api", "tinymemory-bus", @@ -1902,23 +1927,12 @@ dependencies = [ "serde_json", "tinymemory-api", "tokio", - "toml 1.1.4+spec-1.1.0", + "toml", "tracing", "uuid", "walkdir", ] -[[package]] -name = "tinymemory-sync" -version = "0.1.0" -dependencies = [ - "chrono", - "log", - "serde", - "serde_json", - "tracing", -] - [[package]] name = "tinymemory-tinycortex" version = "0.1.0" @@ -1947,6 +1961,28 @@ dependencies = [ "zerovec", ] +[[package]] +name = "tinytools" +version = "0.3.0" +source = "git+https://github.com/tinyhumansai/tinytools?rev=a5d04a7f3af0abc1dd748f87f94871b36ae9fe71#a5d04a7f3af0abc1dd748f87f94871b36ae9fe71" +dependencies = [ + "anyhow", + "async-trait", + "serde", + "serde_json", +] + +[[package]] +name = "tinytools-agent" +version = "0.3.0" +source = "git+https://github.com/tinyhumansai/tinytools?rev=a5d04a7f3af0abc1dd748f87f94871b36ae9fe71#a5d04a7f3af0abc1dd748f87f94871b36ae9fe71" +dependencies = [ + "regex", + "serde", + "serde_json", + "tinytools", +] + [[package]] name = "tinyvec" version = "1.12.0" @@ -2013,18 +2049,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "toml" -version = "0.8.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" -dependencies = [ - "serde", - "serde_spanned 0.6.9", - "toml_datetime 0.6.11", - "toml_edit", -] - [[package]] name = "toml" version = "1.1.4+spec-1.1.0" @@ -2033,20 +2057,11 @@ checksum = "3aace63f4bbcdfc2c965b059de67119c89c4017a70d633be6c104910f67056f5" dependencies = [ "indexmap", "serde_core", - "serde_spanned 1.1.1", - "toml_datetime 1.1.1+spec-1.1.0", + "serde_spanned", + "toml_datetime", "toml_parser", "toml_writer", - "winnow 1.0.4", -] - -[[package]] -name = "toml_datetime" -version = "0.6.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" -dependencies = [ - "serde", + "winnow", ] [[package]] @@ -2058,35 +2073,15 @@ dependencies = [ "serde_core", ] -[[package]] -name = "toml_edit" -version = "0.22.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" -dependencies = [ - "indexmap", - "serde", - "serde_spanned 0.6.9", - "toml_datetime 0.6.11", - "toml_write", - "winnow 0.7.15", -] - [[package]] name = "toml_parser" version = "1.1.3+spec-1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1d38ac1cf9b95face32296c0a3ede1fdc270627c9d9c02a7274dd6d960dc4d56" dependencies = [ - "winnow 1.0.4", + "winnow", ] -[[package]] -name = "toml_write" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" - [[package]] name = "toml_writer" version = "1.1.2+spec-1.1.0" @@ -2542,15 +2537,6 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" -[[package]] -name = "winnow" -version = "0.7.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" -dependencies = [ - "memchr", -] - [[package]] name = "winnow" version = "1.0.4" diff --git a/crates/tinymemory-module/Cargo.toml b/crates/tinymemory-module/Cargo.toml index 6a017b1b..cddc6748 100644 --- a/crates/tinymemory-module/Cargo.toml +++ b/crates/tinymemory-module/Cargo.toml @@ -53,7 +53,7 @@ tinymemory-tinycortex = { path = "../tinymemory-tinycortex", features = ["memory # upstream, so a Linux or Windows artifact still compiles none of them. tinycortex = { version = "0.1", features = ["contacts"] } # Provider-neutral chat request and response types carried over TinyBus. -tinyinference = "0.2" +tinyinference-llm = "0.3" # TinyBus provides the typed service interface and the dynamic module host ABI. # Reached by path now that this crate is its own workspace root: the nested # checkout's `[workspace.package]` resolves correctly from here. @@ -112,12 +112,16 @@ tempfile = "3" tinymemory-api = { path = "../tinymemory-api" } [patch."https://github.com/tinyhumansai/tinyinference"] -tinyinference = { path = "../../vendor/tinyinference/crates/tinyinference" } +tinyinference-core = { path = "../../vendor/tinyinference/crates/tinyinference-core" } +tinyinference-embeddings = { path = "../../vendor/tinyinference/crates/tinyinference-embeddings" } +tinyinference-llm = { path = "../../vendor/tinyinference/crates/tinyinference-llm" } [patch.crates-io] tinycortex = { path = "../../vendor/tinycortex" } tinycortex-api = { path = "../../vendor/tinycortex/api" } -tinyinference = { path = "../../vendor/tinyinference/crates/tinyinference" } +tinyinference-core = { path = "../../vendor/tinyinference/crates/tinyinference-core" } +tinyinference-embeddings = { path = "../../vendor/tinyinference/crates/tinyinference-embeddings" } +tinyinference-llm = { path = "../../vendor/tinyinference/crates/tinyinference-llm" } # Mirrors the root package's set. `unsafe_code = "forbid"` holds even though # `module_export!` emits `unsafe extern "C"` symbols: the macro's expansion diff --git a/crates/tinymemory-module/src/chat.rs b/crates/tinymemory-module/src/chat.rs index eb3509b2..d6cfea88 100644 --- a/crates/tinymemory-module/src/chat.rs +++ b/crates/tinymemory-module/src/chat.rs @@ -4,7 +4,7 @@ use std::sync::Arc; use async_trait::async_trait; use tinybus::Connection; -use tinyinference::model::{ChatModel, ModelRequest, ModelResponse}; +use tinyinference_llm::model::{ChatModel, ModelRequest, ModelResponse}; use crate::ModuleConfig; @@ -97,7 +97,7 @@ impl ChatModel<()> for BusChatModel { &self, _state: &(), request: ModelRequest, - ) -> tinyinference::Result { + ) -> tinyinference_llm::Result { let proxy = self .connection .proxy( @@ -105,11 +105,11 @@ impl ChatModel<()> for BusChatModel { CHAT_HOST_OBJECT_PATH, CHAT_HOST_INTERFACE, ) - .map_err(|error| tinyinference::Error::Model(error.to_string()))?; + .map_err(|error| tinyinference_llm::Error::Model(error.to_string()))?; proxy .call("Complete", (self.role.clone(), request)) .await - .map_err(|error| tinyinference::Error::Model(error.to_string())) + .map_err(|error| tinyinference_llm::Error::Model(error.to_string())) } } diff --git a/crates/tinymemory-module/src/chat_test.rs b/crates/tinymemory-module/src/chat_test.rs index 6fd9910d..cf85fb77 100644 --- a/crates/tinymemory-module/src/chat_test.rs +++ b/crates/tinymemory-module/src/chat_test.rs @@ -3,9 +3,9 @@ use tinybus::broker::Broker; use tinybus::transport::memory::MemoryBus; use tinybus::{Connection, Result as BusResult}; -use tinyinference::message::{AssistantMessage, ContentBlock, Message}; -use tinyinference::model::{ModelRequest, ModelResponse}; -use tinyinference::usage::Usage; +use tinyinference_llm::message::{AssistantMessage, ContentBlock, Message}; +use tinyinference_llm::model::{ModelRequest, ModelResponse}; +use tinyinference_llm::usage::Usage; use super::{BusChatHost, CHAT_HOST_BUS_NAME, CHAT_HOST_OBJECT_PATH}; use crate::config::ModuleConfig; diff --git a/crates/tinymemory-module/tests/module_e2e.rs b/crates/tinymemory-module/tests/module_e2e.rs index 574e8e36..ff2960b5 100644 --- a/crates/tinymemory-module/tests/module_e2e.rs +++ b/crates/tinymemory-module/tests/module_e2e.rs @@ -123,13 +123,13 @@ impl HostChat { async fn complete( &self, _role: String, - _request: tinyinference::model::ModelRequest, - ) -> BusResult { - use tinyinference::message::{AssistantMessage, ContentBlock}; - use tinyinference::usage::Usage; + _request: tinyinference_llm::model::ModelRequest, + ) -> BusResult { + use tinyinference_llm::message::{AssistantMessage, ContentBlock}; + use tinyinference_llm::usage::Usage; std::future::ready(()).await; - Ok(tinyinference::model::ModelResponse { + Ok(tinyinference_llm::model::ModelResponse { message: AssistantMessage { id: None, content: vec![ContentBlock::Text("deterministic summary".into())], diff --git a/vendor/tinybus b/vendor/tinybus index 730b933b..b436e096 160000 --- a/vendor/tinybus +++ b/vendor/tinybus @@ -1 +1 @@ -Subproject commit 730b933b96f45fb99cfc4cdfd1e904e9393bdbf5 +Subproject commit b436e096b13aca68497ed881068a4ff96f4f7b19 diff --git a/vendor/tinyinference b/vendor/tinyinference index 92445ea5..72d030db 160000 --- a/vendor/tinyinference +++ b/vendor/tinyinference @@ -1 +1 @@ -Subproject commit 92445ea582c9b1c5dc78891ebbff4a817f9e8fa9 +Subproject commit 72d030db6a5be9c0fbdefe5e3fef7adfe8737719