Skip to content

Commit

Permalink
fixing issue if vector store is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
TransformerOptimus committed Jun 6, 2023
1 parent 877b9a9 commit f6a1bb2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
12 changes: 8 additions & 4 deletions superagi/jobs/agent_executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,14 @@ def execute_next_action(self, agent_execution_id):
# EditIssueTool()
]

if parsed_config["LTM_DB"] == "Pinecone":
memory = VectorFactory.get_vector_storage("PineCone", "super-agent-index1", OpenAiEmbedding())
else:
memory = VectorFactory.get_vector_storage("PineCone", "super-agent-index1", OpenAiEmbedding())
try:
if parsed_config["LTM_DB"] == "Pinecone":
memory = VectorFactory.get_vector_storage("PineCone", "super-agent-index1", OpenAiEmbedding())
else:
memory = VectorFactory.get_vector_storage("PineCone", "super-agent-index1", OpenAiEmbedding())
except:
print("Unable to setup the pincone connection...")
memory = None

user_tools = session.query(Tool).filter(Tool.id.in_(parsed_config["tools"])).all()

Expand Down
2 changes: 2 additions & 0 deletions superagi/vector_store/vector_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ def get_vector_storage(cls, vector_store, index_name, embedding_model):
try:
api_key = get_config("PINECONE_API_KEY")
env = get_config("PINECONE_ENVIRONMENT")
if api_key is None or env is None:
raise ValueError("PineCone API key not found")
pinecone.init(api_key=api_key, environment=env)

if index_name not in pinecone.list_indexes():
Expand Down

0 comments on commit f6a1bb2

Please sign in to comment.