mirror of
https://github.com/zylon-ai/private-gpt.git
synced 2025-12-22 10:45:42 +01:00
Allow passing a system prompt (#1318)
This commit is contained in:
parent
9c192ddd73
commit
64ed9cd872
6 changed files with 1129 additions and 1039 deletions
|
|
@ -116,6 +116,17 @@ class PrivateGptUi:
|
|||
all_messages = [*build_history(), new_message]
|
||||
match mode:
|
||||
case "Query Docs":
|
||||
# Add a system message to force the behaviour of the LLM
|
||||
# to answer only questions about the provided context.
|
||||
all_messages.insert(
|
||||
0,
|
||||
ChatMessage(
|
||||
content="You can only answer questions about the provided context. If you know the answer "
|
||||
"but it is not based in the provided context, don't provide the answer, just state "
|
||||
"the answer is not in the context provided.",
|
||||
role=MessageRole.SYSTEM,
|
||||
),
|
||||
)
|
||||
query_stream = self._chat_service.stream_chat(
|
||||
messages=all_messages,
|
||||
use_context=True,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue