Skip to content

Conversation

@ctiliescuuipath
Copy link

No description provided.

@github-actions github-actions bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-llamaindex Triggers tests in the uipath-llamaindex-python repository labels Nov 19, 2025
@ctiliescuuipath ctiliescuuipath force-pushed the feat/custom_guardrails branch 2 times, most recently from 7f02b34 to e8ce7af Compare November 19, 2025 15:21
@ctiliescuuipath ctiliescuuipath force-pushed the feat/custom_guardrails branch 2 times, most recently from dbdf973 to fbf9514 Compare December 8, 2025 09:57
IS_NOT_EMPTY = "isNotEmpty"
MATCHES_REGEX = "matchesRegex"
STARTS_WITH = "startsWith"
FUNC = "func"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need this operator type? I agree with the function for evaluation, but I challenge the FUNC operator type.

except Exception:
# If function raises an exception, treat as failure
passed = False
elif rule.operator == NumberOperator.EQUALS:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I propose we only keep the func evaluation. It is more flexible and we can easily convert all the statis operators into funcs during the conversion (when we create the guardrails from their definitions).

I think we can even have one single function like:
def evaluate_rule( rule_func, input_data, output_data ) -> tuple[bool, str | None]

return True, "All number rule validations passed"


def evaluate_boolean_rule(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it work to have a single function to evaluate word|number|boolean rules?

)

@traced("evaluate_pre_custom_guardrails", run_type="uipath")
def evaluate_pre_custom_guardrails(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use singular -> evaluate_pre_custom_guardrail. Same for the below functions too.


DOES_NOT_EQUAL = "doesNotEqual"
EQUALS = "equals"
FUNC = "func"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we still need this?

Field(discriminator="rule_type"),
]

AgentRule = Annotated[
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All types prefixed by Agent should stay in agent.py file.

model_config = ConfigDict(populate_by_name=True, extra="allow")


class LowCodeCustomGuardrail(BaseGuardrail):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have a AgentCustomGuardrails model. Why not updating that one with the new types?

"Guardrail",
"BuiltInValidatorGuardrail",
"CustomGuardrail",
"LowCodeCustomGuardrail",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't expose these here. They are agent related.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-llamaindex Triggers tests in the uipath-llamaindex-python repository

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants