Skip to content

Commit 56c4dfa

Browse files
committed
bump toolchain
1 parent 15de6e8 commit 56c4dfa

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

lean_dojo_v2/external_api/LeanCopilot/Frontend.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ def suggestion (tac : String) (msgs : MessageLog := {}) : TacticM Suggestion :=
2929
let e ← g.withContext do (PrettyPrinter.ppExpr goalType)
3030
str := str ++ Format.pretty ("\n⊢ " ++ e)
3131
pure (some str)
32-
let style? := if goals.isEmpty then some .success else none
32+
let style? := none
3333
let msg? ← msgs.toList.findM? fun m => do pure <|
3434
m.severity == MessageSeverity.information && (← m.data.toString).startsWith "Try this: "
3535
let suggestion ← match msg? with
36-
| some m => pure <| SuggestionText.string (((← m.data.toString).drop 10).takeWhile (· != '\n'))
36+
| some m => pure <| SuggestionText.string (((← m.data.toString).drop 10).takeWhile (· != '\n')).toString
3737
| none => pure <| SuggestionText.string tac
3838
return { suggestion, postInfo?, style? }
3939

lean_dojo_v2/external_api/LeanCopilot/Models/External.lean

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,15 @@ def ExternalGenerator.generate (model : ExternalGenerator) (input : String) (tar
7474
return res.outputs.map fun g => (g.output, g.score)
7575

7676

77-
def generateRunpod (input : String) (modelName : String) (targetPrefix : String) : IO $ Array (String × Float) := do
77+
def generateRunpod (input : String) (modelName : String) (_targetPrefix : String) : IO $ Array (String × Float) := do
7878
let url := "https://router.huggingface.co/v1/chat/completions"
79-
79+
8080
-- Format the prompt (same as Python pre_process_input)
8181
let prompt := if modelName == "deepseek" then
8282
s!"Here is a theorem you need to prove in Lean:```lean\n{input}```\nNow you should suggest exactly one line tactic in lean code. Only output the tactic, no explanation, no comments, no theorem, nothing else:"
8383
else
8484
input
85-
85+
8686
-- Build JSON payload
8787
let message := Json.mkObj [("role", Json.str "user"), ("content", Json.str prompt)]
8888
let messages := Json.arr #[message]
@@ -95,38 +95,38 @@ def generateRunpod (input : String) (modelName : String) (targetPrefix : String)
9595
("n", Json.num 4)
9696
]
9797
let reqStr := reqJson.pretty 99999999999999999
98-
98+
9999
-- Read HF_TOKEN from .env file in current directory
100100
let envFile := ".env"
101101
let envContent ← IO.FS.readFile envFile
102102
let lines := envContent.splitOn "\n"
103103
let mut token := ""
104104
for line in lines do
105105
if line.startsWith "HF_TOKEN=" then
106-
token := line.drop 9 -- Remove "HF_TOKEN=" prefix
106+
token := (line.drop 9).toString -- Remove "HF_TOKEN=" prefix
107107
if token == "" then
108108
throw $ IO.userError "HF_TOKEN not found in .env file. Please create a .env file with: HF_TOKEN=your_token_here"
109-
109+
110110
-- Make API call
111111
let out ← IO.Process.output {
112112
cmd := "curl"
113113
args := #["-X", "POST", url, "-H", "accept: application/json", "-H", "Content-Type: application/json", "-H", s!"Authorization: Bearer {token}", "-d", reqStr]
114114
}
115115
if out.exitCode != 0 then
116116
throw $ IO.userError s!"Request failed. Please check if the API is accessible at `{url}`."
117-
117+
118118
-- Parse response
119119
let some json := Json.parse out.stdout |>.toOption
120120
| throw $ IO.userError "Failed to parse response"
121-
121+
122122
-- Debug: print raw response
123123
IO.println s!"Raw API response: {out.stdout}"
124-
124+
125125
let some choices := json.getObjVal? "choices" |>.toOption
126126
| throw $ IO.userError "No choices in response"
127127
let some choicesArray := choices.getArr? |>.toOption
128128
| throw $ IO.userError "Choices is not an array"
129-
129+
130130
-- Extract and clean responses (same as Python post_process_output)
131131
let mut results : Array (String × Float) := #[]
132132
for choice in choicesArray do
@@ -140,19 +140,19 @@ def generateRunpod (input : String) (modelName : String) (targetPrefix : String)
140140
let cleaned := if modelName == "deepseek" then
141141
-- Extract content between backticks
142142
if contentStr.startsWith "`" && contentStr.endsWith "`" then
143-
contentStr.drop 1 |>.dropRight 1 -- Remove first and last backtick
143+
contentStr.drop 1 |>.dropEnd 1 -- Remove first and last backtick
144144
else
145145
contentStr
146146
else
147147
contentStr
148-
results := results.push (cleaned, 1.0)
149-
148+
results := results.push (cleaned.toString, 1.0)
149+
150150
-- Deduplicate (same as Python choices_dedup)
151151
let mut uniqueData : List (String × Float) := []
152152
for result in results do
153153
if !uniqueData.any (·.1 == result.1) then
154154
uniqueData := uniqueData.append [result]
155-
155+
156156
return uniqueData.toArray
157157

158158

lean_dojo_v2/external_api/LeanCopilot/Tactics.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def ppTacticState : List MVarId → MetaM String
1616
| [] => return "no goals"
1717
| [g] => return (← Meta.ppGoal g).pretty
1818
| goals =>
19-
return (← goals.foldlM (init := "") (fun a b => do return s!"{a}\n\n{(← Meta.ppGoal b).pretty}")).trim
19+
return (← goals.foldlM (init := "") (fun a b => do return s!"{a}\n\n{(← Meta.ppGoal b).pretty}")).trimAscii.toString
2020

2121

2222
/--
@@ -49,7 +49,7 @@ elab_rules : tactic
4949
| `(tactic | suggest_tactics_deepseek%$tac $pfx:str) => do
5050
let tacticsWithScores ← suggestTactics "deepseek" pfx.getString
5151
let tactics := tacticsWithScores.map (·.1)
52-
let range : String.Range := { start := tac.getRange?.get!.start, stop := pfx.raw.getRange?.get!.stop }
52+
let range : Lean.Syntax.Range := { start := tac.getRange?.get!.start, stop := pfx.raw.getRange?.get!.stop }
5353
let ref := Syntax.ofRange range
5454
hint ref tactics True
5555

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
leanprover/lean4:v4.24.0
1+
leanprover/lean4:v4.27.0-rc1

0 commit comments

Comments
 (0)