Skip to content

armgit / uzu

Public Imported from GitHub
0

A high-performance inference engine for AI models

fix regex syntax differenceis fix traces loading

Aleksei Savin98d562d5428b
diff --git a/crates/uzu/src/session/helpers/output_parser.rs b/crates/uzu/src/session/helpers/output_parser.rs
index 303fd9662..42a9ab88d 100644
--- a/crates/uzu/src/session/helpers/output_parser.rs
+++ b/crates/uzu/src/session/helpers/output_parser.rs
@@ -10,6 +10,7 @@ impl OutputParser {
pub fn new(regex_str: Option<String>) -> Result<Self, Error> {
let regex = match regex_str {
Some(regex_str) => {
+ let regex_str = Self::preprocess_regex_string(regex_str);
let re = RegexBuilder::new(&regex_str)
.dot_matches_new_line(true)
.build()
@@ -57,3 +58,17 @@ impl OutputParser {
}
}
}
+
+impl OutputParser {
+ // Needed because of differences in regex syntax between Python and Rust
+ fn preprocess_regex_string(regex_str: String) -> String {
+ let mut result = regex_str.clone();
+
+ // Replace trailing \Z with \z
+ if let Some(prefix) = result.strip_suffix("\\Z") {
+ result = format!("{}\\z", prefix);
+ }
+
+ result
+ }
+}
diff --git a/scripts/tools/main.py b/scripts/tools/main.py
index 5f5587580..f67d29ed5 100644
--- a/scripts/tools/main.py
+++ b/scripts/tools/main.py
@@ -39,7 +39,7 @@ def get_uzu_version() -> str:
def load_registry() -> Registry:
- url = f"https://sdk.trymirai.com/api/v1/models/list/uzu/{get_uzu_version()}"
+ url = f"https://sdk.trymirai.com/api/v1/models/list/uzu/{get_uzu_version()}?includeTraces=true"
response = requests.get(url)
response.raise_for_status()
data = response.json()