diff --git a/.dockerignore b/.dockerignore
index e346f21..9facfd9 100644
--- a/.dockerignore
+++ b/.dockerignore
@@ -1,2 +1,4 @@
-.env
-./model/
\ No newline at end of file
+.env
+./model/
+**/target/
+**/Cargo.lock
\ No newline at end of file
diff --git a/Dockerfile b/Dockerfile
index 92681cd..aafccaf 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -89,4 +89,4 @@ RUN echo 'source /root/sia/scripts/add_venvs_to_path.sh' >> /etc/profile
WORKDIR /root/desktop
ENTRYPOINT ["/bin/bash", "-c"]
-CMD ["/root/sia/scripts/install.sh; /bin/bash -c /root/sia/scripts/restart.sh"]
+CMD ["/root/sia/scripts/install.sh; /bin/bash -lc /root/sia/scripts/restart.sh"]
\ No newline at end of file
diff --git a/lib/xml_schema_validator/.dockerignore b/lib/xml_schema_validator/.dockerignore
deleted file mode 100644
index 2630b86..0000000
--- a/lib/xml_schema_validator/.dockerignore
+++ /dev/null
@@ -1,2 +0,0 @@
-target/
-Cargo.lock
\ No newline at end of file
diff --git a/lib/xml_schema_validator/Cargo.toml b/lib/xml_schema_validator/Cargo.toml
index 4cf4733..6ba8f0b 100644
--- a/lib/xml_schema_validator/Cargo.toml
+++ b/lib/xml_schema_validator/Cargo.toml
@@ -10,11 +10,7 @@ name = "xml_schema_validator"
crate-type = ["cdylib", "rlib"]
[dependencies]
-numpy = "0.24"
pyo3 = { version = "0.24", features = ["extension-module"] }
quick-xml = { version = "0.28.1", features = ["serde", "serialize"] }
serde = { version = "1", features = ["derive"] }
-thiserror = "1.0.38"
-
-[build-dependencies]
-xml_schema_generator = { version = "0.6.18", features = ["env_logger"] }
\ No newline at end of file
+thiserror = "1.0.38"
\ No newline at end of file
diff --git a/lib/xml_schema_validator/pyproject.toml b/lib/xml_schema_validator/pyproject.toml
index 7587057..3026f43 100644
--- a/lib/xml_schema_validator/pyproject.toml
+++ b/lib/xml_schema_validator/pyproject.toml
@@ -1,13 +1,16 @@
-[build-system]
-requires = ["maturin>=1.0,<2.0"]
-build-backend = "maturin"
-
[project]
name = "xml_schema_validator"
version = "0.1.0"
description = "XML Schema validation library"
requires-python = ">=3.10"
-dependencies = []
+dependencies = [
+ "pytest>=8",
+ "maturin>=1.0,<2.0",
+]
+
+[build-system]
+requires = ["maturin>=1.0,<2.0"]
+build-backend = "maturin"
[tool.maturin]
features = ["pyo3/extension-module"]
diff --git a/lib/xml_schema_validator/src/lib.rs b/lib/xml_schema_validator/src/lib.rs
index 7af247e..1c697ea 100644
--- a/lib/xml_schema_validator/src/lib.rs
+++ b/lib/xml_schema_validator/src/lib.rs
@@ -4,8 +4,9 @@
//! A streaming XML validator that checks XML fragments against an XSD schema
mod error;
-mod logits_processor;
mod python;
+mod py_xml_logits_processor_core;
+mod py_xml_schema_validator;
mod schema;
mod token;
@@ -48,6 +49,11 @@ impl XmlSchemaValidator {
Ok(())
}
+ /// Check if the validator has reached the end of the XML
+ pub fn eof(&self) -> bool {
+ self.current_tokens.is_empty() || self.current_tokens.iter().all(Token::is_eof)
+ }
+
/// Append a single character to the validator
fn append_char(&mut self, c: char) -> Result<()> {
let mut new_tokens = vec![];
diff --git a/lib/xml_schema_validator/src/logits_processor.rs b/lib/xml_schema_validator/src/logits_processor.rs
deleted file mode 100644
index 7bf684c..0000000
--- a/lib/xml_schema_validator/src/logits_processor.rs
+++ /dev/null
@@ -1,174 +0,0 @@
-use pyo3::prelude::*;
-use pyo3::types::{PyDict, PyString};
-use pyo3::exceptions::PyValueError;
-use std::sync::RwLock;
-
-/// A minimal LogitsProcessor that enforces valid XML according to a schema.
-#[pyclass]
-pub struct XmlLogitsProcessor {
- /// The Python tokenizer object
- tokenizer: PyObject,
- /// The schema text to validate against
- schema_text: String,
- /// The prompt length (for tracking generated vs. prompt tokens)
- prompt_length: RwLock