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 bug in PromptEngine and provide prompt construction strategy for most chat and generation APIs #95

Merged
merged 18 commits into from
Mar 26, 2024

Conversation

DavdGao
Copy link
Collaborator

@DavdGao DavdGao commented Mar 23, 2024

Description

Motivation

  • Support more model APIs in our examples without any adaptation work.

What's in this PR

  • Add role field in Msg class
  • Provide a basic prompt strategy for all chat and generation API wrappers in their format function
  • Change how prompt is constructed in built-in agents (Using format function)
  • Update tutorial

TBD:

  • I'm not sure if we should desperate prompt engine module. Especially if we want to add prompt shrinking strategies in the future.
  • To accommodate the current versions, the role field current use assistant as default value and give a warning to remind users to fill this argument.
  • The preprocess function of DashScopeChatWrapper is retained and can work with format function together.

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has passed all tests
  • Docstrings have been added/updated in Google Style
  • Documentation has been updated
  • Code is ready for review

@DavdGao DavdGao mentioned this pull request Mar 23, 2024
4 tasks
Copy link
Collaborator

@ZiTao-Li ZiTao-Li left a comment

Choose a reason for hiding this comment

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

please refer to the inline comments

docs/sphinx_doc/en/source/tutorial/206-prompt.md Outdated Show resolved Hide resolved
src/agentscope/models/dashscope_model.py Show resolved Hide resolved
src/agentscope/models/gemini_model.py Outdated Show resolved Hide resolved
@DavdGao DavdGao added enhancement New feature or request ready for review labels Mar 25, 2024
tests/format_test.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@ZiTao-Li ZiTao-Li left a comment

Choose a reason for hiding this comment

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

See wording problem in comment. Others parts LGTM.

src/agentscope/models/dashscope_model.py Outdated Show resolved Hide resolved
Copy link
Collaborator

@pan-x-c pan-x-c left a comment

Choose a reason for hiding this comment

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

LGTM

@pan-x-c pan-x-c merged commit 2b0e54a into modelscope:main Mar 26, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants