mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-08 22:42:05 +00:00
community[patch]: Add classifier_url argument in PebbloSafeLoader and documentation update. (#21030)
Description: Add classifier_url argument in PebbloSafeLoader. Documentation: Updated PebbloSafeLoader documentation with above change and new links for pebblo github pages. --------- Signed-off-by: Rahul Tripathi <rauhl.psit.ec@gmail.com> Co-authored-by: Rahul Tripathi <rauhl.psit.ec@gmail.com>
This commit is contained in:
@@ -45,6 +45,7 @@ class PebbloSafeLoader(BaseLoader):
|
||||
description: str = "",
|
||||
api_key: Optional[str] = None,
|
||||
load_semantic: bool = False,
|
||||
classifier_url: Optional[str] = None,
|
||||
):
|
||||
if not name or not isinstance(name, str):
|
||||
raise NameError("Must specify a valid name.")
|
||||
@@ -63,6 +64,7 @@ class PebbloSafeLoader(BaseLoader):
|
||||
self.source_type = get_loader_type(loader_name)
|
||||
self.source_path_size = self.get_source_size(self.source_path)
|
||||
self.source_aggregate_size = 0
|
||||
self.classifier_url = classifier_url or CLASSIFIER_URL
|
||||
self.loader_details = {
|
||||
"loader": loader_name,
|
||||
"source_path": self.source_path,
|
||||
@@ -210,7 +212,7 @@ class PebbloSafeLoader(BaseLoader):
|
||||
self.source_aggregate_size
|
||||
)
|
||||
payload = Doc(**payload).dict(exclude_unset=True)
|
||||
load_doc_url = f"{CLASSIFIER_URL}{LOADER_DOC_URL}"
|
||||
load_doc_url = f"{self.classifier_url}{LOADER_DOC_URL}"
|
||||
classified_docs = []
|
||||
try:
|
||||
pebblo_resp = requests.post(
|
||||
@@ -296,7 +298,7 @@ class PebbloSafeLoader(BaseLoader):
|
||||
"Content-Type": "application/json",
|
||||
}
|
||||
payload = self.app.dict(exclude_unset=True)
|
||||
app_discover_url = f"{CLASSIFIER_URL}{APP_DISCOVER_URL}"
|
||||
app_discover_url = f"{self.classifier_url}{APP_DISCOVER_URL}"
|
||||
try:
|
||||
pebblo_resp = requests.post(
|
||||
app_discover_url, headers=headers, json=payload, timeout=20
|
||||
|
Reference in New Issue
Block a user