@@ -340,6 +340,9 @@ GetAttachments[ messages_ ] :=
340340GetAttachments [ messages : $$chatMessages |None , prop : $$attachmentProperty |All ] :=
341341 catchMine @ getAttachments [ messages , prop ];
342342
343+ GetAttachments [ content_ , prop : $$attachmentProperty |All ] :=
344+ catchMine @ getAttachments [ ensureChatMessages @ content , prop ];
345+
343346GetAttachments // endExportedDefinition ;
344347
345348(* TODO: this should identify expression and tool call keys from earlier sessions and give Missing[...] for those *)
@@ -378,6 +381,31 @@ getAttachments[ messages_, prop: $$attachmentProperty ] := Enclose[
378381
379382getAttachments // endDefinition ;
380383
384+ (* ::**************************************************************************************************************:: *)
385+ (* ::Section::Closed:: *)
386+ (*LoadAttachments*)
387+ LoadAttachments // beginDefinition ;
388+ LoadAttachments [ as_ Association ] := catchMine @ LoadAttachments [ "Expressions" , as ];
389+ LoadAttachments [ type : "Expressions" |"ToolCalls" , as_ Association ] := catchMine @ loadAttachments [ type , as ];
390+ LoadAttachments // endExportedDefinition ;
391+
392+ (* ::**************************************************************************************************************:: *)
393+ (* ::Subsection::Closed:: *)
394+ (*loadAttachments*)
395+ loadAttachments // beginDefinition ;
396+
397+ loadAttachments [ "Expressions" , expressions_ Association ] := Enclose [
398+ $attachments = ConfirmBy [ < | $attachments , expressions |> , AssociationQ , "Attachments" ],
399+ throwInternalFailure
400+ ];
401+
402+ loadAttachments [ "ToolCalls" , toolCalls_ Association ] := Enclose [
403+ $toolEvaluationResults = ConfirmBy [ < | $toolEvaluationResults , toolCalls |> , AssociationQ , "ToolCalls" ],
404+ throwInternalFailure
405+ ];
406+
407+ loadAttachments // endDefinition ;
408+
381409(* ::**************************************************************************************************************:: *)
382410(* ::Section::Closed:: *)
383411(*Package Footer*)
0 commit comments