The generating of functional of a (scalar) quantum field theory with field operator $\Phi(x)$ is defined by $$Z[f]=\langle 0 |e^{i \int d^dx \, \Phi(x) f(x)} |0\rangle, \tag{1} \label{1}$$ where $f(x)$ is a classical external source. $Z[f]$ has a simple physical interpration: suppose the external source was initially (i.e. for $t\to -\infty$) turned off and the system was in its ground state (vacuum state) $|0\rangle$t some point, the external source $f$ is switched on, "shakes" the system and is finally switched off again. $Z[f]$ is nothing else than the transition amplitude that the system is found again in the ground state for $t\to +\infty$. For this reason, the generating functional is sometimes written as $$Z[f]=\langle 0 |0\rangle_{f} \tag{2}$$ meaning "vaccum to vacuum transition amplitude in the presence of the external source $f$", where $\langle0|0\rangle_{f=0} =1$ by definition.
The path integral representation of the generating functional, $$Z[f]=\int [d\phi] \, e^{iS[\phi]+ \phi \cdot f} \quad \text{with} \quad \phi\cdot f =\!\int \!d^dx \, \phi(x) f(x) \quad \text{and} \quad Z[0]=1, \tag{3}$$ is just an alternative method for the computation of the generating functional.
Performing the corresponding calculations for the simple quantum mechanical harmonic oscillator in the presence of an external source $f(t)$ (in fact an external time-dependent force) using the operator formalism as well as the path integral technique is highly recommended!
Edit: To be more specific, consider the Hamilton operator $$H= H_0-\underbrace{\int d^3x \, \Phi(t, \vec{x}) f(t, \vec{x})}_{H_1(t)}, \tag{4}$$ where $H_0$ refers to some (in general) interacting scalar field theory. The time evolution of the operators in the interaction picture (IP) is given by $$A_{\rm IP}(t)= e^{iH_0t} A_{\rm IP}(0) e^{-iH_0t}, \tag{5}$$ whereas the full time evolution of the expectation value of the corresponding observable in some state $|\psi_H \rangle$ is given by $$\langle \psi_H | U^\dagger(t) A_{\rm IP}(t) U(t) |\psi_H\rangle, \qquad U(t)= {\rm T} e^{-i\int\limits_0^T d\tau \, H_{1, \rm IP}(\tau)}. \tag{7} $$ The state vectors in the Heisenberg picture and the interaction picture are related by $$|\psi_{\rm IP}(t)\rangle = U(t) |\psi_H\rangle. \tag{8}$$ We assume that the time dependent term $H_1(t)$ vanishes for $t \to \pm \infty$ (i.e. the external source tends to zero both in the remote past and the far future). Suppose the motion starts in the ground state $|0\rangle$ of the unperturbed system (i.e. $H_0 |0\rangle=0$) we have $$\lim\limits_{t \to -\infty} |\psi_{\rm IP}(t) \rangle = |0\rangle, \tag{9}$$ or, equivalently, $$U(-\infty)\! \! \! \! \underbrace{|0, \rm in\rangle}_{\text{Heisenberg state}}\! \! \! \! = |0\rangle, \tag{10}$$ such that $$ |0, {\rm in} \rangle = {\rm T} e^{-i \int\limits_{-\infty}^0 \! d\tau \, H_{1, \rm IP}(\tau)} |0\rangle. \tag{11}$$ In the course of time, the state vector moves away from the ground state, $$|\psi_{\rm IP}(t)\rangle = {\rm T} e^{-i \int\limits_{-\infty}^t \! d \tau \, H_{1, \rm IP}(\tau)}|0\rangle \tag{12}$$ until it does not change anymore once the external source is switched off. For $H_1 \equiv 0$, the state vector $|\psi_{\rm IP}(+\infty)\rangle$ would coincide with the ground state of $H_0$ , but in the presence of $H_1(t)$ it does in general not represent an eigenstate of $H_0$. The perturbation violates time-translation invariance and energy is not conserved. The vector $|\psi_{\rm IP}(t)\rangle$ becomes a superposition of eigenstates of $H_0$. The probability amplitude that the system is found in the ground state at $t\to \infty$ is thus given by $$ \langle 0 | {\rm T} e^{-i \int\limits_{-\infty}^\infty \! d\tau \, H_{1,\rm IP}(\tau)} |0\rangle =\langle 0, {\rm out}|0, {\rm in} \rangle_{H_1(t)}, \tag{13}$$ making contact with the discussion above.