File tree Expand file tree Collapse file tree 1 file changed +4
-19
lines changed Expand file tree Collapse file tree 1 file changed +4
-19
lines changed Original file line number Diff line number Diff line change 3737from openai .types .responses .response_output_text import (
3838 Annotation as ResponsesAnnotation ,
3939)
40- from openai .types .responses .response_output_text import (
41- AnnotationContainerFileCitation ,
42- AnnotationFileCitation ,
43- AnnotationFilePath ,
44- AnnotationURLCitation ,
45- )
4640from pydantic import BaseModel , ConfigDict , SkipValidation , TypeAdapter
4741from typing_extensions import assert_never
4842
@@ -232,19 +226,10 @@ def _convert_content(content: Content) -> AssistantMessageContent:
232226
233227def _convert_annotation (raw_annotation : object ) -> Annotation | None :
234228 # There is a bug in the OpenAPI client that sometimes parses the annotation delta event into the wrong class
235- # resulting into annotation being a dict.
236- match raw_annotation :
237- case (
238- AnnotationFileCitation ()
239- | AnnotationURLCitation ()
240- | AnnotationContainerFileCitation ()
241- | AnnotationFilePath ()
242- ):
243- annotation = raw_annotation
244- case _:
245- annotation = TypeAdapter [ResponsesAnnotation ](
246- ResponsesAnnotation
247- ).validate_python (raw_annotation )
229+ # resulting into annotation being a dict or untyped object instead instead of a ResponsesAnnotation
230+ annotation = TypeAdapter [ResponsesAnnotation ](ResponsesAnnotation ).validate_python (
231+ raw_annotation
232+ )
248233
249234 if annotation .type == "file_citation" :
250235 filename = annotation .filename
You can’t perform that action at this time.
0 commit comments