Open
Conversation
…t with an f-string, moved derivative slots into a different file
… changed some imports
…across the codebase (to the new file structure)
…new slots' file structure)
…mportPipeline tests all pass
…_format into string_format
…e, finished the RegexpGroupSlot test, fixed a weird Pydantic inheritance issue
…resentation in ExtractedGroupSlot (SlotManager already does that, so I replicated that for coherence)
…ge needs to be reviewed
…t, test#3 tweaked(SlotEqualsValue) ), added SlotEqualsValue condition to existing tutorial
…tionary doesn't request a capture group that's out of bounds)
…is being worked on
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.
Description
Refactored and added some features for existing
Slotsand a new type of slot -RegexpGroupSlot, which reuses oneregex.search()call to save on execution time in specific cases like LLM, where the amount ofget_value()calls is important. Also more minor changes like adding a new condition -SlotEqualsValue.Changes relevant for the user:
SlotEqualsValuecondition to check that a slot is equal to some value.RegexpGroupSlotclass. (e.g. (regexp=regexp, groups={"date": 1, "month": 2, "year": 3}) would yieldValueSlots with the respective numbers meaning the number of the group that was found with this regular expression) A better explanation can be found in the tutorials.string_formatorallow_partial_extraction. A special exception will be raised in such cases.string_formatparameter, which makes it'sExtractedGroupSlot's__str__representationformatted with extracted slot values being the keywords. (e.g. "{date}.{month}.{year}" is the value of a birthday group slot instead of "{'date': ..., 'month': ..., 'year': ...}") Almost the same asfill_templatefunction inSlotManagerclass, except this doesn't catch exceptions. A better explanation will be provided in the tutorials.success_onlytosave_on_failure.Changes in the codebase (or others):
_flatten_group_slotmethod (for now a copy offlatten_llm_group_slotin LLM Slots PR), unpacks aGroupSlots nestedSlotsinto a single dictionary.SlotManageris in slot_manager.pyChecklist
To Consider
_flatten_group_slot(), there isn't one right now..ignorefiles, scripts (such aslint), distribution manifest (if files are added/deleted)