MCPcopy
hub / github.com/weaviate/weaviate / BenchmarkEncoderCache

Function BenchmarkEncoderCache

modules/text2vec-openai/vectorizer/batch_test.go:135–157  ·  view source on GitHub ↗
(b *testing.B)

Source from the content-addressed store, hash-verified

133}
134
135func BenchmarkEncoderCache(b *testing.B) {
136 client := &fakeBatchClient{}
137 logger, _ := test.NewNullLogger()
138
139 v := text2vecbase.New(client,
140 batch.NewBatchVectorizer(client, 50*time.Second,
141 batch.Settings{MaxObjectsPerBatch: 100, MaxTokensPerBatch: func(cfg moduletools.ClassConfig) int { return 500000 }, MaxTimePerBatch: 10, HasTokenLimit: true, ReturnsRateLimit: true},
142 logger, "test"),
143 batch.ReturnBatchTokenizer(1, "", false),
144 )
145 deadline := time.Now().Add(10 * time.Second)
146 cfg := &fakeClassConfig{vectorizePropertyName: false, classConfig: map[string]interface{}{"vectorizeClassName": false}}
147 b.ResetTimer()
148 for i := 0; i < b.N; i++ {
149 ctx, cancl := context.WithDeadline(context.Background(), deadline)
150 vecs, errs := v.ObjectBatch(
151 ctx, []*models.Object{{Class: "Car"}}, []bool{false}, cfg,
152 )
153 cancl()
154 require.Len(b, errs, 0)
155 require.Len(b, vecs, 1)
156 }
157}

Callers

nothing calls this directly

Calls 7

NewFunction · 0.92
NewBatchVectorizerFunction · 0.92
ReturnBatchTokenizerFunction · 0.92
AddMethod · 0.65
NowMethod · 0.65
ObjectBatchMethod · 0.65
LenMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…