Merged
Conversation
- Updated test cases in `test_safe.py` to utilize the `safe` context manager for uncertainty control, replacing the previous decorator approach. - Introduced a new `ReproducibleSettings` class and `ReproducibleContextManager` to manage uncertainty settings in a context-aware manner. - Added a comprehensive set of error classes in `errors.py` to handle various exceptions related to requests and uncertainty. - Implemented core uncertainty calculation functions in `uncertainty.py`, including methods for calculating certainty scores and posterior probabilities. - Created a `max_uncertainty` decorator in `decorators.py` to allow users to configure uncertainty handling easily. - Ensured that all relevant functions now properly track and report uncertainty, improving the robustness of the uncertainty estimation process.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces several improvements and new features to the codebase, focusing on enhanced uncertainty handling, improvements to enum probability inspection, and new abstractions for guarded types. The changes also include utility and API enhancements for better developer ergonomics and more robust type handling.
Uncertainty Handling and Enum Probability Inspection:
max_uncertainty,safe, andUncertaintyError, as well asprint_last_probability_distributionandprint_last_uncertaintyfor inspecting model output probabilities and uncertainties. (src/OpenHosta/__init__.py[1] [2] [3];src/OpenHosta/core/logger.py[4]next/enum_probs.py, including a new example using aYearenum and demonstration of the new uncertainty utilities. (next/enum_probs.pynext/enum_probs.pyL6-R103)Type Handling and MetaPrompt Improvements:
Noneas a valid return value in union types, including stricter checks and improved error messages. (src/OpenHosta/core/type_converter.py[1] [2]src/OpenHosta/core/meta_prompt.py[1];src/OpenHosta/core/analizer.py[2]src/OpenHosta/core/type_converter.pysrc/OpenHosta/core/type_converter.pyL185-R204)Guard and Guarded Types Abstraction:
Guardedabstract base class and related classes (GuardedInt,NonToxicComment,SafeComment, etc.) to enforce validation logic on value types, supporting composable and multi-guard scenarios. (next/guards_as_an_object.pynext/guards_as_an_object.pyR133-R251)emulate. (next/guards_as_an_object.pynext/guards_as_an_object.pyR133-R251)General Utility and Imports:
next/guards_as_an_object.py[1];src/OpenHosta/core/analizer.py[2];src/OpenHosta/core/type_converter.py[3]next/agents.pynext/agents.pyR30-R39)These changes collectively improve the framework's ability to reason about uncertainty, handle complex types, and enforce data validity, while also enhancing the developer experience.