File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 11from __future__ import annotations
22
3+ import base64
34from typing import TYPE_CHECKING , Literal , overload
45
56from ._content import (
@@ -168,7 +169,7 @@ def chatlas_content_as_inspect(content: ContentUnion) -> InspectContent:
168169 return itool .ContentImage (image = content .data or "" , detail = "auto" )
169170 elif isinstance (content , ContentPDF ):
170171 return itool .ContentDocument (
171- document = content .data .decode ("utf-8 " ),
172+ document = base64 . b64encode ( content .data ) .decode ("ascii " ),
172173 mime_type = "application/pdf" ,
173174 filename = content .filename ,
174175 )
@@ -208,7 +209,7 @@ def inspect_content_as_chatlas(content: str | InspectContent) -> Content:
208209 if isinstance (content , itool .ContentDocument ):
209210 if content .mime_type == "application/pdf" :
210211 return ContentPDF (
211- data = content .document . encode ( "utf-8" ),
212+ data = base64 . b64decode ( content .document ),
212213 filename = content .filename ,
213214 )
214215 else :
You can’t perform that action at this time.
0 commit comments