ContentPartGetResponse
Response interface for ContentPart with convenience methods for accessing data.
Provides helper properties and methods to determine if content is stored inline or externally, and to retrieve the data accordingly.
Example¶
const contentPart = message.contentParts[0];
// Check storage type
if (contentPart.isDataInline) {
const data = await contentPart.getData(); // Returns string
} else if (contentPart.isDataExternal) {
const response = await contentPart.getData(); // Returns fetch Response
}
Extends¶
Properties¶
| Property | Modifier | Type | Description |
|---|---|---|---|
citations |
public |
Citation[] |
Array of citations referenced in this content part. |
contentPartId |
public |
string |
Unique identifier for the content part within the message. |
createdTime |
public |
string |
Timestamp indicating when the content part was created. |
data |
public |
ContentPartData |
The actual content data. |
id |
public |
string |
Unique identifier for the content part. |
isDataExternal |
readonly |
boolean |
Returns true if data is stored externally (as a URI reference) |
isDataInline |
readonly |
boolean |
Returns true if data is stored inline (as a string value) |
isIncomplete? |
public |
boolean |
Indicates whether this content part may be incomplete. |
isTranscript? |
public |
boolean |
Indicates whether this content part is a transcript produced by the LLM. |
mimeType |
public |
string |
The MIME type of the content. |
name? |
public |
string |
Optional name for the content part. |
updatedTime |
public |
string |
Timestamp indicating when the content part was last updated. |
Methods¶
getData()¶
getData():
Promise<string|Response>
Retrieves the content data.
Returns¶
Promise<string | Response>
For inline data: the string content. For external data: a fetch Response.