Skip to content

Can I add Fewshot tempalte/Fewshot examples to prebuilt react agent? #28332

Answered by dosubot bot
mraguth asked this question in Ask Dosu
Discussion options

You must be logged in to vote

To inject the few_shot_prompt into your LangChain React agent, you need to incorporate it into the prompt configuration of your agent. Here's how you can do it:

  1. Modify the Prompt: Use the FewShotChatMessagePromptTemplate as part of the prompt setup for your agent. You can integrate it into the create_react_agent function by including it in the prompt configuration.

  2. Update the Agent Creation: When creating the agent, pass the few_shot_prompt as part of the prompt or state modifier.

Here's an example of how you might modify your code:

# Assuming you have already created your few_shot_prompt
few_shot_prompt = FewShotChatMessagePromptTemplate(
    examples=examples,
    example_prompt=e…

Replies: 2 comments 12 replies

Comment options

You must be logged in to vote
8 replies
@mraguth
Comment options

@dosubot
Comment options

Answer selected by mraguth
@mraguth
Comment options

@dosubot
Comment options

@mraguth
Comment options

@dosubot
Comment options

Comment options

You must be logged in to vote
4 replies
@mraguth
Comment options

@dosubot
Comment options

@mraguth
Comment options

@dosubot
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant