Skip to content

Commit 09640fc

Browse files
authored
implement LLM benchmark (#1129)
1 parent 0a9dbff commit 09640fc

File tree

9 files changed

+392
-87
lines changed

9 files changed

+392
-87
lines changed

cmd/gorse-benchmark/main.go

Lines changed: 268 additions & 76 deletions
Large diffs are not rendered by default.

common/parallel/parallel_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ func TestParallelCancel(t *testing.T) {
163163
cancel()
164164
}
165165
count.Add(1)
166-
time.Sleep(100 * time.Millisecond)
166+
time.Sleep(time.Second)
167167
return nil
168168
})
169169

dataset/dataset.go

Lines changed: 53 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import (
1818
"bufio"
1919
"fmt"
2020
"os"
21+
"sort"
2122
"strconv"
2223
"strings"
2324
"time"
@@ -42,6 +43,8 @@ type CFSplit interface {
4243
CountItems() int
4344
// CountFeedback returns the number of (positive) feedback.
4445
CountFeedback() int
46+
// GetItems returns the items.
47+
GetItems() []data.Item
4548
// GetUserDict returns the frequency dictionary of users.
4649
GetUserDict() *FreqDict
4750
// GetItemDict returns the frequency dictionary of items.
@@ -79,6 +82,7 @@ type Dataset struct {
7982
itemLabels *Labels
8083
userFeedback [][]int32
8184
itemFeedback [][]int32
85+
timestamps [][]time.Time
8286
negatives [][]int32
8387
userDict *FreqDict
8488
itemDict *FreqDict
@@ -95,6 +99,7 @@ func NewDataset(timestamp time.Time, userCount, itemCount int) *Dataset {
9599
itemLabels: NewLabels(),
96100
userFeedback: make([][]int32, userCount),
97101
itemFeedback: make([][]int32, itemCount),
102+
timestamps: make([][]time.Time, userCount),
98103
userDict: NewFreqDict(),
99104
itemDict: NewFreqDict(),
100105
categories: make(map[string]int),
@@ -203,6 +208,9 @@ func (d *Dataset) AddUser(user data.User) {
203208
if len(d.userFeedback) < len(d.users) {
204209
d.userFeedback = append(d.userFeedback, nil)
205210
}
211+
if len(d.timestamps) < len(d.users) {
212+
d.timestamps = append(d.timestamps, nil)
213+
}
206214
}
207215

208216
func (d *Dataset) AddItem(item data.Item) {
@@ -223,11 +231,12 @@ func (d *Dataset) AddItem(item data.Item) {
223231
}
224232
}
225233

226-
func (d *Dataset) AddFeedback(userId, itemId string) {
234+
func (d *Dataset) AddFeedback(userId, itemId string, timestamp time.Time) {
227235
userIndex := d.userDict.Add(userId)
228236
itemIndex := d.itemDict.Add(itemId)
229237
d.userFeedback[userIndex] = append(d.userFeedback[userIndex], itemIndex)
230238
d.itemFeedback[itemIndex] = append(d.itemFeedback[itemIndex], userIndex)
239+
d.timestamps[userIndex] = append(d.timestamps[userIndex], timestamp)
231240
d.numFeedback++
232241
}
233242

@@ -253,6 +262,7 @@ func (d *Dataset) SplitCF(numTestUsers int, seed int64) (CFSplit, CFSplit) {
253262
trainSet.items, testSet.items = d.items, d.items
254263
trainSet.userFeedback, testSet.userFeedback = make([][]int32, d.CountUsers()), make([][]int32, d.CountUsers())
255264
trainSet.itemFeedback, testSet.itemFeedback = make([][]int32, d.CountItems()), make([][]int32, d.CountItems())
265+
trainSet.timestamps, testSet.timestamps = make([][]time.Time, d.CountUsers()), make([][]time.Time, d.CountUsers())
256266
trainSet.userDict, testSet.userDict = d.userDict, d.userDict
257267
trainSet.itemDict, testSet.itemDict = d.itemDict, d.itemDict
258268
rng := util.NewRandomGenerator(seed)
@@ -262,11 +272,13 @@ func (d *Dataset) SplitCF(numTestUsers int, seed int64) (CFSplit, CFSplit) {
262272
k := rng.Intn(len(d.userFeedback[userIndex]))
263273
testSet.userFeedback[userIndex] = append(testSet.userFeedback[userIndex], d.userFeedback[userIndex][k])
264274
testSet.itemFeedback[d.userFeedback[userIndex][k]] = append(testSet.itemFeedback[d.userFeedback[userIndex][k]], userIndex)
275+
testSet.timestamps[userIndex] = append(testSet.timestamps[userIndex], d.timestamps[userIndex][k])
265276
testSet.numFeedback++
266277
for i, itemIndex := range d.userFeedback[userIndex] {
267278
if i != k {
268279
trainSet.userFeedback[userIndex] = append(trainSet.userFeedback[userIndex], itemIndex)
269280
trainSet.itemFeedback[itemIndex] = append(trainSet.itemFeedback[itemIndex], userIndex)
281+
trainSet.timestamps[userIndex] = append(trainSet.timestamps[userIndex], d.timestamps[userIndex][i])
270282
trainSet.numFeedback++
271283
}
272284
}
@@ -279,11 +291,13 @@ func (d *Dataset) SplitCF(numTestUsers int, seed int64) (CFSplit, CFSplit) {
279291
k := rng.Intn(len(d.userFeedback[userIndex]))
280292
testSet.userFeedback[userIndex] = append(testSet.userFeedback[userIndex], d.userFeedback[userIndex][k])
281293
testSet.itemFeedback[d.userFeedback[userIndex][k]] = append(testSet.itemFeedback[d.userFeedback[userIndex][k]], userIndex)
294+
testSet.timestamps[userIndex] = append(testSet.timestamps[userIndex], d.timestamps[userIndex][k])
282295
testSet.numFeedback++
283296
for i, itemIndex := range d.userFeedback[userIndex] {
284297
if i != k {
285298
trainSet.userFeedback[userIndex] = append(trainSet.userFeedback[userIndex], itemIndex)
286299
trainSet.itemFeedback[itemIndex] = append(trainSet.itemFeedback[itemIndex], userIndex)
300+
trainSet.timestamps[userIndex] = append(trainSet.timestamps[userIndex], d.timestamps[userIndex][i])
287301
trainSet.numFeedback++
288302
}
289303
}
@@ -292,9 +306,10 @@ func (d *Dataset) SplitCF(numTestUsers int, seed int64) (CFSplit, CFSplit) {
292306
testUserSet := mapset.NewSet(testUsers...)
293307
for userIndex := int32(0); userIndex < int32(d.CountUsers()); userIndex++ {
294308
if !testUserSet.Contains(userIndex) {
295-
for _, itemIndex := range d.userFeedback[userIndex] {
309+
for idx, itemIndex := range d.userFeedback[userIndex] {
296310
trainSet.userFeedback[userIndex] = append(trainSet.userFeedback[userIndex], itemIndex)
297311
trainSet.itemFeedback[itemIndex] = append(trainSet.itemFeedback[itemIndex], userIndex)
312+
trainSet.timestamps[userIndex] = append(trainSet.timestamps[userIndex], d.timestamps[userIndex][idx])
298313
trainSet.numFeedback++
299314
}
300315
}
@@ -303,6 +318,39 @@ func (d *Dataset) SplitCF(numTestUsers int, seed int64) (CFSplit, CFSplit) {
303318
return trainSet, testSet
304319
}
305320

321+
// SplitLatest splits dataset by moving the most recent feedback of all users into the test set to avoid leakage.
322+
func (d *Dataset) SplitLatest(shots int) (CFSplit, CFSplit) {
323+
trainSet, testSet := new(Dataset), new(Dataset)
324+
trainSet.users, testSet.users = d.users, d.users
325+
trainSet.items, testSet.items = d.items, d.items
326+
trainSet.userFeedback, testSet.userFeedback = make([][]int32, d.CountUsers()), make([][]int32, d.CountUsers())
327+
trainSet.itemFeedback, testSet.itemFeedback = make([][]int32, d.CountItems()), make([][]int32, d.CountItems())
328+
trainSet.timestamps, testSet.timestamps = make([][]time.Time, d.CountUsers()), make([][]time.Time, d.CountUsers())
329+
trainSet.userDict, testSet.userDict = d.userDict, d.userDict
330+
trainSet.itemDict, testSet.itemDict = d.itemDict, d.itemDict
331+
for userIndex := int32(0); userIndex < int32(d.CountUsers()); userIndex++ {
332+
if len(d.userFeedback[userIndex]) == 0 {
333+
continue
334+
}
335+
idxs := lo.Range(len(d.userFeedback[userIndex]))
336+
sort.Slice(idxs, func(i, j int) bool {
337+
return d.timestamps[userIndex][idxs[i]].After(d.timestamps[userIndex][idxs[j]])
338+
})
339+
testSet.timestamps[userIndex] = append(testSet.timestamps[userIndex], d.timestamps[userIndex][idxs[0]])
340+
testSet.itemFeedback[d.userFeedback[userIndex][idxs[0]]] = append(testSet.itemFeedback[d.userFeedback[userIndex][idxs[0]]], userIndex)
341+
testSet.userFeedback[userIndex] = append(testSet.userFeedback[userIndex], d.userFeedback[userIndex][idxs[0]])
342+
testSet.numFeedback++
343+
for i := 1; i < len(d.userFeedback[userIndex]) && i <= shots; i++ {
344+
itemIndex := d.userFeedback[userIndex][idxs[i]]
345+
trainSet.userFeedback[userIndex] = append(trainSet.userFeedback[userIndex], itemIndex)
346+
trainSet.itemFeedback[itemIndex] = append(trainSet.itemFeedback[itemIndex], userIndex)
347+
trainSet.timestamps[userIndex] = append(trainSet.timestamps[userIndex], d.timestamps[userIndex][idxs[i]])
348+
trainSet.numFeedback++
349+
}
350+
}
351+
return trainSet, testSet
352+
}
353+
306354
type Labels struct {
307355
fields *strutil.Pool
308356
values *FreqDict
@@ -366,6 +414,7 @@ func LoadDataFromBuiltIn(dataSetName string) (*Dataset, *Dataset, error) {
366414
test.userDict, test.itemDict = train.userDict, train.itemDict
367415
test.userFeedback = make([][]int32, len(train.userFeedback))
368416
test.itemFeedback = make([][]int32, len(train.itemFeedback))
417+
test.timestamps = make([][]time.Time, len(train.userFeedback))
369418
test.negatives = make([][]int32, len(train.userFeedback))
370419
err = loadTest(test, testFilePath)
371420
if err != nil {
@@ -404,7 +453,7 @@ func loadTrain(path string) (*Dataset, error) {
404453
dataset.AddItem(data.Item{ItemId: util.FormatInt(i)})
405454
}
406455
// add feedback
407-
dataset.AddFeedback(fields[0], fields[1])
456+
dataset.AddFeedback(fields[0], fields[1], time.Time{})
408457
}
409458
return dataset, scanner.Err()
410459
}
@@ -429,7 +478,7 @@ func loadTest(dataset *Dataset, path string) error {
429478
positive = positive[1 : len(positive)-1]
430479
fields = strings.Split(positive, ",")
431480
// add feedback
432-
dataset.AddFeedback(fields[0], fields[1])
481+
dataset.AddFeedback(fields[0], fields[1], time.Time{})
433482
// add negatives
434483
userId, err := strconv.Atoi(fields[0])
435484
if err != nil {

dataset/dataset_test.go

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package dataset
1616

1717
import (
1818
"fmt"
19+
"math"
1920
"strconv"
2021
"testing"
2122
"time"
@@ -159,14 +160,15 @@ func TestDataset_AddFeedback(t *testing.T) {
159160
}
160161
for i := 0; i < 10; i++ {
161162
for j := i; j < 10; j++ {
162-
dataSet.AddFeedback(strconv.Itoa(i), strconv.Itoa(j))
163+
dataSet.AddFeedback(strconv.Itoa(i), strconv.Itoa(j), time.Unix(int64(i*10+j), 0))
163164
}
164165
}
165166
userIDF := dataSet.GetUserIDF()
166167
itemIDF := dataSet.GetItemIDF()
167168
for i := 0; i < 10; i++ {
168169
assert.Len(t, dataSet.GetUserFeedback()[i], 10-i)
169170
assert.Len(t, dataSet.GetItemFeedback()[i], i+1)
171+
assert.Len(t, dataSet.timestamps[i], 10-i)
170172
assert.InDelta(t, math32.Log(float32(10)/float32(10-i)), userIDF[i], 1e-2)
171173
assert.InDelta(t, math32.Log(float32(10)/float32(i+1)), itemIDF[i], 1e-2)
172174
}
@@ -184,7 +186,7 @@ func TestDataset_Split(t *testing.T) {
184186
}
185187
for i := 0; i < numUsers; i++ {
186188
for j := i + 1; j < numItems; j++ {
187-
dataset.AddFeedback(fmt.Sprintf("user%v", i), fmt.Sprintf("item%v", j))
189+
dataset.AddFeedback(fmt.Sprintf("user%v", i), fmt.Sprintf("item%v", j), time.Time{})
188190
}
189191
}
190192
assert.Equal(t, 9, dataset.CountFeedback())
@@ -206,6 +208,37 @@ func TestDataset_Split(t *testing.T) {
206208
assert.Equal(t, 2, test2.CountFeedback())
207209
}
208210

211+
func TestDataset_SplitLatest(t *testing.T) {
212+
const numUsers, numItems = 3, 5
213+
// create dataset
214+
dataset := NewDataset(time.Now(), numUsers, numItems)
215+
for i := 0; i < numUsers; i++ {
216+
dataset.AddUser(data.User{UserId: fmt.Sprintf("user%v", i)})
217+
}
218+
for i := 0; i < numItems; i++ {
219+
dataset.AddItem(data.Item{ItemId: fmt.Sprintf("item%v", i)})
220+
}
221+
for i := 0; i < numUsers; i++ {
222+
for j := i + 1; j < numItems; j++ {
223+
dataset.AddFeedback(fmt.Sprintf("user%v", i), fmt.Sprintf("item%v", j), time.Unix(int64(j), 0))
224+
}
225+
}
226+
assert.Equal(t, 9, dataset.CountFeedback())
227+
// split
228+
train, test := dataset.SplitLatest(math.MaxInt)
229+
assert.Equal(t, numUsers, train.CountUsers())
230+
assert.Equal(t, numItems, train.CountItems())
231+
assert.Equal(t, numUsers, test.CountUsers())
232+
assert.Equal(t, numItems, test.CountItems())
233+
assert.Equal(t, 6, train.CountFeedback())
234+
assert.Equal(t, 3, test.CountFeedback())
235+
for i := 0; i < numUsers; i++ {
236+
assert.Len(t, train.GetUserFeedback()[i], numItems-i-2)
237+
assert.Len(t, test.GetUserFeedback()[i], 1)
238+
assert.Equal(t, 4, int(test.GetUserFeedback()[i][0]))
239+
}
240+
}
241+
209242
func TestDataset_LoadMovieLens1M(t *testing.T) {
210243
train, test, err := LoadDataFromBuiltIn("ml-1m")
211244
assert.NoError(t, err)

go.mod

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ require (
4040
github.com/minio/minio-go/v7 v7.0.97
4141
github.com/modern-go/reflect2 v1.0.2
4242
github.com/nikolalohinski/gonja/v2 v2.5.0
43+
github.com/olekukonko/tablewriter v1.1.3
4344
github.com/pkg/errors v0.9.1
4445
github.com/prometheus/client_golang v1.13.0
4546
github.com/rakyll/statik v0.1.8
@@ -107,13 +108,17 @@ require (
107108
github.com/buger/jsonparser v1.1.1 // indirect
108109
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
109110
github.com/cespare/xxhash/v2 v2.3.0 // indirect
111+
github.com/clipperhouse/displaywidth v0.6.2 // indirect
112+
github.com/clipperhouse/stringish v0.1.1 // indirect
113+
github.com/clipperhouse/uax29/v2 v2.3.0 // indirect
110114
github.com/cncf/xds/go v0.0.0-20251022180443-0feb69152e9f // indirect
111115
github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect
112116
github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
113117
github.com/dlclark/regexp2 v1.11.5 // indirect
114118
github.com/dustin/go-humanize v1.0.1 // indirect
115119
github.com/envoyproxy/go-control-plane/envoy v1.35.0 // indirect
116120
github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect
121+
github.com/fatih/color v1.18.0 // indirect
117122
github.com/felixge/httpsnoop v1.0.4 // indirect
118123
github.com/fsnotify/fsnotify v1.9.0 // indirect
119124
github.com/gabriel-vasile/mimetype v1.4.10 // indirect
@@ -153,14 +158,19 @@ require (
153158
github.com/klauspost/crc32 v1.3.0 // indirect
154159
github.com/leodido/go-urn v1.4.0 // indirect
155160
github.com/mailru/easyjson v0.7.7 // indirect
161+
github.com/mattn/go-colorable v0.1.14 // indirect
156162
github.com/mattn/go-isatty v0.0.20 // indirect
163+
github.com/mattn/go-runewidth v0.0.19 // indirect
157164
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 // indirect
158165
github.com/minio/crc64nvme v1.1.1 // indirect
159166
github.com/minio/md5-simd v1.1.2 // indirect
160167
github.com/mitchellh/colorstring v0.0.0-20190213212951-d06e56a500db // indirect
161168
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
162169
github.com/montanaflynn/stats v0.7.1 // indirect
163170
github.com/ncruces/go-strftime v1.0.0 // indirect
171+
github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6 // indirect
172+
github.com/olekukonko/errors v1.1.0 // indirect
173+
github.com/olekukonko/ll v0.1.4-0.20260115111900-9e59c2286df0 // indirect
164174
github.com/openzipkin/zipkin-go v0.4.1 // indirect
165175
github.com/pelletier/go-toml v1.9.5 // indirect
166176
github.com/pelletier/go-toml/v2 v2.2.4 // indirect

go.sum

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,12 @@ github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWR
132132
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
133133
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
134134
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
135+
github.com/clipperhouse/displaywidth v0.6.2 h1:ZDpTkFfpHOKte4RG5O/BOyf3ysnvFswpyYrV7z2uAKo=
136+
github.com/clipperhouse/displaywidth v0.6.2/go.mod h1:R+kHuzaYWFkTm7xoMmK1lFydbci4X2CicfbGstSGg0o=
137+
github.com/clipperhouse/stringish v0.1.1 h1:+NSqMOr3GR6k1FdRhhnXrLfztGzuG+VuFDfatpWHKCs=
138+
github.com/clipperhouse/stringish v0.1.1/go.mod h1:v/WhFtE1q0ovMta2+m+UbpZ+2/HEXNWYXQgCt4hdOzA=
139+
github.com/clipperhouse/uax29/v2 v2.3.0 h1:SNdx9DVUqMoBuBoW3iLOj4FQv3dN5mDtuqwuhIGpJy4=
140+
github.com/clipperhouse/uax29/v2 v2.3.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g=
135141
github.com/cloudflare/cfssl v0.0.0-20190808011637-b1ec8c586c2a/go.mod h1:yMWuSON2oQp+43nFtAV/uvKQIFpSPerB57DCt9t8sSA=
136142
github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc=
137143
github.com/cncf/xds/go v0.0.0-20251022180443-0feb69152e9f h1:Y8xYupdHxryycyPlc9Y+bSQAYZnetRJ70VMVKm5CKI0=
@@ -192,6 +198,8 @@ github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5/go.mod h1:a
192198
github.com/expr-lang/expr v1.17.6 h1:1h6i8ONk9cexhDmowO/A64VPxHScu7qfSl2k8OlINec=
193199
github.com/expr-lang/expr v1.17.6/go.mod h1:8/vRC7+7HBzESEqt5kKpYXxrxkr31SaO8r40VO/1IT4=
194200
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
201+
github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM=
202+
github.com/fatih/color v1.18.0/go.mod h1:4FelSpRwEGDpQ12mAdzqdOukCy4u8WUtOY6lkT/6HfU=
195203
github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg=
196204
github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
197205
github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
@@ -552,6 +560,8 @@ github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaO
552560
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
553561
github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
554562
github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
563+
github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHPsaIE=
564+
github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8=
555565
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
556566
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
557567
github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
@@ -562,8 +572,8 @@ github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWE
562572
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
563573
github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
564574
github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
565-
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
566-
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
575+
github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byFGLdw=
576+
github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
567577
github.com/mattn/go-sqlite3 v1.14.0/go.mod h1:JIl7NbARA7phWnGvh0LKTyg7S9BA+6gx71ShQilpsus=
568578
github.com/mattn/go-sqlite3 v1.14.5/go.mod h1:WVKg1VTActs4Qso6iwGbiFih2UIHo0ENGwNd0Lj+XmI=
569579
github.com/mattn/go-sqlite3 v1.14.12/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=
@@ -606,6 +616,14 @@ github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLA
606616
github.com/nikolalohinski/gonja/v2 v2.5.0 h1:O59grn57yCFEeTdHGzYPzg2gGeh4MgroC2ArQJ9pry0=
607617
github.com/nikolalohinski/gonja/v2 v2.5.0/go.mod h1:UIzXPVuOsr5h7dZ5DUbqk3/Z7oFA/NLGQGMjqT4L2aU=
608618
github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U=
619+
github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6 h1:zrbMGy9YXpIeTnGj4EljqMiZsIcE09mmF8XsD5AYOJc=
620+
github.com/olekukonko/cat v0.0.0-20250911104152-50322a0618f6/go.mod h1:rEKTHC9roVVicUIfZK7DYrdIoM0EOr8mK1Hj5s3JjH0=
621+
github.com/olekukonko/errors v1.1.0 h1:RNuGIh15QdDenh+hNvKrJkmxxjV4hcS50Db478Ou5sM=
622+
github.com/olekukonko/errors v1.1.0/go.mod h1:ppzxA5jBKcO1vIpCXQ9ZqgDh8iwODz6OXIGKU8r5m4Y=
623+
github.com/olekukonko/ll v0.1.4-0.20260115111900-9e59c2286df0 h1:jrYnow5+hy3WRDCBypUFvVKNSPPCdqgSXIE9eJDD8LM=
624+
github.com/olekukonko/ll v0.1.4-0.20260115111900-9e59c2286df0/go.mod h1:b52bVQRRPObe+yyBl0TxNfhesL0nedD4Cht0/zx55Ew=
625+
github.com/olekukonko/tablewriter v1.1.3 h1:VSHhghXxrP0JHl+0NnKid7WoEmd9/urKRJLysb70nnA=
626+
github.com/olekukonko/tablewriter v1.1.3/go.mod h1:9VU0knjhmMkXjnMKrZ3+L2JhhtsQ/L38BbL3CRNE8tM=
609627
github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE=
610628
github.com/onsi/ginkgo/v2 v2.23.4 h1:ktYTpKJAVZnDT4VjxSbiBenUjmlL/5QkBEocaWXiQus=
611629
github.com/onsi/ginkgo/v2 v2.23.4/go.mod h1:Bt66ApGPBFzHyR+JO10Zbt0Gsp4uWxu5mIOTusL46e8=

logics/chat.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ func (r *ChatRanker) Rank(ctx context.Context, user *data.User, feedback []*Feed
8282
Role: openai.ChatMessageRoleUser,
8383
Content: buf.String(),
8484
}},
85+
ChatTemplateKwargs: map[string]any{
86+
"enable_thinking": false,
87+
},
8588
})
8689
if err == nil {
8790
return resp, nil

master/tasks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ func (m *Master) LoadDataFromDatabase(
479479
break
480480
}
481481
}
482-
dataSet.AddFeedback(f.UserId, f.ItemId)
482+
dataSet.AddFeedback(f.UserId, f.ItemId, f.Timestamp)
483483
}
484484
span.Add(len(feedback))
485485
}

model/cf/evaluator_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func TestEvaluate(t *testing.T) {
144144
}
145145
for i := 0; i < 16; i++ {
146146
test.AddItem(data.Item{ItemId: strconv.Itoa(i)})
147-
test.AddFeedback(strconv.Itoa(i/4), strconv.Itoa(i))
147+
test.AddFeedback(strconv.Itoa(i/4), strconv.Itoa(i), time.Time{})
148148
}
149149
assert.Equal(t, 16, test.CountFeedback())
150150
assert.Equal(t, 4, test.CountUsers())

0 commit comments

Comments
 (0)