ArtifactService interface get_artifact_version function-2 #796 - 9#808
Closed
adk-bot wants to merge 1 commit into
Closed
ArtifactService interface get_artifact_version function-2 #796 - 9#808adk-bot wants to merge 1 commit into
adk-bot wants to merge 1 commit into
Conversation
Collaborator
|
#20 BaseArtifactService to include the new list_artifact_versions and get_artifact_version methods Example of Implementation from abc import ABC, abstractmethod
class BaseArtifactService(ABC):
@abstractmethod
def list_artifact_versions(self, name: str): pass
@abstractmethod
def get_artifact_version(self, name: str, version: int): pass
class SimpleArtifactService(BaseArtifactService):
def __init__(self):
# Mock data: { artifact_name: [list of version dicts] }
self.data = {
"model": [{"v": 1, "uri": "gs://v1"}, {"v": 2, "uri": "gs://v2"}]
}
def list_artifact_versions(self, name: str):
return self.data.get(name, [])
def get_artifact_version(self, name: str, version: int):
return next((x for x in self.data.get(name, []) if x["v"] == version), None)
# Usage
service = SimpleArtifactService()
print("Versions:", service.list_artifact_versions("model"))
print("Version 2:", service.get_artifact_version("model", 2))Common Use CasesArtifacts provide a flexible way to handle binary data within your ADK applications. Here are some typical scenarios where they prove valuable: Generated Reports/Files:
Interface:Defined by the abstract base class
Docs already added: |
Collaborator
|
Issue already closed, documentation added above |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request updates the documentation for the
BaseArtifactServiceto include the newlist_artifact_versionsandget_artifact_versionmethods, as requested in issue #796.