@@ -49,7 +49,7 @@ func TestPrefixPluginCompletion(t *testing.T) {
4949 req1 := & types.LLMRequest {
5050 RequestId : uuid .NewString (),
5151 TargetModel : "test-model1" ,
52- Data : & types.LLMRequestData {
52+ Body : & types.LLMRequestBody {
5353 Completions : & types.CompletionsRequest {
5454 Prompt : "aaaaaa" ,
5555 },
@@ -81,7 +81,7 @@ func TestPrefixPluginCompletion(t *testing.T) {
8181 req2 := & types.LLMRequest {
8282 RequestId : uuid .NewString (),
8383 TargetModel : "test-model2" ,
84- Data : & types.LLMRequestData {
84+ Body : & types.LLMRequestBody {
8585 Completions : & types.CompletionsRequest {
8686 Prompt : "bbbbbb" ,
8787 },
@@ -112,7 +112,7 @@ func TestPrefixPluginCompletion(t *testing.T) {
112112 req3 := & types.LLMRequest {
113113 RequestId : uuid .NewString (),
114114 TargetModel : "test-model1" ,
115- Data : & types.LLMRequestData {
115+ Body : & types.LLMRequestBody {
116116 Completions : & types.CompletionsRequest {
117117 Prompt : "aaaabbbb" ,
118118 },
@@ -142,7 +142,7 @@ func TestPrefixPluginCompletion(t *testing.T) {
142142 req4 := & types.LLMRequest {
143143 RequestId : uuid .NewString (),
144144 TargetModel : "test-model-new" ,
145- Data : & types.LLMRequestData {
145+ Body : & types.LLMRequestBody {
146146 Completions : & types.CompletionsRequest {
147147 Prompt : "aaaabbbb" ,
148148 },
@@ -172,7 +172,7 @@ func TestPrefixPluginCompletion(t *testing.T) {
172172 req5 := & types.LLMRequest {
173173 RequestId : uuid .NewString (),
174174 TargetModel : "test-model1" ,
175- Data : & types.LLMRequestData {
175+ Body : & types.LLMRequestBody {
176176 Completions : & types.CompletionsRequest {
177177 Prompt : "aaaabbbbcccc" ,
178178 },
@@ -214,7 +214,7 @@ func TestPrefixPluginChatCompletions(t *testing.T) {
214214 req1 := & types.LLMRequest {
215215 RequestId : uuid .NewString (),
216216 TargetModel : "test-model1" ,
217- Data : & types.LLMRequestData {
217+ Body : & types.LLMRequestBody {
218218 ChatCompletions : & types.ChatCompletionsRequest {
219219 Messages : []types.Message {
220220 {Role : "user" , Content : "hello world" },
@@ -223,8 +223,8 @@ func TestPrefixPluginChatCompletions(t *testing.T) {
223223 },
224224 },
225225 }
226- scores := plugin .Score (context .Background (), nil , req1 , pods )
227- state , err := plugins .ReadPluginStateKey [* SchedulingContextState ](plugin .pluginState , req1 .RequestId , PrefixCachePluginType )
226+ scores := plugin .Score (context .Background (), types . NewCycleState () , req1 , pods )
227+ state , err := plugins .ReadPluginStateKey [* SchedulingContextState ](plugin .pluginState , req1 .RequestId , plugins . StateKey ( plugin . TypedName (). String ()) )
228228 assert .NoError (t , err )
229229 t .Logf ("Chat completions - Hashes %+v, cached servers: %+v" , state .PrefixHashes , state .PrefixCacheServers )
230230 // Should have some hashes for the JSON-encoded messages
@@ -249,7 +249,7 @@ func TestPrefixPluginChatCompletionsGrowth(t *testing.T) {
249249 req1 := & types.LLMRequest {
250250 RequestId : uuid .NewString (),
251251 TargetModel : "test-model1" ,
252- Data : & types.LLMRequestData {
252+ Body : & types.LLMRequestBody {
253253 ChatCompletions : & types.ChatCompletionsRequest {
254254 Messages : []types.Message {
255255 {Role : "system" , Content : "You are a helpful assistant" },
@@ -258,8 +258,8 @@ func TestPrefixPluginChatCompletionsGrowth(t *testing.T) {
258258 },
259259 },
260260 }
261- scores := plugin .Score (context .Background (), nil , req1 , pods )
262- state , err := plugins .ReadPluginStateKey [* SchedulingContextState ](plugin .pluginState , req1 .RequestId , PrefixCachePluginType )
261+ scores := plugin .Score (context .Background (), types . NewCycleState () , req1 , pods )
262+ state , err := plugins .ReadPluginStateKey [* SchedulingContextState ](plugin .pluginState , req1 .RequestId , plugins . StateKey ( plugin . TypedName (). String ()) )
263263 assert .NoError (t , err )
264264 t .Logf ("Initial conversation - Hashes %+v, cached servers: %+v" , len (state .PrefixHashes ), state .PrefixCacheServers )
265265 initialHashCount := len (state .PrefixHashes )
@@ -281,7 +281,7 @@ func TestPrefixPluginChatCompletionsGrowth(t *testing.T) {
281281 req2 := & types.LLMRequest {
282282 RequestId : uuid .NewString (),
283283 TargetModel : "test-model1" ,
284- Data : & types.LLMRequestData {
284+ Body : & types.LLMRequestBody {
285285 ChatCompletions : & types.ChatCompletionsRequest {
286286 Messages : []types.Message {
287287 {Role : "system" , Content : "You are a helpful assistant" },
@@ -292,8 +292,8 @@ func TestPrefixPluginChatCompletionsGrowth(t *testing.T) {
292292 },
293293 },
294294 }
295- scores = plugin .Score (context .Background (), nil , req2 , pods )
296- state , err = plugins .ReadPluginStateKey [* SchedulingContextState ](plugin .pluginState , req2 .RequestId , PrefixCachePluginType )
295+ scores = plugin .Score (context .Background (), types . NewCycleState () , req2 , pods )
296+ state , err = plugins .ReadPluginStateKey [* SchedulingContextState ](plugin .pluginState , req2 .RequestId , plugins . StateKey ( plugin . TypedName (). String ()) )
297297 assert .NoError (t , err )
298298 t .Logf ("Extended conversation - Hashes %+v, cached servers: %+v" , len (state .PrefixHashes ), state .PrefixCacheServers )
299299 extendedHashCount := len (state .PrefixHashes )
@@ -313,7 +313,7 @@ func TestPrefixPluginChatCompletionsGrowth(t *testing.T) {
313313 req3 := & types.LLMRequest {
314314 RequestId : uuid .NewString (),
315315 TargetModel : "test-model1" ,
316- Data : & types.LLMRequestData {
316+ Body : & types.LLMRequestBody {
317317 ChatCompletions : & types.ChatCompletionsRequest {
318318 Messages : []types.Message {
319319 {Role : "system" , Content : "You are a helpful assistant" },
@@ -326,8 +326,8 @@ func TestPrefixPluginChatCompletionsGrowth(t *testing.T) {
326326 },
327327 },
328328 }
329- scores = plugin .Score (context .Background (), nil , req3 , pods )
330- state , err = plugins .ReadPluginStateKey [* SchedulingContextState ](plugin .pluginState , req3 .RequestId , PrefixCachePluginType )
329+ scores = plugin .Score (context .Background (), types . NewCycleState () , req3 , pods )
330+ state , err = plugins .ReadPluginStateKey [* SchedulingContextState ](plugin .pluginState , req3 .RequestId , plugins . StateKey ( plugin . TypedName (). String ()) )
331331 assert .NoError (t , err )
332332 t .Logf ("Long conversation - Hashes %+v, cached servers: %+v" , len (state .PrefixHashes ), state .PrefixCacheServers )
333333 longHashCount := len (state .PrefixHashes )
@@ -375,7 +375,7 @@ func BenchmarkPrefixPluginStress(b *testing.B) {
375375 req := & types.LLMRequest {
376376 RequestId : uuid .NewString (),
377377 TargetModel : "model-stress" ,
378- Data : & types.LLMRequestData {
378+ Body : & types.LLMRequestBody {
379379 Completions : & types.CompletionsRequest {
380380 Prompt : prompt ,
381381 },
@@ -396,7 +396,7 @@ func BenchmarkPrefixPluginStress(b *testing.B) {
396396 // Second cycle: validate internal state
397397 state , err := plugins .ReadPluginStateKey [* SchedulingContextState ](plugin .pluginState , req .RequestId , plugins .StateKey (plugin .TypedName ().String ()))
398398 assert .NoError (b , err )
399- expectedHashes := int (math .Min (float64 (maxPrefixBlocks ), float64 (len (req .Data .Completions .Prompt )/ blockSize )))
399+ expectedHashes := int (math .Min (float64 (maxPrefixBlocks ), float64 (len (req .Body .Completions .Prompt )/ blockSize )))
400400 assert .Equal (b , expectedHashes , len (state .PrefixHashes ), "number of hashes is incorrect" )
401401 }
402402}
@@ -464,7 +464,7 @@ func BenchmarkPrefixPluginChatCompletionsStress(b *testing.B) {
464464 req := & types.LLMRequest {
465465 RequestId : uuid .NewString (),
466466 TargetModel : "chat-model-stress" ,
467- Data : & types.LLMRequestData {
467+ Body : & types.LLMRequestBody {
468468 ChatCompletions : & types.ChatCompletionsRequest {
469469 Messages : messages ,
470470 },
0 commit comments