Skip to content

Commit

Permalink
feat: adding dynamic user feedback when unable to find the answer. (#80)
Browse files Browse the repository at this point in the history
* feat: adding dynamic user feedback when unable to find the answer.

* Update agent_gateway/gateway/gateway.py

Co-authored-by: Tyler White <tyler.white@snowflake.com>

---------

Co-authored-by: Tyler White <tyler.white@snowflake.com>
  • Loading branch information
sfc-gh-alherrera and sfc-gh-twhite authored Dec 6, 2024
1 parent 8cc8e57 commit 9a72d52
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion agent_gateway/gateway/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def _parse_fusion_output(self, raw_answer: str) -> str:
is_replan = FUSION_REPLAN in answer

if is_replan:
answer = "We couldn't find the information you're looking for. You can try rephrasing your request or validate that the provided tools contain sufficient information."
answer = self._extract_replan_message(raw_answer)

if answer is None:
raise AgentGatewayError(
Expand Down Expand Up @@ -257,6 +257,17 @@ def _extract_answer(self, raw_answer):

return None

def _extract_replan_message(self, raw_answer):
replan_start = "Action: Replan("
replan_index = raw_answer.find(replan_start)
if replan_index != -1:
replan_index += len(replan_start)
return raw_answer[replan_index : raw_answer.rfind(")")].strip()
return (
"We couldn't find the information you're looking for. You can try "
"rephrasing your request or validate that the provided tools contain "
"sufficient information."
)
def _generate_context_for_replanner(
self, tasks: Mapping[int, Task], fusion_thought: str
) -> str:
Expand Down

0 comments on commit 9a72d52

Please sign in to comment.