This commit is contained in:
Scott Lessans 2025-08-05 11:48:26 -07:00
parent 6375a15ea1
commit ff28a9ed87
2 changed files with 2 additions and 13 deletions

View file

@ -12,9 +12,6 @@
//! A thin, typed, user-facing Python wrapper around these low-level bindings is //! A thin, typed, user-facing Python wrapper around these low-level bindings is
//! provided in `harmony/__init__.py`. //! provided in `harmony/__init__.py`.
// Only compile when the `python-binding` feature is enabled.
#![cfg(feature = "python-binding")]
use pyo3::prelude::*; use pyo3::prelude::*;
// We need the `Python` type later on. // We need the `Python` type later on.
@ -34,8 +31,6 @@ use crate::{
load_harmony_encoding, HarmonyEncodingName, load_harmony_encoding, HarmonyEncodingName,
}; };
use serde_json;
/// A thin PyO3 wrapper around the Rust `HarmonyEncoding` struct. /// A thin PyO3 wrapper around the Rust `HarmonyEncoding` struct.
#[pyclass] #[pyclass]
struct PyHarmonyEncoding { struct PyHarmonyEncoding {
@ -393,8 +388,7 @@ fn openai_harmony(_py: Python<'_>, m: &Bound<'_, PyModule>) -> PyResult<()> {
"python" => ToolNamespaceConfig::python(), "python" => ToolNamespaceConfig::python(),
_ => { _ => {
return Err(PyErr::new::<pyo3::exceptions::PyValueError, _>(format!( return Err(PyErr::new::<pyo3::exceptions::PyValueError, _>(format!(
"Unknown tool namespace: {}", "Unknown tool namespace: {tool}"
tool
))); )));
} }
}; };

View file

@ -1,5 +1,3 @@
#![cfg(feature = "wasm-binding")]
use wasm_bindgen::prelude::*; use wasm_bindgen::prelude::*;
use crate::{ use crate::{
@ -9,8 +7,6 @@ use crate::{
}; };
use serde::Deserialize; use serde::Deserialize;
use serde_json;
use serde_wasm_bindgen;
#[wasm_bindgen] #[wasm_bindgen]
extern "C" { extern "C" {
@ -335,8 +331,7 @@ pub fn get_tool_namespace_config(tool: &str) -> Result<JsValue, JsValue> {
"python" => ToolNamespaceConfig::python(), "python" => ToolNamespaceConfig::python(),
_ => { _ => {
return Err(JsValue::from_str(&format!( return Err(JsValue::from_str(&format!(
"Unknown tool namespace: {}", "Unknown tool namespace: {tool}"
tool
))) )))
} }
}; };