Skip to content

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

fix(python_server): handle missing spacy model gracefully

Steven Enamakel082a27f584ce
diff --git a/crates/openhuman-core/src/runtime/python_server/spacy.rs b/crates/openhuman-core/src/runtime/python_server/spacy.rs
index 0741ad4f6d..08b0ff6f52 100644
--- a/crates/openhuman-core/src/runtime/python_server/spacy.rs
+++ b/crates/openhuman-core/src/runtime/python_server/spacy.rs
@@ -54,9 +54,25 @@ pub struct SpacyRuntime {
pub python_bin: PathBuf,
}
-/// The spaCy wire types live in the contract crate — the memory tree's query
-/// extractor consumes them. See [`tinymemory_api::host::SpacyResponse`].
-pub use tinymemory_api::host::{SpacyEntity, SpacyResponse};
+/// One entity spaCy found.
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+pub struct SpacyEntity {
+ pub text: String,
+ pub label: String,
+ #[serde(default)]
+ pub start: u32,
+ #[serde(default)]
+ pub end: u32,
+}
+
+/// The spaCy server's extraction result.
+#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
+pub struct SpacyResponse {
+ #[serde(default)]
+ pub entities: Vec<SpacyEntity>,
+ #[serde(default)]
+ pub nouns: Vec<String>,
+}
pub async fn extract(config: &Config, text: &str) -> Result<SpacyResponse> {
super::server::request_spacy_extract(config, text).await