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

Updating the AWS Prompt_Engineering Notebook + Adding an Example of ReAct with Llama 2 on Bedrock #386

Merged
merged 5 commits into from
Mar 4, 2024

Conversation

ejsd1989
Copy link
Contributor

@ejsd1989 ejsd1989 commented Mar 4, 2024

What does this PR do?

Prompt_Engineering_with_Llama_2_On_Amazon_Bedrock.ipynb

  • Added in a section to help better understand how to use the [INST] tags, updated some examples, and added reference to the Deeplearning.AI Prompt Engineering course

ReAct_Llama_2_Bedrock-WK.ipynb

  • Adding an example of ReAct using Llama 2
  • Short explanation of ReAct
  • Setup and configuration to use Amazon Bedrock
  • Example of using the Bedrock api via langchain
  • Setup for use of DuckDuckGoSearchRun, WikipediaAPIWrapper, and PythonREPL.
  • Created a pattern for the model to follow in order to use the tools and do reasoning similar to CoT.
  • Cleaned up and formatted the generated text before giving it to the corresponding tool.

Before submitting

  • This PR fixes a typo or improves the docs (you can dismiss the other checks if that's the case).
  • Did you read the contributor guideline,
    Pull Request section?
  • Was this discussed/approved via a Github issue? Please add a link
    to it if that's the case.
  • Did you make sure to update the documentation with your changes? Documentation is in the notebooks
  • Did you write any new necessary tests?

Thanks for contributing 🎉!

ejsd1989 added 2 commits March 4, 2024 10:54
Added in a section to help better understand how to use the [INST] tags, updated some examples, and added reference to the Deeplearning.AI Prompt Engineering course
Short explanation of ReAct
Setup and configuration to use Amazon Bedrock
Example of using the Bedrock api via langchain
Setup for use of DuckDuckGoSearchRun, WikipediaAPIWrapper, and PythonREPL.
Created a pattern for the model to follow in order to use the tools and do reasoning similar to CoT.
Cleaned up and formatted the generated text before giving it to the corresponding tool.
+ making sure the attribution was added back in
quick whitepaper reference added to the INST Prompt Tags section
Copy link
Contributor

@jeffxtang jeffxtang left a comment

Choose a reason for hiding this comment

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

@ejsd1989 PR looks good! Just a few minor comments.

"source": [
"### [INST] Prompt Tags\n",
"\n",
"To signify user instruction to the Model, you may use the `[INST][/INST]` tags, and the model response will filter have the tags filtered out. The tags help to signify that the enclosed text are instructions for the model to follow and use in the response.\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

You may want to add a note that some LLM integration code with LangChain already takes care of adding [INST] and [/INST] around the user prompt so the app developer won't need to manually add it. (I'm not sure about the case with Bedrock, but Together needs manually wrapping the [INST] tag while Anyscale doesn't). But under the hood the [INST] is needed for Llama 2 (maybe add the link here for more info).

Copy link
Contributor

Choose a reason for hiding this comment

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

Under "Note about LangChain", there is ~/.aws/ and /.aws/config - can we make them the same (~/.aws)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated

Updated minor typos/fixes from reviewer comments
@jeffxtang jeffxtang merged commit 674b37e into main Mar 4, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants