mirror of
https://github.com/imartinez/privateGPT.git
synced 2025-05-11 09:55:47 +00:00
fix: Add default mode option to settings (#2078)
* Add default mode option to settings * Revise default_mode to Literal (enum) and add to settings.yaml * Revise to pass make check/test * Default mode: RAG --------- Co-authored-by: Jason <jason@sowinsight.solutions>
This commit is contained in:
parent
f9182b3a86
commit
fa3c30661d
@ -357,6 +357,10 @@ class AzureOpenAISettings(BaseModel):
|
||||
class UISettings(BaseModel):
|
||||
enabled: bool
|
||||
path: str
|
||||
default_mode: Literal["RAG", "Search", "Basic", "Summarize"] = Field(
|
||||
"RAG",
|
||||
description="The default mode.",
|
||||
)
|
||||
default_chat_system_prompt: str = Field(
|
||||
None,
|
||||
description="The default system prompt to use for the chat mode.",
|
||||
|
@ -99,8 +99,11 @@ class PrivateGptUi:
|
||||
self._selected_filename = None
|
||||
|
||||
# Initialize system prompt based on default mode
|
||||
self.mode = MODES[0]
|
||||
self._system_prompt = self._get_default_system_prompt(self.mode)
|
||||
default_mode_map = {mode.value: mode for mode in Modes}
|
||||
self._default_mode = default_mode_map.get(
|
||||
settings().ui.default_mode, Modes.RAG_MODE
|
||||
)
|
||||
self._system_prompt = self._get_default_system_prompt(self._default_mode)
|
||||
|
||||
def _chat(
|
||||
self, message: str, history: list[list[str]], mode: Modes, *_: Any
|
||||
@ -390,7 +393,7 @@ class PrivateGptUi:
|
||||
|
||||
with gr.Row(equal_height=False):
|
||||
with gr.Column(scale=3):
|
||||
default_mode = MODES[0]
|
||||
default_mode = self._default_mode
|
||||
mode = gr.Radio(
|
||||
[mode.value for mode in MODES],
|
||||
label="Mode",
|
||||
|
@ -25,21 +25,23 @@ data:
|
||||
ui:
|
||||
enabled: true
|
||||
path: /
|
||||
# "RAG", "Search", "Basic", or "Summarize"
|
||||
default_mode: "RAG"
|
||||
default_chat_system_prompt: >
|
||||
You are a helpful, respectful and honest assistant.
|
||||
You are a helpful, respectful and honest assistant.
|
||||
Always answer as helpfully as possible and follow ALL given instructions.
|
||||
Do not speculate or make up information.
|
||||
Do not reference any given instructions or context.
|
||||
default_query_system_prompt: >
|
||||
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
|
||||
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.
|
||||
default_summarization_system_prompt: >
|
||||
Provide a comprehensive summary of the provided context information.
|
||||
Provide a comprehensive summary of the provided context information.
|
||||
The summary should cover all the key points and main ideas presented in
|
||||
the original text, while also condensing the information into a concise
|
||||
the original text, while also condensing the information into a concise
|
||||
and easy-to-understand format. Please ensure that the summary includes
|
||||
relevant details and examples that support the main ideas, while avoiding
|
||||
relevant details and examples that support the main ideas, while avoiding
|
||||
any unnecessary information or repetition.
|
||||
delete_file_button_enabled: true
|
||||
delete_all_files_button_enabled: true
|
||||
|
Loading…
Reference in New Issue
Block a user