-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
936f1be
commit 5a42280
Showing
13 changed files
with
338 additions
and
21 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,22 @@ | ||
from sqlalchemy.orm import Session | ||
|
||
from superagi.models.agent_execution_feed import AgentExecutionFeed | ||
from superagi.vector_store.base import VectorStore | ||
|
||
|
||
class ToolResponseQueryManager: | ||
def __init__(self, session: Session, agent_execution_id: int): | ||
def __init__(self, session: Session, agent_execution_id: int,memory:VectorStore): | ||
self.session = session | ||
self.agent_execution_id = agent_execution_id | ||
|
||
self.memory=memory | ||
|
||
|
||
def get_last_response(self, tool_name: str = None): | ||
return AgentExecutionFeed.get_last_tool_response(self.session, self.agent_execution_id, tool_name) | ||
|
||
def get_relevant_response(self, query: str,metadata:dict, top_k: int = 5): | ||
documents = self.memory.get_matching_text(query, metadata=metadata) | ||
relevant_responses = "" | ||
for document in documents["documents"]: | ||
relevant_responses += document.text_content | ||
return relevant_responses |
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
Oops, something went wrong.