Skip to content

Commit

Permalink
Merge pull request #1168 from TransformerOptimus/knowledge_model_fix
Browse files Browse the repository at this point in the history
fix for knowledge search tool
  • Loading branch information
Tarraann authored Aug 31, 2023
2 parents 5378cbd + f71bba4 commit 7254014
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions superagi/tools/knowledge_search/knowledge_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ def _execute(self, query: str):
vector_db_index = VectordbIndices.get_vector_index_from_id(session, knowledge.vector_db_index_id)
vector_db = Vectordbs.get_vector_db_from_id(session, vector_db_index.vector_db_id)
db_creds = VectordbConfigs.get_vector_db_config_from_db_id(session, vector_db.id)
model_api_key = Configuration.fetch_configuration(session, organisation_id, "model_api_key")
model_source = Configuration.fetch_configuration(session, organisation_id, "model_source")
model_api_key = self.get_tool_config('OPENAI_API_KEY')
model_source = 'OpenAI'
embedding_model = AgentExecutor.get_embedding(model_source, model_api_key)
try:
if vector_db_index.state == "Custom":
Expand Down
6 changes: 4 additions & 2 deletions superagi/tools/knowledge_search/knowledge_search_toolkit.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from typing import List
from superagi.tools.base_tool import BaseTool, BaseToolkit, ToolConfiguration
from superagi.tools.knowledge_search.knowledge_search import KnowledgeSearchTool

from superagi.types.key_type import ToolConfigKeyType

class KnowledgeSearchToolkit(BaseToolkit, ABC):
name: str = "Knowledge Search Toolkit"
Expand All @@ -12,4 +12,6 @@ def get_tools(self) -> List[BaseTool]:
return [KnowledgeSearchTool()]

def get_env_keys(self) -> List[ToolConfiguration]:
return []
return [
ToolConfiguration(key="OPENAI_API_KEY", key_type=ToolConfigKeyType.STRING, is_required=False, is_secret=True)
]

0 comments on commit 7254014

Please sign in to comment.