Make sure that secrets would work on aws
This commit is contained in:
parent
6e47c1ff56
commit
5ed04de27e
7 changed files with 45 additions and 29 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
OPENAI_API_KEY=sk
|
OPENAI_API_KEY=sk
|
||||||
WEAVIATE_URL =
|
WEAVIATE_URL =
|
||||||
WEAVIATE_API_KEY =
|
WEAVIATE_API_KEY =
|
||||||
ENVIRONMENT = docker
|
ENV = docker
|
||||||
POSTGRES_USER = bla
|
POSTGRES_USER = bla
|
||||||
POSTGRES_PASSWORD = bla
|
POSTGRES_PASSWORD = bla
|
||||||
POSTGRES_DB = bubu
|
POSTGRES_DB = bubu
|
||||||
|
|
|
||||||
|
|
@ -31,12 +31,29 @@ class Config:
|
||||||
embedding_chunk_size: int = 300
|
embedding_chunk_size: int = 300
|
||||||
|
|
||||||
# Database parameters
|
# Database parameters
|
||||||
graph_database_url: str = os.getenv('GRAPH_DB_URL')
|
if os.getenv('ENV') == 'prod' or os.getenv('ENV') == 'dev' or os.getenv('AWS_ENV') == 'dev' or os.getenv('AWS_ENV') == 'prd':
|
||||||
graph_database_username: str = os.getenv('GRAPH_DB_USER')
|
graph_database_url: str = os.getenv('GRAPH_DB_URL_PROD')
|
||||||
graph_database_password: str = os.getenv('GRAPH_DB_PW')
|
graph_database_username: str = os.getenv('GRAPH_DB_USER')
|
||||||
|
graph_database_password: str = os.getenv('GRAPH_DB_PW_PROD')
|
||||||
|
else:
|
||||||
|
graph_database_url: str = os.getenv('GRAPH_DB_URL')
|
||||||
|
graph_database_username: str = os.getenv('GRAPH_DB_USER')
|
||||||
|
graph_database_password: str = os.getenv('GRAPH_DB_PW')
|
||||||
weaviate_url: str = os.getenv('WEAVIATE_URL')
|
weaviate_url: str = os.getenv('WEAVIATE_URL')
|
||||||
weaviate_api_key: str = os.getenv('WEAVIATE_API_KEY')
|
weaviate_api_key: str = os.getenv('WEAVIATE_API_KEY')
|
||||||
|
|
||||||
|
postgres_user: str = os.getenv('POSTGRES_USER')
|
||||||
|
postgres_password: str = os.getenv('POSTGRES_PASSWORD')
|
||||||
|
postgres_db: str = os.getenv('POSTGRES_DB')
|
||||||
|
if os.getenv('ENV') == 'prod' or os.getenv('ENV') == 'dev' or os.getenv('AWS_ENV') == 'dev' or os.getenv('AWS_ENV') == 'prd':
|
||||||
|
postgres_host: str = os.getenv('POSTGRES_PROD_HOST')
|
||||||
|
elif os.getenv('ENV') == 'docker':
|
||||||
|
postgres_host: str = os.getenv('POSTGRES_HOST_DOCKER')
|
||||||
|
elif os.getenv('ENV') == 'local':
|
||||||
|
postgres_host: str = os.getenv('POSTGRES_HOST_LOCAL')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Client ID
|
# Client ID
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ from postgres.models import operation
|
||||||
from postgres.models import sessions
|
from postgres.models import sessions
|
||||||
from postgres.models import user
|
from postgres.models import user
|
||||||
from postgres.models import docs
|
from postgres.models import docs
|
||||||
|
from cognitive_architecture.config import Config
|
||||||
|
config = Config()
|
||||||
|
config.load()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
from postgres.database import Base
|
from postgres.database import Base
|
||||||
|
|
@ -54,18 +58,15 @@ def create_tables(engine):
|
||||||
Base.metadata.create_all(bind=engine)
|
Base.metadata.create_all(bind=engine)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
username = os.getenv('POSTGRES_USER')
|
#
|
||||||
password = os.getenv('POSTGRES_PASSWORD')
|
# username = os.getenv('POSTGRES_USER')
|
||||||
database_name = os.getenv('POSTGRES_DB')
|
# password = os.getenv('POSTGRES_PASSWORD')
|
||||||
environment = os.environ.get("ENVIRONMENT")
|
# database_name = os.getenv('POSTGRES_DB')
|
||||||
|
# environment = os.environ.get("ENV")
|
||||||
if environment == "local":
|
host = config.postgres_host
|
||||||
host = os.getenv('POSTGRES_HOST')
|
username = config.postgres_user
|
||||||
|
password = config.postgres_password
|
||||||
elif environment == "docker":
|
database_name = config.postgres_db
|
||||||
host = os.getenv('POSTGRES_HOST_DOCKER')
|
|
||||||
else:
|
|
||||||
host = os.getenv('POSTGRES_HOST_DOCKER')
|
|
||||||
|
|
||||||
engine = create_admin_engine(username, password, host, database_name)
|
engine = create_admin_engine(username, password, host, database_name)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,26 +15,23 @@ load_dotenv()
|
||||||
# # Get the parent directory of your script and add it to sys.path
|
# # Get the parent directory of your script and add it to sys.path
|
||||||
# parent_dir = os.path.dirname(script_dir)
|
# parent_dir = os.path.dirname(script_dir)
|
||||||
# sys.path.append(parent_dir)
|
# sys.path.append(parent_dir)
|
||||||
|
from cognitive_architecture.config import Config
|
||||||
|
config = Config()
|
||||||
|
config.load()
|
||||||
|
|
||||||
|
|
||||||
# in seconds
|
# in seconds
|
||||||
MAX_RETRIES = 3
|
MAX_RETRIES = 3
|
||||||
RETRY_DELAY = 5
|
RETRY_DELAY = 5
|
||||||
|
|
||||||
username = os.getenv('POSTGRES_USER')
|
|
||||||
password = os.getenv('POSTGRES_PASSWORD')
|
|
||||||
database_name = os.getenv('POSTGRES_DB')
|
|
||||||
import os
|
|
||||||
|
|
||||||
environment = os.environ.get("ENVIRONMENT")
|
|
||||||
|
|
||||||
if environment == "local":
|
host = config.postgres_host
|
||||||
host= os.getenv('POSTGRES_HOST')
|
username = config.postgres_user
|
||||||
|
password = config.postgres_password
|
||||||
|
database_name = config.postgres_db
|
||||||
|
|
||||||
|
|
||||||
elif environment == "docker":
|
|
||||||
host= os.getenv('POSTGRES_HOST_DOCKER')
|
|
||||||
else:
|
|
||||||
host= os.getenv('POSTGRES_HOST_DOCKER')
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@ class WeaviateVectorDB(VectorDB):
|
||||||
else:
|
else:
|
||||||
chunk_count = 0
|
chunk_count = 0
|
||||||
from cognitive_architecture.database.vectordb.chunkers.chunkers import chunk_data
|
from cognitive_architecture.database.vectordb.chunkers.chunkers import chunk_data
|
||||||
documents = [chunk_data(chunk_strategy="VANILLA", source_data=observation, chunk_size=50,
|
documents = [chunk_data(chunk_strategy="VANILLA", source_data=observation, chunk_size=300,
|
||||||
chunk_overlap=20)]
|
chunk_overlap=20)]
|
||||||
for doc in documents[0]:
|
for doc in documents[0]:
|
||||||
chunk_count += 1
|
chunk_count += 1
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
export ENVIRONMENT
|
export ENVIRONMENT
|
||||||
|
export ENV
|
||||||
# Run Python scripts with error handling
|
# Run Python scripts with error handling
|
||||||
echo "Running fetch_secret.py"
|
echo "Running fetch_secret.py"
|
||||||
python cognitive_architecture/fetch_secret.py
|
python cognitive_architecture/fetch_secret.py
|
||||||
|
|
|
||||||
2
main.py
2
main.py
|
|
@ -320,7 +320,7 @@ async def user_context_enrichment(session, user_id:str, query:str)->str:
|
||||||
final_result = generate_graph(entire_context)
|
final_result = generate_graph(entire_context)
|
||||||
logging.info("Final result is %s", final_result)
|
logging.info("Final result is %s", final_result)
|
||||||
|
|
||||||
return final_result
|
return final_result.response
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue