View source on GitHub |
This is the async version of genai.GenerateContentResponse
.
google.generativeai.types.AsyncGenerateContentResponse(
done: bool,
iterator: (None | Iterable[protos.GenerateContentResponse] | AsyncIterable[protos.
GenerateContentResponse]),
result: protos.GenerateContentResponse,
chunks: (Iterable[protos.GenerateContentResponse] | None) = None
)
Attributes | |
---|---|
candidates
|
The list of candidate responses. |
parts
|
A quick accessor equivalent to self.candidates[0].content.parts
|
prompt_feedback
|
|
text
|
A quick accessor equivalent to self.candidates[0].content.parts[0].text
|
usage_metadata
|
Methods
from_aiterator
from_aiterator(
iterator
)
from_response
@classmethod
from_response( response: protos.GenerateContentResponse )
resolve
resolve()
to_dict
to_dict()
Returns the result as a JSON-compatible dict.
import json
response = model.generate_content('Hello?')
json.dumps(response.to_dict())