Andrei Sferdian commited on
Commit
0538479
·
1 Parent(s): 795a09f

Select model based on payment tier

Browse files
Files changed (2) hide show
  1. .env.template +2 -1
  2. agent.py +13 -4
.env.template CHANGED
@@ -7,4 +7,5 @@ LANGFUSE_PUBLIC_KEY=
7
  LANGFUSE_SECRET_KEY=
8
  LANGFUSE_HOST=
9
  MAX_CONCURRENCY=5 # number of tasks to run in parallel
10
- LOG_LEVEL=info # debug, info, warning, error, critical
 
 
7
  LANGFUSE_SECRET_KEY=
8
  LANGFUSE_HOST=
9
  MAX_CONCURRENCY=5 # number of tasks to run in parallel
10
+ LOG_LEVEL=info # debug, info, warning, error, critical
11
+ MODE=free # free, paid
agent.py CHANGED
@@ -46,10 +46,19 @@ tools = [
46
  sum_rows_cols,
47
  ]
48
 
49
- model = ChatOpenAI(
50
- model="gpt-4.1",
51
- temperature=0.0,
52
- max_retries=3,
 
 
 
 
 
 
 
 
 
53
  ).bind_tools(tools)
54
 
55
  prompt = (
 
46
  sum_rows_cols,
47
  ]
48
 
49
+ mode = os.getenv("MODE", "free").lower()
50
+ model = (
51
+ ChatOpenAI(
52
+ model="gpt-4.1",
53
+ temperature=0.0,
54
+ max_retries=3,
55
+ )
56
+ if mode == "paid"
57
+ else ChatTogether(
58
+ model="meta-llama/Llama-3.3-70B-Instruct-Turbo-Free",
59
+ temperature=0.0,
60
+ max_retries=3,
61
+ )
62
  ).bind_tools(tools)
63
 
64
  prompt = (