Skip to content

Commit

Permalink
community[patch]: Add support for pebblo server and client version (#…
Browse files Browse the repository at this point in the history
…20269)

**Description**:
_PebbloSafeLoader_: Add support for pebblo server and client version


**Documentation:** NA
**Unit test:** NA
**Issue:** NA
**Dependencies:**  None

---------

Co-authored-by: Bagatur <[email protected]>
  • Loading branch information
dristysrivastava and baskaryan authored Apr 25, 2024
1 parent b54b19b commit 5f1d166
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions libs/community/langchain_community/document_loaders/pebblo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5f1d166

Please sign in to comment.