(t *testing.T, c *cache.Cache, prov *messageRecordingProvider, sess *session.Session)
| 16 | ) |
| 17 | |
| 18 | func 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 |
no test coverage detected