mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-22 06:39:52 +00:00
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>
This commit is contained in:
parent
b54b19ba1c
commit
5f1d1666e3
@ -287,6 +287,7 @@ class PebbloSafeLoader(BaseLoader):
|
|||||||
|
|
||||||
def _send_discover(self) -> None:
|
def _send_discover(self) -> None:
|
||||||
"""Send app discovery payload to pebblo-server. Internal method."""
|
"""Send app discovery payload to pebblo-server. Internal method."""
|
||||||
|
pebblo_resp = None
|
||||||
headers = {
|
headers = {
|
||||||
"Accept": "application/json",
|
"Accept": "application/json",
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@ -326,6 +327,18 @@ class PebbloSafeLoader(BaseLoader):
|
|||||||
if self.api_key:
|
if self.api_key:
|
||||||
try:
|
try:
|
||||||
headers.update({"x-api-key": self.api_key})
|
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_url = f"{PEBBLO_CLOUD_URL}{APP_DISCOVER_URL}"
|
||||||
pebblo_cloud_response = requests.post(
|
pebblo_cloud_response = requests.post(
|
||||||
pebblo_cloud_url, headers=headers, json=payload, timeout=20
|
pebblo_cloud_url, headers=headers, json=payload, timeout=20
|
||||||
|
Loading…
Reference in New Issue
Block a user