Commit 961eee2
authored
fix(openai): Only finish relevant spans in Chat Completions patches (#6190)
OpenAI Completions spans are only created in `_new_sync_chat_completion()` and `_new_async_chat_completion()`.
Exit spans in these functions when the openai library function raises an exception.
Resolves an edge case where `_new_sync_chat_completion()` or `_new_async_chat_completion()` exits early without creating a span, causing `get_current_span()` to return a non-openai span.1 parent ae2cf7c commit 961eee2
1 file changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
709 | 709 | | |
710 | 710 | | |
711 | 711 | | |
712 | | - | |
| 712 | + | |
| 713 | + | |
713 | 714 | | |
714 | 715 | | |
715 | 716 | | |
| |||
776 | 777 | | |
777 | 778 | | |
778 | 779 | | |
779 | | - | |
| 780 | + | |
| 781 | + | |
780 | 782 | | |
781 | 783 | | |
782 | 784 | | |
| |||
0 commit comments