package modelserve import ( "slices" "testing" ) func TestLlamaCppIsGivenTheSlotsTheCatalogPromises(t *testing.T) { // A 32768 pool for 32768-token requests is one slot: the engine's own // four made slots of 8192, and requests the gateway admitted were refused. for _, c := range []struct { pool, ctx int want []string }{ {32768, 32768, []string{"--ctx-size", "32768", "--parallel", "1"}}, {16384, 4096, []string{"--ctx-size", "16384", "--parallel", "4"}}, {65536, 16384, []string{"--ctx-size", "65536", "--parallel", "4"}}, } { if got := llamaArgs(Request{CtxPool: c.pool, ContextLength: c.ctx}); !slices.Equal(got, c.want) { t.Errorf("pool %d, context %d: %v", c.pool, c.ctx, got) } } } func TestTheLongestAnswerGrowsWithTheContext(t *testing.T) { for ctx, want := range map[int]int{2048: 1024, 4096: 1024, 16384: 4096, 32768: 8192, 131072: 8192} { if got := maxOutput(ctx); got != want { t.Errorf("context %d: max output %d, want %d", ctx, got, want) } } }