Skip to content

Delete prompts_path argument and use prompt_templates #541

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

Merged
merged 10 commits into from
Feb 7, 2025

Conversation

albertvillanova
Copy link
Member

@albertvillanova albertvillanova commented Feb 7, 2025

EDIT:
Remove unused prompts_path argument and use prompt_templates instead.

EDIT:
Use prompt_path argument, previously introduced but not used.

Remove unused prompts_path argument.

This argument was introduced (but not used) in:

Or maybe you wanted to use it somehow? @aymeric-roucher

@albertvillanova albertvillanova changed the title Remove unused prompts_path agent argument Use prompt_path agent argument Feb 7, 2025
@aymeric-roucher
Copy link
Contributor

@albertvillanova the "s" in prompts_path is intentional, because there are many prompts in the prompt_templates dictionary.

@albertvillanova
Copy link
Member Author

I need to resolve the conflicts after having merged:

I aligned the singular name with prompt_templates, which also contains many prompts. I think in English, if a noun acts as an adjective, it should be normally in singular.

@albertvillanova
Copy link
Member Author

albertvillanova commented Feb 7, 2025

What about both in plural (for explicit clarity)?

  • prompts_path
  • prompts_templates

@albertvillanova albertvillanova changed the title Use prompt_path agent argument Delete prompts_path argument and use prompt_templates Feb 7, 2025
@albertvillanova
Copy link
Member Author

Finally:

  • Remove unused prompts_path
  • Use prompt_templates instead (more user-friendly)

@@ -779,10 +780,13 @@ def __init__(
):
self.additional_authorized_imports = additional_authorized_imports if additional_authorized_imports else []
self.authorized_imports = list(set(BASE_BUILTIN_MODULES) | set(self.additional_authorized_imports))
self.prompt_templates = yaml.safe_load(importlib.resources.read_text("smolagents.prompts", "code_agent.yaml"))
prompt_templates = prompt_templates or yaml.safe_load(
Copy link
Contributor

Choose a reason for hiding this comment

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

Love this, really clean!

@albertvillanova albertvillanova merged commit ecabb9e into huggingface:main Feb 7, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants