Skip to content
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

models._ensure doesnt allow for reuse of same key across different skills #2282

Open
0xArdi opened this issue Nov 21, 2024 · 0 comments
Open
Labels
core-packages Related to core packages enhancement New feature or request

Comments

@0xArdi
Copy link
Collaborator

0xArdi commented Nov 21, 2024

The same param currently cannot be shared in different skills.

def _ensure(cls, key: str, kwargs: Dict, type_: Any) -> Any:
"""Get and ensure the configuration field is not None (if no default is provided) and of correct type."""
enforce("skill_context" in kwargs, "Only use on models!")
skill_id = kwargs["skill_context"].skill_id
enforce(
key in kwargs,
f"'{key}' of type '{type_}' required, but it is not set in `models.params.args` of `skill.yaml` of `{skill_id}`",
)
value = kwargs.pop(key)
try:
check_type(key, value, type_)
except TypeError: # pragma: nocover
enforce(
False,
f"'{key}' must be a {type_}, but type {type(value)} was found in `models.params.args` of `skill.yaml` of `{skill_id}`",
)
return value

@0xArdi 0xArdi added enhancement New feature or request core-packages Related to core packages labels Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-packages Related to core packages enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant