MCPcopy Index your code
hub / github.com/docker/docker-agent / runWithCache

Function runWithCache

pkg/runtime/cache_test.go:18–37  ·  view source on GitHub ↗
(t *testing.T, c *cache.Cache, prov *messageRecordingProvider, sess *session.Session)

Source from the content-addressed store, hash-verified

16)
17
18func runWithCache(t *testing.T, c *cache.Cache, prov *messageRecordingProvider, sess *session.Session) []Event {
19 t.Helper()
20
21 root := agent.New("root", "You are a test agent",
22 agent.WithModel(prov),
23 agent.WithCache(c),
24 )
25 tm := team.New(team.WithAgents(root))
26
27 rt, err := NewLocalRuntime(t.Context(), tm, WithSessionCompaction(false), WithModelStore(mockModelStore{}))
28 require.NoError(t, err)
29 sess.Title = "cache test"
30
31 evCh := rt.RunStream(t.Context(), sess)
32 var events []Event
33 for ev := range evCh {
34 events = append(events, ev)
35 }
36 return events
37}
38
39// TestCache_StoresAndReplaysAnswer verifies that a cache miss invokes the model
40// once, and a subsequent identical question is served from the cache without

Calls 10

RunStreamMethod · 0.95
NewFunction · 0.92
WithModelFunction · 0.92
WithCacheFunction · 0.92
NewFunction · 0.92
WithAgentsFunction · 0.92
NewLocalRuntimeFunction · 0.85
WithSessionCompactionFunction · 0.85
WithModelStoreFunction · 0.85
ContextMethod · 0.80

Tested by

no test coverage detected