-
Notifications
You must be signed in to change notification settings - Fork 681
FEAT: Scientific Translation Converter #1379
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
base: main
Are you sure you want to change the base?
Changes from all commits
fcb33a8
501c1b2
30349f1
ef716a9
e8d15aa
97cfad5
863125e
4760410
32bb290
a24a3b2
44f9327
1de2e16
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,32 @@ | ||||||
| name: scientific_translation_converter_academic_mode | ||||||
| description: | | ||||||
| Converts prompts into an academic mode (ie homework/exam style questioning) | ||||||
| authors: Bolor Jagdagdorj | ||||||
|
||||||
| authors: Bolor Jagdagdorj | |
| authors: ["Bolor Jagdagdorj"] |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,22 @@ | ||||||
| name: scientific_translation_converter_combined_mode | ||||||
| description: | | ||||||
| Converts prompts into a complex scientific language mode that combines elements of academic, research, chemical notation, and reaction mechanism styles | ||||||
| authors: Bolor Jagdagdorj | ||||||
|
||||||
| authors: Bolor Jagdagdorj | |
| authors: ['Bolor Jagdagdorj'] |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,28 @@ | ||||||
| name: scientific_translation_converter_math_mode | ||||||
| description: | | ||||||
| Converts prompts into a math mode (ie math word problem for homework/exam style questioning) | ||||||
| authors: Bolor Jagdagdorj | ||||||
|
||||||
| authors: Bolor Jagdagdorj | |
| authors: ["Bolor Jagdagdorj"] |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,22 @@ | ||||||
| name: scientific_translation_converter_reaction_mode | ||||||
| description: | | ||||||
| Converts prompts into a reaction mechanism mode (ie using step-by-step mechanisms) | ||||||
| authors: Bolor Jagdagdorj | ||||||
|
||||||
| authors: Bolor Jagdagdorj | |
| authors: ['Bolor Jagdagdorj'] |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,23 @@ | ||||||
| name: scientific_translation_converter_research_mode | ||||||
| description: | | ||||||
| Converts prompts into a research question or hypothesis mode (ie using scientific research framing) | ||||||
| authors: Bolor Jagdagdorj | ||||||
|
||||||
| authors: Bolor Jagdagdorj | |
| authors: ["Bolor Jagdagdorj"] |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,24 @@ | ||||||
| name: scientific_translation_converter_smiles_mode | ||||||
| description: | | ||||||
| Converts prompts into a SMILES/chemical notation mode (ie using chemical notation and formulas) | ||||||
| authors: Bolor Jagdagdorj | ||||||
|
||||||
| authors: Bolor Jagdagdorj | |
| authors: ["Bolor Jagdagdorj"] |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,23 @@ | ||||||
| name: scientific_translation_converter_technical_mode | ||||||
| description: | | ||||||
| Converts prompts into a technical mode (ie using scientific/technical language) | ||||||
| authors: Bolor Jagdagdorj | ||||||
|
||||||
| authors: Bolor Jagdagdorj | |
| authors: ['Bolor Jagdagdorj'] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -189,8 +189,11 @@ def render_template_value_silent(self, **kwargs: Any) -> str: | |
| # Check if all parameters in control structures are provided | ||
| # Extract variable names from {% for var in collection %} patterns | ||
| for_vars = re.findall(r"\{%[-\s]*for\s+\w+\s+in\s+(\w+)", self.value) | ||
| if any(var not in kwargs for var in for_vars): | ||
| # Don't render if we're missing loop collection variables - preserve the template as-is | ||
| # Extract variable names from {% if var ... %} and {% elif var ... %} patterns | ||
| if_vars = re.findall(r"\{%[-\s]*(?:el)?if\s+(\w+)", self.value) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than parsing here and having one yaml, is it possible to have multiple yamls each for the mode and then we can leave the seed.py untouched (I'm assuming this parsing is specific to this converter which I would prefer not to do since seed is a generic data structure) and redirect to the corresponding yaml based on the mode in the scientific_translation_converter.py |
||
| control_vars = set(for_vars + if_vars) | ||
| if any(var not in kwargs for var in control_vars): | ||
| # Don't render if we're missing control structure variables - preserve the template as-is | ||
|
Comment on lines
+192
to
+196
|
||
| return self.value | ||
|
|
||
| # Create a Jinja template with PartialUndefined placeholders | ||
|
|
||
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.
The API autosummary lists
ScientificObfuscationConverter, but the converter added/exported in this PR isScientificTranslationConverter(and there is noScientificObfuscationConverterin the codebase). This will break docs generation and mislead users; update the autosummary entry to the correct class name.