def attachment_dict()

in aidial_sdk/chat_completion/chunks.py [0:0]


    def attachment_dict(self, index: int):
        attachment: Dict[str, Any] = {"index": index}

        if self.type:
            attachment["type"] = self.type
        if self.title:
            attachment["title"] = self.title
        if self.data:
            attachment["data"] = self.data
        if self.url:
            attachment["url"] = self.url
        if self.reference_url:
            attachment["reference_url"] = self.reference_url
        if self.reference_type:
            attachment["reference_type"] = self.reference_type

        return attachment