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

Code RolePlaying example #211

Merged
merged 4 commits into from
Jul 10, 2023
Merged

Code RolePlaying example #211

merged 4 commits into from
Jul 10, 2023

Conversation

lightaime
Copy link
Member

Description

Add an example of using RolePlaying for Code task.

Types of changes

What types of changes does your code introduce? Put an x in all the boxes that apply:

  • Example (update in the folder of example)

Checklist

Go over all the following points, and put an x in all the boxes that apply.
If you are unsure about any of these, don't hesitate to ask. We are here to help!

@lightaime lightaime self-assigned this Jul 9, 2023
@lightaime lightaime requested a review from Obs01ete July 9, 2023 01:02
@lightaime lightaime mentioned this pull request Jul 9, 2023
1 task
domain = "Sociology"
meta_dict = {"language": language, "domain": domain}
role_play_session = RolePlaying(
f"{language} Programmer",
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think this in-place prompt engineering should not be here. The cool thing about camel is that it incapsulate all the prompts. So the external API can only enter the parameters and all the prompt engineering happens behind the API. This is for the future rework.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good

language = "JavaScript"
domain = "Sociology"
meta_dict = {"language": language, "domain": domain}
role_play_session = RolePlaying(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for the example. I will update the code for Agents accordingly.

Copy link
Member Author

Choose a reason for hiding this comment

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

Cool

from camel.utils import print_text_animated


def main(model_type=None) -> None:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's also put main into tests/CI since you have it parametrized

Copy link
Member Author

Choose a reason for hiding this comment

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

Added

with_task_specify=True,
model_type=model_type,
task_type=TaskType.CODE,
extend_sys_msg_meta_dicts=[meta_dict, meta_dict],
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is too complicated as an API. Very unintuitive. We need to segregate prompt engineering of AI society and Code from the dialogue algorithm of RolePlaying. I would create an instance of RolePair into the constructor of RolePlaying. AISocietyRoles and CodeRoles are the concrete classes inherited from RolePair. TDYT @lightaime

Copy link
Collaborator

Choose a reason for hiding this comment

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

This is the right place to apply dependency inversion to disentangle {AISocietyRoles and CodeRoles} from RolePlaying via the interface RolePair.

Copy link
Member Author

Choose a reason for hiding this comment

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

RolePair may not be accurate. They are the keywords in the prompts.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry, I do not understand your point

@lightaime lightaime requested a review from Obs01ete July 10, 2023 13:44
Copy link
Collaborator

@Obs01ete Obs01ete left a comment

Choose a reason for hiding this comment

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

All good

@lightaime lightaime merged commit f60e17d into master Jul 10, 2023
9 checks passed
@lightaime lightaime deleted the code_role_play_example branch July 10, 2023 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants