Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 39 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,19 @@ 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" }
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.
Expand Down
3 changes: 2 additions & 1 deletion crates/tinymemory-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ tinycortex-api = { version = "0.1" }
# 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.2"
tinyinference-llm = "0.2"
anyhow = "1.0"
async-trait = "0.1"
# NO `git2` HERE, DELIBERATELY — do not add it back. `diff/` holds the ops and
Expand Down
4 changes: 2 additions & 2 deletions crates/tinymemory-core/src/chat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down
4 changes: 2 additions & 2 deletions crates/tinymemory-core/src/chat_host.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions crates/tinymemory-core/src/embedding_adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
2 changes: 1 addition & 1 deletion crates/tinymemory-core/src/store/factories.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down
8 changes: 4 additions & 4 deletions crates/tinymemory-core/src/store/factories_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"
);
}
Expand All @@ -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]
Expand Down Expand Up @@ -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]
Expand Down
4 changes: 2 additions & 2 deletions crates/tinymemory-core/src/test_seams.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,13 @@ impl crate::chat_host::ChatHost for TestChatHost {
_role: &str,
_config: &Config,
_temperature: f64,
) -> Result<(Arc<dyn tinyinference::model::ChatModel<()>>, String), String> {
) -> Result<(Arc<dyn tinyinference_llm::model::ChatModel<()>>, 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<tinymemory_api::host::UsageInfo> {
None
}
Expand Down
2 changes: 1 addition & 1 deletion crates/tinymemory-core/src/tree/score/embed/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion crates/tinymemory-core/src/tree/score/embed/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<dyn tinymemory_api::host::EmbeddingProvider>,
Expand Down
4 changes: 2 additions & 2 deletions crates/tinymemory-core/src/tree/tree_runtime/engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions crates/tinymemory-core/src/tree/tree_runtime/engine_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -28,11 +28,11 @@ impl ChatModel<()> for RecordingModel {
&self,
_state: &(),
request: ModelRequest,
) -> tinyinference::Result<ModelResponse> {
) -> tinyinference_llm::Result<ModelResponse> {
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())),
}
}
}
Expand Down
38 changes: 33 additions & 5 deletions crates/tinymemory-module/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading