Skip to content

Commit 103b9e6

Browse files
committed
cleaner
1 parent 367da6d commit 103b9e6

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

chatkit/agents.py

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,6 @@
3737
from 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-
)
4640
from pydantic import BaseModel, ConfigDict, SkipValidation, TypeAdapter
4741
from typing_extensions import assert_never
4842

@@ -232,19 +226,10 @@ def _convert_content(content: Content) -> AssistantMessageContent:
232226

233227
def _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

0 commit comments

Comments
 (0)