roboto.ai.summary
Module Contents
AISummary
Bases: pydantic.BaseModel
A wire-transmissible representation of an AI summary
Parameters
data AnyAttributes
AISummaryStatus
Bases: roboto.compat.StrEnum
Status of an AI summary.
Attributes
AISummaryStatus.Pending
The summary is being generated. Its text may be the empty string, or may be a partial result. If you continually poll for the summary while it is in the pending state, you will eventually get the complete summary.
PollingStreamingAISummary
Bases: StreamingAISummary
An implementation of StreamingAISummary which polls for updates.
PollingStreamingAISummary.await_completion()
Wait for the summary to complete.
This will return instantly if the summary is already complete.
Parameters
timeout_s Optional[float]Optional timeout, in seconds, to wait for the summary to complete.
poll_interval_s floatPolling interval, in seconds, to use when waiting for the summary.
Returns
The completed summary.
Raises
If the summary fails to generate.
TimeoutErrorIf the timeout is reached before the summary completes.
Properties
PollingStreamingAISummary.complete_text
The complete text of the summary.
This method will block until the summary is complete.
Raises
If the summary fails to generate,
Return type
PollingStreamingAISummary.text_stream()
Stream the text of the summary as it is generated.
This will yield the entire summary instantly if the summary is already complete. If the summary is not complete, this will yield the text as it is generated.
Parameters
timeout_s Optional[float]Optional timeout, in seconds, to wait for the summary to complete.
poll_interval_s floatPolling interval, in seconds, to use when waiting for the summary.
Yields
The text of the summary as it is generated.
Raises
If the summary fails to generate.
TimeoutErrorIf the timeout is reached before the summary completes.
Return type
StreamingAISummary
Bases: Protocol
A streaming interface for an AI summary.
Roboto AI summaries are typically generated asynchronously, and can be viewed as either a point-in-time partially (or fully) complete snapshot, or as a stream of characters. This class provides a single interface for accessing the summary in both ways.
StreamingAISummary.await_completion()
Wait for the summary to complete.
This will return instantly if the summary is already complete.
Parameters
timeout_s Optional[float]Optional timeout, in seconds, to wait for the summary to complete.
poll_interval_s floatPolling interval, in seconds, to use when waiting for the summary.
Returns
The completed summary.
Raises
If the summary fails to generate.
TimeoutErrorIf the timeout is reached before the summary completes.
Properties
StreamingAISummary.complete_text
The complete text of the summary.
This method will block until the summary is complete.
Raises
If the summary fails to generate,
Return type
StreamingAISummary.text_stream()
Stream the text of the summary as it is generated.
This will yield the entire summary instantly if the summary is already complete. If the summary is not complete, this will yield the text as it is generated.
Parameters
timeout_s Optional[float]Optional timeout, in seconds, to wait for the summary to complete.
poll_interval_s floatPolling interval, in seconds, to use when waiting for the summary.
Yields
The text of the summary as it is generated.
Raises
If the summary fails to generate.
TimeoutErrorIf the timeout is reached before the summary completes.
Return type