File size: 713 Bytes
22acaeb 3d3fd6e 22acaeb 8de2363 22acaeb 8de2363 22acaeb 8de2363 22acaeb 8de2363 3d3fd6e 22acaeb ed530b7 22acaeb |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
import os
import socket
from openai import OpenAI
import time
def obtenClienteOpenAI():
if local_check():
print("Estoy en LOCAL...")
import bridges
buzz = bridges.buzz
llave = bridges.llave
else:
print("Estoy en REMOTO...")
buzz = os.getenv("buzz")
llave = os.getenv("llave")
client = OpenAI(api_key=buzz)
return client
def local_check():
hostname = socket.gethostname()
#r-moibe-nowme
print("Dentro de local_check... , el hostname es: ", hostname)
if "r-moibe-nowme" in hostname:
print("Ejecutando en el servidor")
return False
else:
print("Ejecutando en local")
return True |