Fix annotation model import

#6
Files changed (1) hide show
  1. btl/annotate.py +2 -6
btl/annotate.py CHANGED
@@ -2,7 +2,7 @@ import ast
2
  from dataclasses import dataclass
3
  from typing import Literal
4
 
5
- from .model import ModelUnavailableError, generate_comment, generate_comment_with_llm, load_llm
6
 
7
 
8
  ModelChoice = Literal["base", "tuned"]
@@ -88,14 +88,10 @@ def insert_comments(source: str, comments: dict[int, str]) -> str:
88
  def generate_block_comments(blocks: list[BlockInfo], model_choice: ModelChoice = "base") -> tuple[dict[int, str], list[str]]:
89
  comments: dict[int, str] = {}
90
  notes: list[str] = []
91
- llm = load_llm() if model_choice == "base" else None
92
 
93
  for block in blocks:
94
  try:
95
- if model_choice == "base":
96
- comments[block.lineno] = generate_comment_with_llm(llm, block.kind, block.name, block.source)
97
- else:
98
- comments[block.lineno] = generate_comment(block.kind, block.name, block.source, variant="tuned")
99
  except ModelUnavailableError:
100
  raise
101
  except Exception as exc:
 
2
  from dataclasses import dataclass
3
  from typing import Literal
4
 
5
+ from .model import ModelUnavailableError, generate_comment
6
 
7
 
8
  ModelChoice = Literal["base", "tuned"]
 
88
  def generate_block_comments(blocks: list[BlockInfo], model_choice: ModelChoice = "base") -> tuple[dict[int, str], list[str]]:
89
  comments: dict[int, str] = {}
90
  notes: list[str] = []
 
91
 
92
  for block in blocks:
93
  try:
94
+ comments[block.lineno] = generate_comment(block.kind, block.name, block.source, variant=model_choice)
 
 
 
95
  except ModelUnavailableError:
96
  raise
97
  except Exception as exc: