-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(train): semantic agent to accept jsons (#1208)
- Loading branch information
1 parent
bdd5ce4
commit 9bcdc58
Showing
10 changed files
with
137 additions
and
9 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
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
23 changes: 23 additions & 0 deletions
23
pandasai/ee/agents/semantic_agent/pipeline/semantic_result_parsing.py
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,23 @@ | ||
from pandasai.pipelines.chat.result_parsing import ResultParsing | ||
from pandasai.pipelines.pipeline_context import PipelineContext | ||
|
||
|
||
class SemanticResultParser(ResultParsing): | ||
""" | ||
Semantic Agent Result Parsing Stage | ||
""" | ||
|
||
pass | ||
|
||
def _add_result_to_memory(self, result: dict, context: PipelineContext): | ||
""" | ||
Add the result to the memory. | ||
Args: | ||
result (dict): The result to add to the memory | ||
context (PipelineContext) : Pipeline Context | ||
""" | ||
if result is None: | ||
return | ||
|
||
context.memory.add(context.get("llm_call"), False) |
2 changes: 1 addition & 1 deletion
2
pandasai/ee/agents/semantic_agent/prompts/templates/semantic_agent_prompt.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
=== SemanticAgent === | ||
|
||
{% include 'shared/vectordb_docs.tmpl' with context %} | ||
# SCHEMA | ||
{{schema}} | ||
|
||
|
8 changes: 8 additions & 0 deletions
8
pandasai/ee/agents/semantic_agent/prompts/templates/shared/vectordb_docs.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{% if context.vectorstore %}{% set documents = context.vectorstore.get_relevant_qa_documents(context.memory.get_last_message()) %} | ||
{% if documents|length > 0%}You can utilize these examples as a reference for generating json.{% endif %} | ||
{% for document in documents %} | ||
{{ document}}{% endfor %}{% endif %} | ||
{% if context.vectorstore %}{% set documents = context.vectorstore.get_relevant_docs_documents(context.memory.get_last_message()) %} | ||
{% if documents|length > 0%}Here are additional documents for reference. Feel free to use them to answer.{% endif %} | ||
{% for document in documents %}{{ document}} | ||
{% endfor %}{% endif %} |
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