-
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.
chore(SemanticAgent): add samples in schema and support back-tick jso…
…n load (#1241) * fix(SemanticAgent): join data to be fixed * fix(semantic_agent): json load to also look for json in backtick
- Loading branch information
1 parent
e10510a
commit 431c3d5
Showing
5 changed files
with
113 additions
and
80 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
167 changes: 91 additions & 76 deletions
167
pandasai/ee/agents/semantic_agent/prompts/templates/generate_df_schema.tmpl
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,14 @@ | ||
import json | ||
|
||
|
||
def extract_json_from_json_str(json_str): | ||
start_index = json_str.find("```json") | ||
|
||
end_index = json_str.find("```", start_index) | ||
|
||
if start_index == -1: | ||
return json.loads(json_str) | ||
|
||
json_data = json_str[(start_index + len("```json")) : end_index].strip() | ||
|
||
return json.loads(json_data) |