feat: improve docker containerization and add LLM timeout
This commit is contained in:
@@ -10,7 +10,11 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- data:/var/lib/postgresql
|
- data:/var/lib/postgresql
|
||||||
healthcheck:
|
healthcheck:
|
||||||
test: ["CMD-SHELL", "pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-messages}"]
|
test:
|
||||||
|
[
|
||||||
|
"CMD-SHELL",
|
||||||
|
"pg_isready -U ${POSTGRES_USER:-postgres} -d ${POSTGRES_DB:-messages}",
|
||||||
|
]
|
||||||
interval: 5s
|
interval: 5s
|
||||||
timeout: 5s
|
timeout: 5s
|
||||||
retries: 5
|
retries: 5
|
||||||
@@ -33,7 +37,7 @@ services:
|
|||||||
- .env
|
- .env
|
||||||
environment:
|
environment:
|
||||||
- LLM_MODEL=${LLM_MODEL:-deepseek}
|
- LLM_MODEL=${LLM_MODEL:-deepseek}
|
||||||
- POSTGRES_HOST=messages_db
|
- POSTGRES_HOST=${POSTGRES_HOST:-db}
|
||||||
- POSTGRES_USER=${POSTGRES_USER:-postgres}
|
- POSTGRES_USER=${POSTGRES_USER:-postgres}
|
||||||
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres}
|
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-postgres}
|
||||||
- POSTGRES_DB=${POSTGRES_DB:-messages}
|
- POSTGRES_DB=${POSTGRES_DB:-messages}
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ class LLMFactory:
|
|||||||
model=model_name,
|
model=model_name,
|
||||||
temperature=1,
|
temperature=1,
|
||||||
max_retries=3,
|
max_retries=3,
|
||||||
|
timeout=30
|
||||||
)
|
)
|
||||||
|
|
||||||
return model
|
return model
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class Settings:
|
|||||||
DB_NAME = os.getenv("POSTGRES_DB", "messages")
|
DB_NAME = os.getenv("POSTGRES_DB", "messages")
|
||||||
DB_USER = os.getenv("POSTGRES_USER", "postgres")
|
DB_USER = os.getenv("POSTGRES_USER", "postgres")
|
||||||
DB_PASSWORD = os.getenv("POSTGRES_PASSWORD", "postgres")
|
DB_PASSWORD = os.getenv("POSTGRES_PASSWORD", "postgres")
|
||||||
DB_HOST = os.getenv("POSTGRES_HOST", "localhost")
|
DB_HOST = os.getenv("POSTGRES_HOST", "db")
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
load_dotenv()
|
load_dotenv()
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ app = FastAPI(
|
|||||||
"API for NaliiaBot, a chatbot that provides "
|
"API for NaliiaBot, a chatbot that provides "
|
||||||
"customer service and related topics."),
|
"customer service and related topics."),
|
||||||
version="1.0.0",
|
version="1.0.0",
|
||||||
|
root_path="/agent/api",
|
||||||
lifespan=lifespan
|
lifespan=lifespan
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user