From 5f1d1666e342c2daa203740517e66bafc39cd14d Mon Sep 17 00:00:00 2001 From: Dristy Srivastava <58721149+dristysrivastava@users.noreply.github.com> Date: Fri, 26 Apr 2024 02:09:17 +0530 Subject: [PATCH] community[patch]: Add support for pebblo server and client version (#20269) **Description**: _PebbloSafeLoader_: Add support for pebblo server and client version **Documentation:** NA **Unit test:** NA **Issue:** NA **Dependencies:** None --------- Co-authored-by: Bagatur <22008038+baskaryan@users.noreply.github.com> --- .../langchain_community/document_loaders/pebblo.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libs/community/langchain_community/document_loaders/pebblo.py b/libs/community/langchain_community/document_loaders/pebblo.py index 8b348826293cc..9dd466e496a42 100644 --- a/libs/community/langchain_community/document_loaders/pebblo.py +++ b/libs/community/langchain_community/document_loaders/pebblo.py @@ -287,6 +287,7 @@ def calculate_content_size(page_content: str) -> int: def _send_discover(self) -> None: """Send app discovery payload to pebblo-server. Internal method.""" + pebblo_resp = None headers = { "Accept": "application/json", "Content-Type": "application/json", @@ -326,6 +327,18 @@ def _send_discover(self) -> None: if self.api_key: try: headers.update({"x-api-key": self.api_key}) + if pebblo_resp: + pebblo_resp_docs = json.loads(pebblo_resp.text).get("docs") + payload.update( + { + "pebbloServerVersion": pebblo_resp_docs.get( + "pebbloServerVersion" + ), + "pebbloClientVersion": pebblo_resp_docs.get( + "pebbloClientVersion" + ), + } + ) pebblo_cloud_url = f"{PEBBLO_CLOUD_URL}{APP_DISCOVER_URL}" pebblo_cloud_response = requests.post( pebblo_cloud_url, headers=headers, json=payload, timeout=20