Skip to content

Commit 176cd38

Browse files
fix: corrected types.Part.from_data with types.Part.from_bytes in docs/artifacts/index.md (#259)
Co-authored-by: Lavi Nigam <[email protected]>
1 parent 66e9242 commit 176cd38

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

docs/artifacts/index.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ In ADK, **Artifacts** represent a crucial mechanism for managing named, versione
3131
)
3232

3333
# You can also use the convenience constructor:
34-
# image_artifact_alt = types.Part.from_data(data=image_bytes, mime_type="image/png")
34+
# image_artifact_alt = types.Part.from_bytes(data=image_bytes, mime_type="image/png")
3535

3636
print(f"Artifact MIME Type: {image_artifact.inline_data.mime_type}")
3737
print(f"Artifact Data (first 10 bytes): {image_artifact.inline_data.data[:10]}...")
@@ -174,7 +174,6 @@ Understanding artifacts involves grasping a few key components: the service that
174174
* `data` (`bytes`): The raw binary content of the artifact.
175175
* `mime_type` (`str`): A standard MIME type string (e.g., `'application/pdf'`, `'image/png'`, `'audio/mpeg'`) describing the nature of the binary data. **This is crucial for correct interpretation when loading the artifact.**
176176

177-
178177
=== "Python"
179178

180179
```python
@@ -190,11 +189,11 @@ Understanding artifacts involves grasping a few key components: the service that
190189
)
191190

192191
# Using the convenience class method (equivalent)
193-
pdf_artifact_alt_py = types.Part.from_data(data=pdf_bytes, mime_type=pdf_mime_type)
192+
pdf_artifact_alt_py = types.Part.from_bytes(data=pdf_bytes, mime_type=pdf_mime_type)
194193

195194
print(f"Created Python artifact with MIME type: {pdf_artifact_py.inline_data.mime_type}")
196195
```
197-
196+
198197
=== "Java"
199198

200199
```java
@@ -767,4 +766,4 @@ To use artifacts effectively and maintainably:
767766
* **Cleanup Strategy:** For persistent storage like `GcsArtifactService`, artifacts remain until explicitly deleted. If artifacts represent temporary data or have a limited lifespan, implement a strategy for cleanup. This might involve:
768767
* Using GCS lifecycle policies on the bucket.
769768
* Building specific tools or administrative functions that utilize the `artifact_service.delete_artifact` method (note: delete is *not* exposed via context objects for safety).
770-
* Carefully managing filenames to allow pattern-based deletion if needed.
769+
* Carefully managing filenames to allow pattern-based deletion if needed.

0 commit comments

Comments
 (0)