theta tsmc-prevv commited on
Commit
2e19fac
·
1 Parent(s): 1274ab4

fix: empty or contains only empty strings. (#2347)

Browse files

### What problem does this PR solve?
the setting was kept empty for Empty_response. In expectation, this case
should get a response from the LLM if can't find the references from the
knowledgebase.

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)


![image](https://github.com/user-attachments/assets/9c382b1d-40f6-43b0-848c-fa6863f9a253)

![image](https://github.com/user-attachments/assets/032d2001-97a2-4faa-91bf-c9c57caf2070)

Co-authored-by: Theta Wang (ncu) <[email protected]>

Files changed (1) hide show
  1. agent/component/retrieval.py +2 -1
agent/component/retrieval.py CHANGED
@@ -76,7 +76,8 @@ class Retrieval(ComponentBase, ABC):
76
 
77
  if not kbinfos["chunks"]:
78
  df = Retrieval.be_output("")
79
- df["empty_response"] = self._param.empty_response
 
80
  return df
81
 
82
  df = pd.DataFrame(kbinfos["chunks"])
 
76
 
77
  if not kbinfos["chunks"]:
78
  df = Retrieval.be_output("")
79
+ if self._param.empty_response and self._param.empty_response.strip():
80
+ df["empty_response"] = self._param.empty_response
81
  return df
82
 
83
  df = pd.DataFrame(kbinfos["chunks"])