gaurv007 commited on
Commit
9bcb10b
·
verified ·
1 Parent(s): f5077f8

Fix expression_compiler: use tier instead of hardcoded model name"

Browse files
alpha_factory/personas/expression_compiler.py CHANGED
@@ -42,7 +42,6 @@ ts_decay_linear({{ comps | join(" + ") }}, {{ bp.decay }})
42
  """,
43
  }
44
 
45
- # Jinja environment
46
  _env = Environment(loader=BaseLoader())
47
 
48
 
@@ -67,11 +66,11 @@ if_else, less, greater, filter, trade_when, ts_backfill, indneutralize
67
  async def compile_expression(
68
  blueprint: Blueprint,
69
  llm: LLMClient,
70
- model: str | None = None,
71
  ) -> Expression:
72
  """
73
  Convert a Blueprint to a BRAIN expression.
74
  Uses Jinja template if archetype is known; LLM fallback for novel structures.
 
75
  """
76
  # Try template first (95% of cases)
77
  if blueprint.archetype in TEMPLATES:
@@ -79,7 +78,6 @@ async def compile_expression(
79
  template = _env.from_string(template_str)
80
  expr_text = template.render(bp=blueprint).strip()
81
 
82
- # Extract metadata
83
  fields_used = []
84
  ops_used = []
85
  for c in blueprint.components:
@@ -110,7 +108,7 @@ Apply ts_decay_linear with decay={blueprint.decay} if decay > 0."""
110
  result = await llm.generate_json(
111
  prompt=user_prompt,
112
  schema=Expression,
113
- model=model or llm.config.tinyfish_model,
114
  temperature=0.1,
115
  system_prompt=COMPILER_SYSTEM_PROMPT,
116
  )
@@ -119,7 +117,6 @@ Apply ts_decay_linear with decay={blueprint.decay} if decay > 0."""
119
 
120
 
121
  def _format_components(bp: Blueprint) -> str:
122
- """Format components for the LLM prompt."""
123
  lines = []
124
  for i, c in enumerate(bp.components):
125
  lines.append(
 
42
  """,
43
  }
44
 
 
45
  _env = Environment(loader=BaseLoader())
46
 
47
 
 
66
  async def compile_expression(
67
  blueprint: Blueprint,
68
  llm: LLMClient,
 
69
  ) -> Expression:
70
  """
71
  Convert a Blueprint to a BRAIN expression.
72
  Uses Jinja template if archetype is known; LLM fallback for novel structures.
73
+ Uses tier="tinyfish" — ModelManager resolves to user's selected model.
74
  """
75
  # Try template first (95% of cases)
76
  if blueprint.archetype in TEMPLATES:
 
78
  template = _env.from_string(template_str)
79
  expr_text = template.render(bp=blueprint).strip()
80
 
 
81
  fields_used = []
82
  ops_used = []
83
  for c in blueprint.components:
 
108
  result = await llm.generate_json(
109
  prompt=user_prompt,
110
  schema=Expression,
111
+ tier="tinyfish",
112
  temperature=0.1,
113
  system_prompt=COMPILER_SYSTEM_PROMPT,
114
  )
 
117
 
118
 
119
  def _format_components(bp: Blueprint) -> str:
 
120
  lines = []
121
  for i, c in enumerate(bp.components):
122
  lines.append(