Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

chore(tinymemes): remove unused inference, jev, and search modules

Steven Enamakeld35385a374e6
diff --git a/crates/openhuman-core/src/tinymemes/inference.rs b/crates/openhuman-core/src/tinymemes/inference.rs
index cfdccb03df..72fdfd61e2 100644
--- a/crates/openhuman-core/src/tinymemes/inference.rs
+++ b/crates/openhuman-core/src/tinymemes/inference.rs
@@ -1,4 +1,4 @@
-//! OpenHuman's own inference as tinymemes' chat model.
+//! OpenHuman's own inference, served to the module's `Complete` callback.
//!
//! Every call goes through the provider OpenHuman is configured with for the
//! `summarization` role (managed backend, BYOK cloud, or local), the same
@@ -6,7 +6,6 @@
//! for these calls only; a rewrite needs none, and reasoning models otherwise
//! spend ~10 s per call. The rest of OpenHuman keeps its configured reasoning.
-use async_trait::async_trait;
use tinyinference_llm::message::Message;
use tinyinference_llm::model::ModelRequest;
@@ -17,46 +16,33 @@ use crate::inference::provider;
pub(crate) const ROLE: &str = "summarization";
const TEMPERATURE: f64 = 0.7;
-pub(crate) struct OpenHumanChatModel {
- config: Config,
-}
-
-impl OpenHumanChatModel {
- pub(crate) fn new(config: Config) -> Self {
- Self { config }
+/// One system + user completion on the `summarization` provider.
+pub(crate) async fn complete(config: &Config, system: &str, user: &str) -> Result<String, String> {
+ // Built per call so a provider change in Settings applies without a
+ // restart; construction is cheap and synchronous.
+ let (model, resolved) = provider::create_chat_model_with_model_id(ROLE, config, TEMPERATURE)
+ .map_err(|e| format!("openhuman inference unavailable: {e}"))?;
+ // Reasoning off for tinymemes' calls only (the rest of OpenHuman keeps
+ // its configured reasoning). The managed backend honours the
+ // `without_reasoning` flag; a BYOK route to OpenRouter needs
+ // OpenRouter's own switch. Other endpoints are left untouched, since an
+ // unknown field can be rejected.
+ let mut request = provider::openhuman_backend_model::without_reasoning(
+ ModelRequest::new(vec![Message::system(system), Message::user(user)])
+ .with_temperature(TEMPERATURE),
+ );
+ if routes_to_openrouter(config) {
+ request.provider_options = serde_json::json!({ "reasoning": { "enabled": false } });
}
-}
-
-#[async_trait]
-impl tinymemes::ChatModel for OpenHumanChatModel {
- async fn complete(&self, system: &str, user: &str) -> Result<String, tinymemes::BoxError> {
- // Built per call so a provider change in Settings applies without a
- // restart; construction is cheap and synchronous.
- let (model, resolved) =
- provider::create_chat_model_with_model_id(ROLE, &self.config, TEMPERATURE)
- .map_err(|e| format!("openhuman inference unavailable: {e}"))?;
- // Reasoning off for tinymemes' calls only (the rest of OpenHuman keeps
- // its configured reasoning). The managed backend honours the
- // `without_reasoning` flag; a BYOK route to OpenRouter needs
- // OpenRouter's own switch. Other endpoints are left untouched, since an
- // unknown field can be rejected.
- let mut request = provider::openhuman_backend_model::without_reasoning(
- ModelRequest::new(vec![Message::system(system), Message::user(user)])
- .with_temperature(TEMPERATURE),
- );
- if routes_to_openrouter(&self.config) {
- request.provider_options = serde_json::json!({ "reasoning": { "enabled": false } });
- }
- let response = model
- .invoke(&(), request)
- .await
- .map_err(|e| format!("openhuman inference failed model={resolved}: {e}"))?;
- let text = response.text();
- if text.trim().is_empty() {
- return Err(format!("openhuman inference returned no text model={resolved}").into());
- }
- Ok(text)
+ let response = model
+ .invoke(&(), request)
+ .await
+ .map_err(|e| format!("openhuman inference failed model={resolved}: {e}"))?;
+ let text = response.text();
+ if text.trim().is_empty() {
+ return Err(format!("openhuman inference returned no text model={resolved}"));
}
+ Ok(text)
}
/// Whether tinymemes' role resolves to an OpenRouter endpoint: a BYOK
diff --git a/crates/openhuman-core/src/tinymemes/jev.rs b/crates/openhuman-core/src/tinymemes/jev.rs
index 4e5c15d591..fcfcc52c3e 100644
--- a/crates/openhuman-core/src/tinymemes/jev.rs
+++ b/crates/openhuman-core/src/tinymemes/jev.rs
@@ -1,24 +1,23 @@
//! Jev as OpenHuman manages it.
//!
-//! tinymemes uses the OpenHuman-managed Jev: a signed-in TinyHumans session
+//! The module uses the OpenHuman-managed Jev: a signed-in TinyHumans session
//! reaches Jev through the backend's System One proxy, billed to the account.
-//! There is no other OpenHuman-side route. A different Jev is only used when
-//! `TINYMEMES_JEV` (and its key variables) override it in the environment.
+//! There is no other OpenHuman-side route.
//!
//! `None` means managed Jev is unavailable (signed out, or the offline local
-//! session, which has no backend account); the caller then answers Jev's
-//! questions with OpenHuman's own LLM.
+//! session, which has no backend account); the `Evaluate` callback then
+//! reports `Unsupported` and the module returns the original reply.
use std::sync::Arc;
-use tinymemes::decisions::{Client, ClientConfig};
+use tinyinference_decisions::{Client, ClientConfig};
use crate::config::Config;
use crate::security::credentials::session_support::{
is_local_session_token, resolve_backend_credential, BackendCredential,
};
-pub(crate) fn managed(config: &Config) -> Option<Arc<dyn tinymemes::Evaluator>> {
+pub(crate) fn managed(config: &Config) -> Option<Arc<Client>> {
// Only a session token can be the offline local session; an API key is
// never classified by its shape.
let secret = match resolve_backend_credential(config).ok()? {
diff --git a/crates/openhuman-core/src/tinymemes/search.rs b/crates/openhuman-core/src/tinymemes/search.rs
index 3ecabdf220..0b83d847dc 100644
--- a/crates/openhuman-core/src/tinymemes/search.rs
+++ b/crates/openhuman-core/src/tinymemes/search.rs
@@ -1,10 +1,9 @@
-//! OpenHuman's web search as tinymemes' research backend.
+//! OpenHuman's web search as the module's `Search` callback.
//!
//! Runs the same checks the `web_search` tool does before calling the search
//! module: search enabled in settings, the LocalOnly egress block, and at
//! least one provider able to serve the search role.
-use async_trait::async_trait;
use serde_json::json;
use crate::config::Config;
@@ -35,13 +34,13 @@ impl OpenHumanSearch {
}
}
-#[async_trait]
-impl tinymemes::WebSearch for OpenHumanSearch {
- async fn search(
+impl OpenHumanSearch {
+ /// Run one search through the search module.
+ pub(crate) async fn search(
&self,
query: &str,
max_results: usize,
- ) -> Result<Vec<tinymemes::SearchHit>, tinymemes::BoxError> {
+ ) -> Result<Vec<tinymemes_bus::SearchResult>, String> {
let request = tinysearch_bus::ExecuteToolRequest {
name: TOOL.to_string(),
arguments: json!({ "query": query, "max_results": max_results.clamp(1, 20) }),
@@ -52,7 +51,7 @@ impl tinymemes::WebSearch for OpenHumanSearch {
Ok(response
.results
.into_iter()
- .map(|r| tinymemes::SearchHit {
+ .map(|r| tinymemes_bus::SearchResult {
title: r.title,
url: r.url,
snippet: r.snippet,