-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
<!-- ELLIPSIS_HIDDEN --> > [!IMPORTANT] > Fix import and definition of `BamlValidationError` by moving it to `internal_monkeypatch.py` and updating related imports and Rust code. > > - **Imports and Definitions**: > - Move `BamlValidationError` definition to `internal_monkeypatch.py`. > - Update import of `BamlValidationError` in `errors.py`. > - **File Deletions**: > - Remove `errors.pyi` as it is no longer needed. > - **Rust Code Adjustments**: > - Modify `raise_baml_validation_error` in `errors.rs` to import `BamlValidationError` from `internal_monkeypatch.py`. > - Remove manual definition of `BamlValidationError` in `errors.rs`. > > <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=BoundaryML%2Fbaml&utm_source=github&utm_medium=referral)<sup> for 17fd482. It will automatically update as commits are pushed.</sup> <!-- ELLIPSIS_HIDDEN -->
- Loading branch information
Showing
5 changed files
with
27 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 0 additions & 26 deletions
26
engine/language_client_python/python_src/baml_py/errors.pyi
This file was deleted.
Oops, something went wrong.
18 changes: 18 additions & 0 deletions
18
engine/language_client_python/python_src/baml_py/internal_monkeypatch.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
from .baml_py import BamlError | ||
|
||
|
||
# Define the BamlValidationError exception with additional fields | ||
# note on custom exceptions https://github.com/PyO3/pyo3/issues/295 | ||
# can't use extends=PyException yet https://github.com/PyO3/pyo3/discussions/3838 | ||
class BamlValidationError(BamlError): | ||
def __init__(self, prompt: str, message: str, raw_output: str): | ||
super().__init__(message) | ||
self.prompt = prompt | ||
self.message = message | ||
self.raw_output = raw_output | ||
|
||
def __str__(self): | ||
return f"BamlValidationError(message={self.message}, raw_output={self.raw_output}, prompt={self.prompt})" | ||
|
||
def __repr__(self): | ||
return f"BamlValidationError(message={self.message}, raw_output={self.raw_output}, prompt={self.prompt})" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters