Skip to content

Commit

Permalink
feat(generative_ai): minor code update to extensions list sample (#12682
Browse files Browse the repository at this point in the history
)

* feat(generative_ai): minor code update to extensions list sample

* feat(generative_ai):update import order
  • Loading branch information
CadillacBurgess1 authored Oct 8, 2024
1 parent 6ae0b7e commit 66eca62
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion generative_ai/extensions/extensions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,5 @@ def test_get_extension(extension_id: str) -> None:

def test_list_extensions() -> None:
response = list_example.list_extensions()
assert "/extensions/" in response[1].resource_name
# assert "/extensions/" in response[1].resource_name
isinstance(response, list)
6 changes: 3 additions & 3 deletions generative_ai/extensions/list_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ def list_extensions() -> List[extensions.Extension]:
# PROJECT_ID = "your-project-id"
vertexai.init(project=PROJECT_ID, location="us-central1")

extensions = extensions.Extension.list()
print(extensions)
extensions_list = extensions.Extension.list()
print(extensions_list)
# Example response:
# [<vertexai.extensions._extensions.Extension object at 0x76e8ced37af0>
# resource name: projects/[PROJECT_ID]/locations/us-central1/extensions/1234567890123456]

# [END generativeaionvertexai_list_extensions]
return extensions
return extensions_list


if __name__ == "__main__":
Expand Down

0 comments on commit 66eca62

Please sign in to comment.