def add_artifact(
        self,
        filename: PathType,
        name: Optional[str] = None,
        metadata: Optional[dict] = None,
        content_type: Optional[str] = None,
    ) -> None:
        """Add a file as an artifact.

        In Sacred terminology an artifact is a file produced by the experiment
        run. In case of a MongoObserver that means storing the file in the
        database.

        This function can only be called during a run, and just calls the
        :py:meth:`sacred.run.Run.add_artifact` method.

        Parameters
        ----------
        filename
            name of the file to be stored as artifact
        name
            optionally set the name of the artifact.
            Defaults to the relative file-path.
        metadata
            optionally attach metadata to the artifact.
            This only has an effect when using the MongoObserver.
        content_type
            optionally attach a content-type to the artifact.
            This only has an effect when using the MongoObserver.
        """
        assert self.current_run is not None, "Can only be called during a run."
        self.current_run.add_artifact(filename, name, metadata, content_type)
Add a file as an artifact.

        In Sacred terminology an artifact is a file produced by the experiment
        run. In case of a MongoObserver that means storing the file in the
        database.

        This function can only be called during a run, and just calls the
        :py:meth:`sacred.run.Run.add_artifact` method.

        Parameters
        ----------
        filename
            name of the file to be stored as artifact
        name
            optionally set the name of the artifact.
            Defaults to the relative file-path.
        metadata
            optionally attach metadata to the artifact.
            This only has an effect when using the MongoObserver.
        content_type
            optionally attach a content-type to the artifact.
            This only has an effect when using the MongoObserver.
        
sacred/experiment.py