-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v1.0.0rc1 #388
Conversation
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
…380) Bumps the deps group with 17 updates in the / directory: | Package | From | To | | --- | --- | --- | | [pydantic](https://github.com/pydantic/pydantic) | `2.7.4` | `2.8.2` | | [ydb](https://github.com/ydb-platform/ydb-python-sdk) | `3.12.3` | `3.15.0` | | [altair](https://github.com/vega/altair) | `5.3.0` | `5.4.0` | | [pympler](https://github.com/pympler/pympler) | `1.0.1` | `1.1` | | [humanize](https://github.com/python-humanize/humanize) | `4.9.0` | `4.10.0` | | [cryptography](https://github.com/pyca/cryptography) | `42.0.8` | `43.0.0` | | [python-telegram-bot](https://github.com/python-telegram-bot/python-telegram-bot) | `21.3` | `21.4` | | [opentelemetry-exporter-otlp](https://github.com/open-telemetry/opentelemetry-python) | `1.25.0` | `1.26.0` | | [black](https://github.com/psf/black) | `24.4.2` | `24.8.0` | | [mypy](https://github.com/python/mypy) | `1.10.1` | `1.11.1` | | [pytest](https://github.com/pytest-dev/pytest) | `8.2.2` | `8.3.2` | | [coverage](https://github.com/nedbat/coveragepy) | `7.5.4` | `7.6.1` | | [jsonschema](https://github.com/python-jsonschema/jsonschema) | `4.22.0` | `4.23.0` | | [python-on-whales](https://github.com/gabrieldemarmiesse/python-on-whales) | `0.71.0` | `0.72.0` | | [fastapi](https://github.com/fastapi/fastapi) | `0.111.0` | `0.112.0` | | [streamlit](https://github.com/streamlit/streamlit) | `1.36.0` | `1.37.1` | | [sphinx-gallery](https://github.com/sphinx-gallery/sphinx-gallery) | `0.16.0` | `0.17.1` | Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
# Description: - TLDR: All classes in /chatsky/pipeline/ are rewritten in Pydantic, some changes to class hierarchy and the classes themselves. Changed tutorials with regards to new class signatures. - Classes `PipelineComponent`, `Pipeline` and `ComponentExtraHandler` are now subclasses of Pydantic's `BaseModel`, massively reducing code bloat in their initialization and that of their children (such as `Service`). - Also, classes `Service`, `ServiceGroup` and `Actor` are now subclasses of `PipelineComponent`. No functionality is removed in `ServiceGroup`. All tutorials and tests pass like before, with a few changes. - Reasoning for changing class hierarchy: Before this, an instance of `Actor` would be called from within a `Service` with a special flag, which seemed like a workaround, and now it can be called directly as an instance of `PipelineComponent`, instead of heavily relying on the `Service` class. You could say that this slightly reduces the code's complexity. In fact, it also binds `Actor` to `PipelineComponent`, instead of it being independent, making code look more cohesive. - TypeBuilders have been removed, because Pydantic can already deal with them effectively, giving type hints for IDE like before. Different input types are still handled like before, except nested `Service` declaration is removed. (`Service` class doesn't accept `Service` as it's handler anymore) Same with nested `ComponentExtraHandler`s. - For some reason Extra Handlers in `Service`s would work even if the Service itself was turned off via `start_condition`. That was a bug. Now this condition is checked in `PipelineComponent` instead. I assume `Actor` must always have it as True. # Checklist - [x] Removed `from_script()` and other redundant methods. - [x] Changed `components` into `pre-services` and `post-services` throughout tutorials. (at `Pipeline` initialization) - [x] Got tests to pass. - [x] I have performed a self-review of the changes - [x] Updated Pipeline's API and tutorials # To Consider - Add more tests if necessary - Update the remaining API reference / tutorials / guides - Search for more references to changed entities in the codebase --------- Co-authored-by: Roman Zlobin <[email protected]>
# Description ## Breaking Changes - All conditions (standard and slot) moved to `chatsky.conditions` - All labels (standard) moved to `chatsky.destinations` - All processing functions (slot) moved to `chatsky.processing` - All responses (standard and slot) moved to `chatsky.responses` - All conditions, destinations, processing functions, responses are now upper camel case - `script.core` module moved to `chatsky.core` - `Pipeline` moved to `chatsky.core` - `pipeline.service` submodule moved to `chatsky.core.service` - Added class `Transition`. `TRANSITIONS` is now a list of such objects instead of a dict. Destination, condition and priority are all fields of this class. Priority is now separate from node label - Removed `cnd.true` and `cnd.false`. Condition field of `Transition` now accepts `True` and `False` literals. If condition field of `Transition` is not set, it defaults to `True`. - Removed `lbl.repeat` renamed to `dst.Current`. Added `dst.FromHistory` to get labels from history past `dst.Previous`. - Custom script functions now have to be subclassed from `BaseScriptFunction`. e.g. custom response function now have to be subclassed from `BaseResponse`. - All keywords from `chatsky.script.core.keywords` moved to `chatsky.core.script` - `PRE_TRANSITIONS_PROCESSING` renamed to `PRE_TRANSITION` - `PRE_RESPONSE_PROCESSING` renamed to `PRE_RESPONSE` - Removed `chatsky.utils.turn_caching` - Turn id `0` is now reserved for start label. Actual turns start at id 1. Context has method `init` to init from a start label ## Features - `RESPONSE` can now be a string. It will be converted to `Message(text=)` automatically - Custom functions do validation (e.g. response function can now return a string and it will be cast to `Message`) - Current instance of `Pipeline` can now be accessed via `Context.pipeline` - Added `NodeLabel` class to replace tuple node labels - The order of global/local transition inheritance for `ctx.current_node` is now reversed (`[*node, *local, *global]` instead of `[*global, *local, *node]`) to reflect the inheritance priority order (node>local>global) - Added method `Script.get_inherited_node` to get a node that inherits global and local properties. `ctx.current_node` is obtained via this method - Renamed response_comparer of `check_happy_path` to response_comparator, removed default comparators, removed context from signature; messages in `happy_path` can now be any of `Message`, `dict`, `str`; `printout_enable` flag renamed to `printout` and made `False` by default. ## Fixes - Slot template filling now works for numerical slot names (e.g. `slot_name="0"`) - Slot Groups can now be initialized from a dictionary - Exceptions in user functions are now properly handled: - response errors result in an empty message - processing errors are ignored - transition errors mark that specific transition as failed ## Documentation - Some improvements to basic conceptions user guide and global tutorial - Added a tip on getting previous nodes to pre transition tutorial - Removed `responses.1_basics` tutorial - Slight improvements to web api interface tutorials ## Devel - Added `log_event_catcher` fixture to help test captured logs - Added `TYPE_CHECKING` exclude from coverage; now only certain exception raises are excluded from coverage - Removed `run_interactive_mode`. Just use `pipeline.run()`. - Removed Annotated values with pickle serializer/validators. Better to use field_validators/field_serializers to preserve model schema - Added `InitTypes` for various BaseModels to indicate types that can be validated into that model - `Actor` now doesn't have any parameters - `normalization` utils replaced with pydantic validators - An instance of `Script` can now be validated from a script dict (without the `script` field) - Removed `Context.cast`. Use `model_validate` and `model_validate_json` instead.
# Description Added option to initialize Pipeline from yaml/json files. ## Changelog ### Breaking changes - Removed `proc.ExtractAll` -- the function is unsafe as it overwrites the entire slot storage. it is still available as method of the slot manager ### Features - Add Pipeline from file import - Add function that creates an index of commonly-used Chatsky objects - Added imports to some `__init__` files - Allow initializing NodeLabel from a list of two strings ### Bug fixes - Slot extraction will now not write the value to the slot storage if value was not successfully extracted. Can be changed via the `success_only` flag ### Devel - Add aliases to script keywords # Checklist - [x] I have performed a self-review of the changes # To Consider - Add tests (if functionality is changed) - Update API reference / tutorials / guides - Update CONTRIBUTING.md (if devel workflow is changed) - Update `.ignore` files, scripts (such as `lint`), distribution manifest (if files are added/deleted) - Search for references to changed entities in the codebase --------- Co-authored-by: Ramimashkouk <[email protected]> Co-authored-by: Ramimashkouk <[email protected]>
# Description Now dictionaries are merged in a way that localized processing functions are called first. (node > local > global) # Checklist - [x] I have performed a self-review of the changes *List here tasks to complete in order to mark this PR as ready for review.* # To Consider - Add tests (if functionality is changed) - Update API reference / tutorials / guides - Update CONTRIBUTING.md (if devel workflow is changed) - Update `.ignore` files, scripts (such as `lint`), distribution manifest (if files are added/deleted) - Search for references to changed entities in the codebase
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appears this PR is a release PR (change its base from master
if that is not the case).
Here's a release checklist:
- Update package version
- Update
poetry.lock
- Change PR merge option
- Update template repo
- Search for objects to be deprecated
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.
Changelog
This release includes a huge rework of core library features.
It is highly recommended to reread documentation relating to scripting.
(basic concepts user guide; script and pipeline tutorials)
Breaking Changes
Pipeline.from_script
. Use__init__
instead (Pydantic improvements #372)chatsky.conditions
(Feat/core rework #381)chatsky.destinations
(Feat/core rework #381)chatsky.processing
(Feat/core rework #381)chatsky.responses
(Feat/core rework #381)script.core
module moved tochatsky.core
(Feat/core rework #381)Pipeline
moved tochatsky.core
(Feat/core rework #381)pipeline.service
submodule moved tochatsky.core.service
(Feat/core rework #381)Transition
.TRANSITIONS
is now a list of such objects instead of a dict.Destination, condition and priority are all fields of this class. Priority is now separate from node label (Feat/core rework #381)
cnd.true
andcnd.false
. Condition field ofTransition
now acceptsTrue
andFalse
literals.If condition field of
Transition
is not set, it defaults toTrue
. (Feat/core rework #381)lbl.repeat
renamed todst.Current
. Addeddst.FromHistory
to get labels from history pastdst.Previous
. (Feat/core rework #381)BaseScriptFunction
.e.g. custom response function now have to be subclassed from
BaseResponse
. (Feat/core rework #381)chatsky.script.core.keywords
moved tochatsky.core.script
(Feat/core rework #381)PRE_TRANSITIONS_PROCESSING
renamed toPRE_TRANSITION
(Feat/core rework #381)PRE_RESPONSE_PROCESSING
renamed toPRE_RESPONSE
(Feat/core rework #381)chatsky.utils.turn_caching
(Feat/core rework #381)0
is now reserved for start label. Actual turns start at id 1.Context has method
init
to init from a start label (Feat/core rework #381)proc.ExtractAll
-- the function is unsafe as it overwrites the entire slot storage. it is still available as method of the slot manager (Feat/script parser #385)Features
RESPONSE
can now be a string. It will be converted toMessage(text=)
automatically (Feat/core rework #381)Message
) (Feat/core rework #381)Pipeline
can now be accessed viaContext.pipeline
(Feat/core rework #381)NodeLabel
class to replace tuple node labels (Feat/core rework #381)Script.get_inherited_node
to get a node that inherits global and local properties.ctx.current_node
is obtained via this method (Feat/core rework #381)check_happy_path
to response_comparator, removed default comparators, removed context from signature;messages in
happy_path
can now be any ofMessage
,dict
,str
;printout_enable
flag renamed toprintout
and madeFalse
by default. (Feat/core rework #381)ModifyResponse
base processing class which allows modifying current node response. (Feat/core rework #381)Fixes
slot_name="0"
) (Feat/core rework #381)success_only
flag (Feat/script parser #385)Documentation
responses.1_basics
tutorial (Feat/core rework #381)Devel
Pipeline
and all its components are nowBaseModel
s (Pydantic improvements #372)log_event_catcher
fixture to help test captured logs (Feat/core rework #381)TYPE_CHECKING
exclude from coverage; now only certain exception raises are excluded from coverage (Feat/core rework #381)run_interactive_mode
. Just usepipeline.run()
. (Feat/core rework #381)InitTypes
for various BaseModels to indicate types that can be validated into that model (Feat/core rework #381)Actor
now doesn't have any parameters (Feat/core rework #381)normalization
utils replaced with pydantic validators (Feat/core rework #381)Script
can now be validated from a script dict (without thescript
field) (Feat/core rework #381)Context.cast
. Usemodel_validate
andmodel_validate_json
instead. (Feat/core rework #381)