3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-31 23:34:55 +00:00

added ai scripts

This commit is contained in:
Nikolaj Bjorner 2025-02-13 21:11:58 -08:00
parent 9fad15e2ca
commit 719ea6a2a7
5 changed files with 260 additions and 77 deletions

View file

@ -3,30 +3,9 @@ script({
files: "code_slices/muz/spacer/orig_spacer_antiunify.cpp_anti_unifier.cpp"
})
import { invokeLLMOpt } from "./myai.genai.mts";
async function invokeLLMUpdate(code) {
const answer = await runPrompt(
(_) => {
_.def("CODE", code);
_.$`
You are a highly experienced compiler engineer with over 20 years of expertise,
specializing in C and C++ programming. Your deep knowledge of best coding practices
and software engineering principles enables you to produce robust, efficient, and
maintainable code in any scenario.
Please modify the original code in <CODE> to ensure that it uses best practices for optimal code execution.' `
}, {
system: [],
systemSafety: false
}
)
console.log(answer.text);
return answer.text;
}
const inputFile = env.files[0];
const file = await workspace.readText(inputFile);
const answer = await invokeLLMUpdate(file.content);
const outputFile = inputFile.filename + ".opt";
let file = env.files[0];
let answer = await invokeLLMOpt(file);
const outputFile = file.filename + ".opt";
await workspace.writeText(outputFile, answer);