in google/generativeai/generative_models.py [0:0]
def __repr__(self) -> str:
_dict_repr = reprlib.Repr()
_model = str(self.model).replace("\n", "\n" + " " * 4)
def content_repr(x):
return f"protos.Content({_dict_repr.repr(type(x).to_dict(x))})"
try:
history = list(self.history)
except (generation_types.BrokenResponseError, generation_types.IncompleteIterationError):
history = list(self._history)
if self._last_sent is not None:
history.append(self._last_sent)
history = [content_repr(x) for x in history]
last_received = self._last_received
if last_received is not None:
if last_received._error is not None:
history.append("<STREAMING ERROR>")
else:
history.append("<STREAMING IN PROGRESS>")
_history = ",\n " + f"history=[{', '.join(history)}]\n)"
return (
textwrap.dedent(
f"""\
ChatSession(
model="""
)
+ _model
+ _history
)