This repository was archived by the owner on Jul 17, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +11
-0
lines changed
rag-core-api/src/rag_core_api/impl Expand file tree Collapse file tree 2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -126,6 +126,13 @@ async def ainvoke(
126
126
- The method processes the chat history based on the settings defined in `_chat_history_settings`.
127
127
- The history is formatted and included in the `AnswerGraphState`.
128
128
"""
129
+ if not graph_input .message .strip ():
130
+ return ChatResponse (
131
+ answer = self ._error_messages .empty_message ,
132
+ citations = [],
133
+ finish_reason = self ._error_messages .empty_message ,
134
+ )
135
+
129
136
history_of_interest = []
130
137
if graph_input .history and graph_input .history .messages :
131
138
history_of_interest = graph_input .history .messages [- self ._chat_history_settings .limit :]
Original file line number Diff line number Diff line change @@ -18,6 +18,8 @@ class ErrorMessages(BaseSettings):
18
18
Default message for harmful or inappropriate questions.
19
19
no_answer_found : str
20
20
Default message when no answer is found with the given context.
21
+ empty_message : str
22
+ Default message when an empty question is provided.
21
23
"""
22
24
23
25
class Config :
@@ -40,3 +42,5 @@ class Config:
40
42
no_answer_found : str = Field (
41
43
default = "Es tut mir leid, mit dem mir bereitgestellten Kontext konnte ich keine Antwort finden."
42
44
)
45
+
46
+ empty_message : str = Field (default = "Es tut mir leid, ich kann keine leere Frage beantworten." )
You can’t perform that action at this time.
0 commit comments