-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support configuring assistant system message (#156)
* feat: support configuring assistant system message * code review * tweak prompts --------- Co-authored-by: Avram Tudor <tudor.avram@8x8.com>
- Loading branch information
Showing
4 changed files
with
68 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
assistant_default_system_message = "You are an AI assistant who provides the next answer in a given conversation." | ||
assistant_rag_question_extractor = """ | ||
Based on the provided text, formulate a proper question for RAG. | ||
Start your response with "Response:". | ||
""" | ||
assistant_limit_data_to_rag = "Only respond based on the information provided below." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from skynet.modules.ttt.assistant.constants import assistant_default_system_message, assistant_limit_data_to_rag | ||
|
||
|
||
def get_assistant_chat_messages( | ||
use_rag: bool, | ||
use_only_rag_data: bool, | ||
text: str, | ||
prompt: str, | ||
system_message: str, | ||
): | ||
messages = [('system', system_message or assistant_default_system_message)] | ||
|
||
if use_rag: | ||
if use_only_rag_data: | ||
messages.append(('system', assistant_limit_data_to_rag)) | ||
|
||
messages.append(('system', '{context}')) | ||
|
||
if text: | ||
messages.append(('human', text)) | ||
|
||
if prompt: | ||
messages.append(('human', prompt)) | ||
|
||
return messages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters