File size: 434 Bytes
5480e8d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import os
from apis.LangSmith import LangSmithAPI
from dotenv import load_dotenv

load_dotenv()

langsmith = LangSmithAPI()
count = langsmith.getDailyMessages()

# Convert DAILY_LIMIT to int with a default value of 5
DAILY_LIMIT = int(os.getenv("DAILY_MESSAGES_LIMIT", "5"))

def is_usage_limit_reached():
    return count >= DAILY_LIMIT

def get_usages():
    return {
        "count": count,
        "daily_limit": DAILY_LIMIT
    }