-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Explain functionality in the agent
- Loading branch information
1 parent
70244c3
commit f715035
Showing
7 changed files
with
191 additions
and
71 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from typing import List | ||
|
||
|
||
class ClarificationResponse: | ||
""" | ||
Clarification Response | ||
""" | ||
|
||
def __init__( | ||
self, success: bool = True, questions: List[str] = None, message: str = "" | ||
): | ||
""" | ||
Args: | ||
success: Whether the response generated or not. | ||
questions: List of questions | ||
""" | ||
self._success: bool = success | ||
self._questions: List[str] = questions | ||
self._message: str = message | ||
|
||
@property | ||
def questions(self) -> List[str]: | ||
return self._questions | ||
|
||
@property | ||
def message(self) -> List[str]: | ||
return self._message | ||
|
||
@property | ||
def success(self) -> bool: | ||
return self._success | ||
|
||
def __bool__(self) -> bool: | ||
""" | ||
Define the success of response. | ||
""" | ||
return self._success |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,23 @@ | ||
""" Prompt to get clarification questions | ||
You are provided with the following pandas DataFrames: | ||
<dataframe> | ||
{dataframe} | ||
</dataframe> | ||
<conversation> | ||
{conversation} | ||
</conversation> | ||
Based on the conversation, are there any clarification questions that a senior data scientist would ask? These are questions for non technical people, only ask for questions they could ask given low tech expertise and no knowledge about how the dataframes are structured. | ||
Return the JSON array of the clarification questions. If there is no clarification question, return an empty array. | ||
Json: | ||
""" # noqa: E501 | ||
""" Prompt to explain solution generated | ||
Based on the last conversation you generated the code. | ||
Can you explain briefly for non technical person on how you came up with code | ||
without explaining pandas library? | ||
""" | ||
|
||
|
||
from .base import Prompt | ||
|
||
|
||
class ClarificationQuestionPrompt(Prompt): | ||
class ExplainPrompt(Prompt): | ||
"""Prompt to get clarification questions""" | ||
|
||
text: str = """ | ||
You are provided with the following pandas DataFrames: | ||
<dataframe> | ||
{dataframes} | ||
</dataframe> | ||
<conversation> | ||
{conversation} | ||
</conversation> | ||
Based on the conversation, are there any clarification questions | ||
that a senior data scientist would ask? These are questions for non technical people, | ||
only ask for questions they could ask given low tech expertise and | ||
no knowledge about how the dataframes are structured. | ||
Return the JSON array of the clarification questions. | ||
Based on the last conversation you generated the code. | ||
If there is no clarification question, return an empty array. | ||
<Code> | ||
{code} | ||
</Code | ||
Json: | ||
Can you explain briefly for non technical person on how you came up with code | ||
without explaining pandas library? | ||
""" |
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