mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2025-12-22 00:14:23 +01:00
Added pinecone connectivity check and added relevant logging
This commit is contained in:
@@ -2,7 +2,8 @@
|
|||||||
import pinecone
|
import pinecone
|
||||||
|
|
||||||
from memory.base import MemoryProviderSingleton, get_ada_embedding
|
from memory.base import MemoryProviderSingleton, get_ada_embedding
|
||||||
|
from logger import logger
|
||||||
|
from colorama import Fore, Style
|
||||||
|
|
||||||
class PineconeMemory(MemoryProviderSingleton):
|
class PineconeMemory(MemoryProviderSingleton):
|
||||||
def __init__(self, cfg):
|
def __init__(self, cfg):
|
||||||
@@ -17,6 +18,17 @@ class PineconeMemory(MemoryProviderSingleton):
|
|||||||
# for now this works.
|
# for now this works.
|
||||||
# we'll need a more complicated and robust system if we want to start with memory.
|
# we'll need a more complicated and robust system if we want to start with memory.
|
||||||
self.vec_num = 0
|
self.vec_num = 0
|
||||||
|
|
||||||
|
try:
|
||||||
|
pinecone.whoami()
|
||||||
|
except Exception as e:
|
||||||
|
logger.typewriter_log("FAILED TO CONNECT TO PINECONE", Fore.RED, Style.BRIGHT + str(e) + Style.RESET_ALL)
|
||||||
|
logger.typewriter_log("DOUBLE CHECK CONFIGURATION",
|
||||||
|
Fore.YELLOW,
|
||||||
|
"Please ensure you have setup and configured Pinecone properly for use. " +
|
||||||
|
f"You can check out {Fore.CYAN + Style.BRIGHT}https://github.com/Torantulino/Auto-GPT#-pinecone-api-key-setup{Style.RESET_ALL} to ensure you've set up everything correctly.")
|
||||||
|
exit(1)
|
||||||
|
|
||||||
if table_name not in pinecone.list_indexes():
|
if table_name not in pinecone.list_indexes():
|
||||||
pinecone.create_index(table_name, dimension=dimension, metric=metric, pod_type=pod_type)
|
pinecone.create_index(table_name, dimension=dimension, metric=metric, pod_type=pod_type)
|
||||||
self.index = pinecone.Index(table_name)
|
self.index = pinecone.Index(table_name)
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ class RedisMemory(MemoryProviderSingleton):
|
|||||||
logger.typewriter_log("FAILED TO CONNECT TO REDIS", Fore.RED, Style.BRIGHT + str(e) + Style.RESET_ALL)
|
logger.typewriter_log("FAILED TO CONNECT TO REDIS", Fore.RED, Style.BRIGHT + str(e) + Style.RESET_ALL)
|
||||||
logger.typewriter_log("DOUBLE CHECK CONFIGURATION",
|
logger.typewriter_log("DOUBLE CHECK CONFIGURATION",
|
||||||
Fore.YELLOW,
|
Fore.YELLOW,
|
||||||
"Please ensure you have setup and configured redis properly for use. " +
|
"Please ensure you have setup and configured Redis properly for use. " +
|
||||||
f"You can check out {Fore.CYAN + Style.BRIGHT}https://github.com/Torantulino/Auto-GPT#redis-setup{Style.RESET_ALL} to ensure you've set up everything correctly.")
|
f"You can check out {Fore.CYAN + Style.BRIGHT}https://github.com/Torantulino/Auto-GPT#redis-setup{Style.RESET_ALL} to ensure you've set up everything correctly.")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user