(t *testing.T)
| 43 | } |
| 44 | |
| 45 | func TestTraceAnthropic(t *testing.T) { |
| 46 | t.Parallel() |
| 47 | |
| 48 | expectNonStreaming := []expectTrace{ |
| 49 | {"Intercept", 1, codes.Unset}, |
| 50 | {"Intercept.CreateInterceptor", 1, codes.Unset}, |
| 51 | {"Intercept.RecordInterception", 1, codes.Unset}, |
| 52 | {"Intercept.ProcessRequest", 1, codes.Unset}, |
| 53 | {"Intercept.RecordInterceptionEnded", 1, codes.Unset}, |
| 54 | {"Intercept.RecordPromptUsage", 1, codes.Unset}, |
| 55 | {"Intercept.RecordTokenUsage", 1, codes.Unset}, |
| 56 | {"Intercept.RecordToolUsage", 1, codes.Unset}, |
| 57 | {"Intercept.RecordModelThought", 1, codes.Unset}, |
| 58 | {"Intercept.ProcessRequest.Upstream", 1, codes.Unset}, |
| 59 | } |
| 60 | |
| 61 | expectStreaming := []expectTrace{ |
| 62 | {"Intercept", 1, codes.Unset}, |
| 63 | {"Intercept.CreateInterceptor", 1, codes.Unset}, |
| 64 | {"Intercept.RecordInterception", 1, codes.Unset}, |
| 65 | {"Intercept.ProcessRequest", 1, codes.Unset}, |
| 66 | {"Intercept.RecordInterceptionEnded", 1, codes.Unset}, |
| 67 | {"Intercept.RecordPromptUsage", 1, codes.Unset}, |
| 68 | {"Intercept.RecordTokenUsage", 2, codes.Unset}, |
| 69 | {"Intercept.RecordToolUsage", 1, codes.Unset}, |
| 70 | {"Intercept.RecordModelThought", 1, codes.Unset}, |
| 71 | {"Intercept.ProcessRequest.Upstream", 1, codes.Unset}, |
| 72 | } |
| 73 | |
| 74 | cases := []struct { |
| 75 | name string |
| 76 | fixture []byte |
| 77 | streaming bool |
| 78 | bedrock bool |
| 79 | expect []expectTrace |
| 80 | }{ |
| 81 | { |
| 82 | name: "trace_anthr_non_streaming", |
| 83 | expect: expectNonStreaming, |
| 84 | fixture: fixtures.AntSingleBuiltinTool, |
| 85 | }, |
| 86 | { |
| 87 | name: "trace_bedrock_non_streaming", |
| 88 | bedrock: true, |
| 89 | expect: expectNonStreaming, |
| 90 | fixture: fixtures.AntSingleBuiltinTool, |
| 91 | }, |
| 92 | { |
| 93 | name: "trace_anthr_streaming", |
| 94 | streaming: true, |
| 95 | expect: expectStreaming, |
| 96 | fixture: fixtures.AntSingleBuiltinTool, |
| 97 | }, |
| 98 | { |
| 99 | name: "trace_bedrock_streaming", |
| 100 | streaming: true, |
| 101 | bedrock: true, |
| 102 | expect: expectStreaming, |
nothing calls this directly
no test coverage detected