Skip to content

Commit 3cd45ec

Browse files
Merge pull request #3830 from Kilo-Org/eamon/autocomplete_test
A few more accept/reject choices in the autocomplete evals
2 parents f325d2f + 9f1cd29 commit 3cd45ec

File tree

39 files changed

+509
-1
lines changed

39 files changed

+509
-1
lines changed

src/test-llm-autocompletion/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
Standalone test suite for AutoTriggerStrategy with real LLM calls using approval testing.
44

5+
## Setup
6+
7+
1. Copy `.env.example` to `.env`:
8+
```bash
9+
cd src/test-llm-autocompletion
10+
cp .env.example .env
11+
```
12+
Then configure your kilocode API key in `.env`:
13+
514
## Approval Testing
615

716
This test suite uses approval testing instead of regex pattern matching to validate LLM autocompletion outputs.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
async function fetchWithRetry(url, maxRetries = 3) {
2+
for (let attempt = 0; attempt < maxRetries; attempt++) {
3+
try {
4+
return await fetch(url);
5+
} catch (error) {
6+
if (attempt === maxRetries - 1) throw error;
7+
await new Promise(resolve => setTimeout(resolve, 1000 * (attempt + 1)));
8+
}
9+
}
10+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
function test() {
2+
console.log('hello');
3+
console.log('world')
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
function test() {
2+
console.log('hello');
3+
}
4+
5+
function test2() {
6+
console.log('hello2');
7+
}
8+
9+
function test3() {
10+
console.log('hello3');
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
const arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
2+
3+
for (let i = 0; i < arr.length; i++) {
4+
console.log(arr[i]);
5+
}
6+
7+
console.log("-----------------------------");
8+
9+
for (let i = arr.length - 1; i >= 0; i--) {
10+
console.log(arr[i]);
11+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
console.log('test');
2+
3+
const a = 10;
4+
const b = 20;
5+
6+
console.log(a + b);
7+
8+
const c = 30;
9+
const d = 40;
10+
11+
console.log(c + d);
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class User {
2+
constructor(username, email, role) {
3+
this.username = username;
4+
this.email = email;
5+
this.role = role;
6+
}
7+
}
8+
9+
module.exports = User;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class User
2+
def initialize(username, email, role)
3+
@username = username
4+
@email = email
5+
@role = role
6+
end
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
class User
2+
def initialize(username, email, role)
3+
@username = username
4+
@email = email
5+
@role = role
6+
end
7+
8+
def username
9+
@username
10+
end
11+
12+
def email
13+
@email
14+
end
15+
16+
def role
17+
@role
18+
end
19+
20+
def to_s
21+
"#{@username} (#{@email})"
22+
end
23+
end
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
class Animal
2+
def initialize(name)
3+
@name = name
4+
end
5+
end
6+
7+
class Dog < Animal
8+
def initialize(name, breed)
9+
super(name)
10+
@breed = breed
11+
end
12+
end
13+
14+
class Cat < Animal
15+
def initialize(name, color)
16+
super(name)
17+
@color = color
18+
end
19+
end

0 commit comments

Comments
 (0)