Extend CleverSwarm codebase with PDF and Machine and Worker IDs ISSUES CLOSED: #1
This commit was merged in pull request #2.
This commit is contained in:
@@ -19,6 +19,7 @@ CleverSwarm - text to knowledge graph extraction benchmark client.
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Dict, List, Set
|
||||
|
||||
@@ -221,6 +222,8 @@ class BenchmarkCLI(object):
|
||||
print("Type: {}".format(job["type"]))
|
||||
print("Status: {}".format(job["status"]))
|
||||
print("Retries: {}".format(job["retries_count"]))
|
||||
print("Machine ID: {}".format(job["machine_id"]))
|
||||
print("Worker ID: {}".format(job["worker_id"]))
|
||||
print("Input file type: {}".format((job["file_type"])))
|
||||
if detailed:
|
||||
print("Unstructured text input files:")
|
||||
@@ -278,6 +281,15 @@ class BenchmarkCLI(object):
|
||||
|
||||
def main():
|
||||
"""Main entry point for the benchmark client console script."""
|
||||
|
||||
handler = logging.StreamHandler(sys.stdout)
|
||||
handler.setLevel(logging.DEBUG)
|
||||
formatter = logging.Formatter(
|
||||
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
||||
)
|
||||
handler.setFormatter(formatter)
|
||||
logger.addHandler(handler)
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description="CleverSwarm benchmark client for REST API."
|
||||
)
|
||||
|
||||
@@ -19,6 +19,7 @@ CleverSwarm - unstructured text to knowledge graph triplets extractor client.
|
||||
|
||||
import argparse
|
||||
import logging
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict
|
||||
|
||||
@@ -187,6 +188,8 @@ class TextoToKGCLI(object):
|
||||
print("Type: {}".format(job["type"]))
|
||||
print("Status: {}".format(job["status"]))
|
||||
print("Retries: {}".format(job["retries_count"]))
|
||||
print("Machine ID: {}".format(job["machine_id"]))
|
||||
print("Worker ID: {}".format(job["worker_id"]))
|
||||
print("Input file type: {}".format((job["file_type"])))
|
||||
if is_detailed:
|
||||
print("Unstructured text input files:")
|
||||
@@ -207,6 +210,15 @@ class TextoToKGCLI(object):
|
||||
|
||||
def main():
|
||||
"""Main entry point for the text-to-KG client console script."""
|
||||
|
||||
handler = logging.StreamHandler(sys.stdout)
|
||||
handler.setLevel(logging.DEBUG)
|
||||
formatter = logging.Formatter(
|
||||
"%(asctime)s - %(name)s - %(levelname)s - %(message)s"
|
||||
)
|
||||
handler.setFormatter(formatter)
|
||||
logger.addHandler(handler)
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description="CleverSwarm unstructured text to Knowledge Graph triplets client for REST API."
|
||||
)
|
||||
|
||||
@@ -22,7 +22,7 @@ import os
|
||||
import time
|
||||
from getpass import getpass
|
||||
from pathlib import Path
|
||||
from typing import Any, Dict, List, Self
|
||||
from typing import Any, Dict, List
|
||||
|
||||
import requests
|
||||
|
||||
@@ -143,7 +143,7 @@ class CleverSwarmClient(object):
|
||||
)
|
||||
retries += 1
|
||||
|
||||
def update_token(self, query_username: bool = False) -> Self:
|
||||
def update_token(self, query_username: bool = False) -> "CleverSwarmClient":
|
||||
"""
|
||||
Updates the session authorization token.
|
||||
:return: the BenchmarkClient instance
|
||||
@@ -157,7 +157,6 @@ class CleverSwarmClient(object):
|
||||
if self._username is None or query_username:
|
||||
self._username = input("Please enter your username: ")
|
||||
password = getpass("Please enter your password: ")
|
||||
# TODO Hash password
|
||||
data = {"username": self._username, "password": password}
|
||||
|
||||
r = requests.post(
|
||||
|
||||
@@ -1,14 +1,28 @@
|
||||
from enum import StrEnum
|
||||
import sys
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from enum import StrEnum
|
||||
else:
|
||||
from enum import Enum
|
||||
|
||||
class StrEnum(str, Enum):
|
||||
def _generate_next_value_(name, start, count, last_values):
|
||||
return name
|
||||
|
||||
def __str__(self):
|
||||
return self.value
|
||||
|
||||
|
||||
class FileTypeAPI(StrEnum):
|
||||
AutoDetect = "AutoDetect"
|
||||
PDF = "PDF"
|
||||
Markdown = "Markdown"
|
||||
PlainText = "PlainText"
|
||||
|
||||
|
||||
class FileType(StrEnum):
|
||||
JSONL = "JSONL"
|
||||
PDF = "PDF"
|
||||
Markdown = "Markdown"
|
||||
PlainText = "PlainText"
|
||||
Unknown = "Unknown"
|
||||
|
||||
@@ -17,7 +17,19 @@ Module that contains the enumerations found when interfacing with Benchmark clie
|
||||
limitations under the License.
|
||||
"""
|
||||
|
||||
from enum import StrEnum
|
||||
import sys
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from enum import StrEnum
|
||||
else:
|
||||
from enum import Enum
|
||||
|
||||
class StrEnum(str, Enum):
|
||||
def _generate_next_value_(name, start, count, last_values):
|
||||
return name
|
||||
|
||||
def __str__(self):
|
||||
return self.value
|
||||
|
||||
|
||||
class JobType(StrEnum):
|
||||
|
||||
@@ -1,4 +1,16 @@
|
||||
from enum import StrEnum
|
||||
import sys
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
from enum import StrEnum
|
||||
else:
|
||||
from enum import Enum
|
||||
|
||||
class StrEnum(str, Enum):
|
||||
def _generate_next_value_(name, start, count, last_values):
|
||||
return name
|
||||
|
||||
def __str__(self):
|
||||
return self.value
|
||||
|
||||
|
||||
class ResponseTypeAPI(StrEnum):
|
||||
|
||||
Reference in New Issue
Block a user