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

fix(prompt/mixin): Add name property and add it to saving/loading path. #1853

Merged
merged 4 commits into from
Jan 23, 2025

Conversation

tim-hilde
Copy link
Contributor

This pull request includes several changes to the PromptMixin class in the src/ragas/prompt/mixin.py file. The changes focus on adding a name attribute to the class and using this attribute when saving and loading prompts. This solves the error when saving and loading several prompts of different Synthesizers (e.g. MultiHopAbstractQuerySynthesizer, MultiHopSpecificQuerySynthesizer, SingleHopSpecificQuerySynthesizer etc.) as they had the same path associated:

themes_personas_matching_prompt_english -> single_hop_specifc_query_synthesizer_themes_personas_matching_prompt_english
query_answer_generation_prompt_english -> single_hop_specifc_query_synthesizer_query_answer_generation_prompt_english

Changes to PromptMixin class:

  • Added a name attribute to the PromptMixin class.
  • Modified the save_prompts method to include the name attribute in the prompt file name.
  • Modified the load_prompts method to include the name attribute in the prompt file name.

@dosubot dosubot bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jan 16, 2025
@shahules786 shahules786 requested a review from jjmachan January 21, 2025 19:23
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Jan 22, 2025
src/ragas/prompt/mixin.py Show resolved Hide resolved
@jjmachan
Copy link
Member

I'll merge this in after you have a look at it and approve @tim-hilde

@jjmachan jjmachan merged commit 3597b02 into explodinggradients:main Jan 23, 2025
16 checks passed
sahusiddharth pushed a commit to sahusiddharth/ragas that referenced this pull request Jan 24, 2025
…h. (explodinggradients#1853)

This pull request includes several changes to the `PromptMixin` class in
the `src/ragas/prompt/mixin.py` file. The changes focus on adding a
`name` attribute to the class and using this attribute when saving and
loading prompts. This solves the error when saving and loading several
prompts of different Synthesizers (e.g.
MultiHopAbstractQuerySynthesizer, MultiHopSpecificQuerySynthesizer,
SingleHopSpecificQuerySynthesizer etc.) as they had the same path
associated:

```
themes_personas_matching_prompt_english -> single_hop_specifc_query_synthesizer_themes_personas_matching_prompt_english
query_answer_generation_prompt_english -> single_hop_specifc_query_synthesizer_query_answer_generation_prompt_english
```

### Changes to `PromptMixin` class:

* Added a `name` attribute to the `PromptMixin` class.
* Modified the `save_prompts` method to include the `name` attribute in
the prompt file name.
* Modified the `load_prompts` method to include the `name` attribute in
the prompt file name.

---------

Co-authored-by: jjmachan <[email protected]>
Co-authored-by: Jithin James <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size:S This PR changes 10-29 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants