67 lines
1.4 KiB
Python
67 lines
1.4 KiB
Python
import yaml
|
|
from langchain_core.tools import tool
|
|
from datetime import datetime
|
|
import pytz
|
|
import os
|
|
|
|
# Obtener la ruta del directorio actual
|
|
current_dir = os.path.dirname(os.path.abspath(__file__))
|
|
yaml_path = os.path.join(current_dir, "store_info.yaml")
|
|
|
|
with open(yaml_path, "r") as f:
|
|
STORE_INFO = yaml.safe_load(f)
|
|
|
|
|
|
@tool
|
|
def get_store_hours() -> str:
|
|
"""Obtiene el horario de la tienda"""
|
|
return STORE_INFO["store"]["hours"]
|
|
|
|
|
|
@tool
|
|
def get_store_location() -> str:
|
|
"""Obtiene la ubicación de la tienda"""
|
|
return STORE_INFO["store"]["location"]
|
|
|
|
|
|
@tool
|
|
def get_contact_info() -> dict:
|
|
"""Obtiene la información de contacto"""
|
|
return STORE_INFO["store"]["contact"]
|
|
|
|
|
|
@tool
|
|
def get_about_info() -> str:
|
|
"""Obtiene el about de la tienda"""
|
|
return STORE_INFO["store"]["about"]
|
|
|
|
|
|
@tool
|
|
def get_link_page() -> str:
|
|
"""Obtiene la pagina web de la tienda"""
|
|
return STORE_INFO["store"]["page"]
|
|
|
|
|
|
def get_time():
|
|
"""
|
|
Retorna la hora actual en Bogotá, Colombia.
|
|
"""
|
|
# Definir la zona horaria de Bogotá
|
|
bogota_tz = pytz.timezone("America/Bogota")
|
|
|
|
# Obtener la hora actual en Bogotá
|
|
hora_actual = datetime.now(bogota_tz)
|
|
|
|
# Formatear la hora en un formato legible
|
|
return hora_actual.strftime("%H:%M:%S")
|
|
|
|
|
|
tools = [
|
|
get_store_hours,
|
|
get_store_location,
|
|
get_contact_info,
|
|
get_about_info,
|
|
get_link_page,
|
|
get_time,
|
|
]
|