(t *testing.T)
| 430 | } |
| 431 | |
| 432 | func TestTraceOpenAI(t *testing.T) { |
| 433 | t.Parallel() |
| 434 | |
| 435 | cases := []struct { |
| 436 | name string |
| 437 | fixture []byte |
| 438 | streaming bool |
| 439 | path string |
| 440 | |
| 441 | expect []expectTrace |
| 442 | }{ |
| 443 | { |
| 444 | name: "trace_openai_chat_streaming", |
| 445 | fixture: fixtures.OaiChatSimple, |
| 446 | streaming: true, |
| 447 | path: pathOpenAIChatCompletions, |
| 448 | expect: []expectTrace{ |
| 449 | {"Intercept", 1, codes.Unset}, |
| 450 | {"Intercept.CreateInterceptor", 1, codes.Unset}, |
| 451 | {"Intercept.RecordInterception", 1, codes.Unset}, |
| 452 | {"Intercept.ProcessRequest", 1, codes.Unset}, |
| 453 | {"Intercept.RecordInterceptionEnded", 1, codes.Unset}, |
| 454 | {"Intercept.RecordPromptUsage", 1, codes.Unset}, |
| 455 | {"Intercept.RecordTokenUsage", 1, codes.Unset}, |
| 456 | {"Intercept.ProcessRequest.Upstream", 1, codes.Unset}, |
| 457 | }, |
| 458 | }, |
| 459 | { |
| 460 | name: "trace_openai_chat_blocking", |
| 461 | fixture: fixtures.OaiChatSimple, |
| 462 | streaming: false, |
| 463 | path: pathOpenAIChatCompletions, |
| 464 | expect: []expectTrace{ |
| 465 | {"Intercept", 1, codes.Unset}, |
| 466 | {"Intercept.CreateInterceptor", 1, codes.Unset}, |
| 467 | {"Intercept.RecordInterception", 1, codes.Unset}, |
| 468 | {"Intercept.ProcessRequest", 1, codes.Unset}, |
| 469 | {"Intercept.RecordInterceptionEnded", 1, codes.Unset}, |
| 470 | {"Intercept.RecordPromptUsage", 1, codes.Unset}, |
| 471 | {"Intercept.RecordTokenUsage", 1, codes.Unset}, |
| 472 | {"Intercept.ProcessRequest.Upstream", 1, codes.Unset}, |
| 473 | }, |
| 474 | }, |
| 475 | { |
| 476 | name: "trace_openai_responses_streaming", |
| 477 | fixture: fixtures.OaiResponsesStreamingSimple, |
| 478 | streaming: true, |
| 479 | path: pathOpenAIResponses, |
| 480 | expect: []expectTrace{ |
| 481 | {"Intercept", 1, codes.Unset}, |
| 482 | {"Intercept.CreateInterceptor", 1, codes.Unset}, |
| 483 | {"Intercept.RecordInterception", 1, codes.Unset}, |
| 484 | {"Intercept.ProcessRequest", 1, codes.Unset}, |
| 485 | {"Intercept.RecordInterceptionEnded", 1, codes.Unset}, |
| 486 | {"Intercept.RecordPromptUsage", 1, codes.Unset}, |
| 487 | {"Intercept.RecordTokenUsage", 1, codes.Unset}, |
| 488 | {"Intercept.ProcessRequest.Upstream", 1, codes.Unset}, |
| 489 | }, |
nothing calls this directly
no test coverage detected