From 3e5cda3405ec1aa369fe90253d88f3e26a03db10 Mon Sep 17 00:00:00 2001 From: Erick Friis Date: Thu, 24 Aug 2023 17:41:54 -0700 Subject: [PATCH] Hub Push Ergonomics (#9731) Improves the hub pushing experience, returning a url instead of just a commit hash. Requires hub sdk 0.1.8 --- libs/langchain/langchain/hub.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libs/langchain/langchain/hub.py b/libs/langchain/langchain/hub.py index 21e7348ea63..0c0d2d0fef9 100644 --- a/libs/langchain/langchain/hub.py +++ b/libs/langchain/langchain/hub.py @@ -34,7 +34,7 @@ def push( new_repo_description: str = "", ) -> str: """ - Pushes an object to the hub and returns the new commit hash. + Pushes an object to the hub and returns the URL it can be viewed at in a browser. :param repo_full_name: The full name of the repo to push to in the format of `owner/repo`. @@ -51,15 +51,14 @@ def push( """ client = _get_client(api_url=api_url, api_key=api_key) manifest_json = dumps(object) - resp = client.push( + message = client.push( repo_full_name, manifest_json, parent_commit_hash=parent_commit_hash, new_repo_is_public=new_repo_is_public, new_repo_description=new_repo_description, ) - commit_hash: str = resp["commit"]["commit_hash"] - return commit_hash + return message def pull(