Replies: 2 comments 3 replies
-
🤖 Hello, Based on your question, it seems you want to introduce a custom Here is an example of how you can do this: from langchain.prompts import SystemMessagePromptTemplate, ChatPromptTemplate
# Create a SystemMessagePromptTemplate
system_message_template = SystemMessagePromptTemplate.from_template("Your custom system message here")
# Create a ChatPromptTemplate and add the system message template to it
chat_template = ChatPromptTemplate.from_messages([system_message_template])
# Now you can use this chat_template to format your messages
messages = chat_template.format_messages() In this example, Please replace In the context shared, the Also, in the context shared, it's important to note that the I hope this helps! If you have any other questions, feel free to ask. Sources
This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research. Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant. If you want to continue the conversation, start your reply with @dosu-bot. |
Beta Was this translation helpful? Give feedback.
-
This may have already been resolved, but here is an example from my environment.
Using this prompt for the llm_chain prompt for stuff document chain worked. Stuff Document Chain
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hey everyone,
Hopefully, someone can help clarify the following problem.
I want to be able to do the following:
The following code examples are gathered through the Langchain python documentation and docstrings on some of their classes.
The code provided above works completely fine, but I'm struggling to find a place where I can add a system message to prime the chatbot in a certain way.
Usually, when not including documents to be retrieved from the vectorstore and I just want to have a conversation chain,
I would do something like this:
So my question is this:
"How do I combine the prompt_template that I have defined in the second example (which provides a system message to the llm) but add on top of that, the ability to stuff documents and send the stuff documents to the main conversation chain?"
The ideal structure I am looking to have is:
Any help would be appreciated, thanks!
Beta Was this translation helpful? Give feedback.
All reactions