Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
wenzhe-log10 committed Feb 9, 2024
1 parent df7a078 commit c42a2e5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 10 deletions.
6 changes: 3 additions & 3 deletions log10/feedback/feedback.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
logger: logging.Logger = logging.getLogger("LOG10")
logger.setLevel(logging.INFO)


class Feedback:
feedback_create_url = "/api/v1/feedback"

Expand All @@ -36,9 +37,7 @@ def _post_request(self, url: str, json_payload: dict) -> httpx.Response:
headers = {"x-log10-token": self._log10_config.token, "Content-Type": "application/json"}
json_payload["organization_id"] = self._log10_config.org_id
try:
res = self._http_client.post(
self._log10_config.url + url, headers=headers, json=json_payload
)
res = self._http_client.post(self._log10_config.url + url, headers=headers, json=json_payload)
res.raise_for_status()
return res
except Exception as e:
Expand All @@ -56,6 +55,7 @@ def create(self, task_id: str, rate: dict) -> httpx.Response:
res = self._post_request(self.feedback_create_url, json_payload)
return res


@click.command()
@click.option("--task_id", prompt="Enter task id", help="Task ID")
@click.option("--rate", prompt="Enter task rate", help="Rate in JSON format")
Expand Down
8 changes: 5 additions & 3 deletions log10/feedback/feedback_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@
)
logger: logging.Logger = logging.getLogger("LOG10")
logger.setLevel(logging.INFO)


class FeedbackTask:
feedback_task_create_url = "/api/v1/feedback_task"

def __init__(self, log10_config: Log10Config = None):
self._log10_config = log10_config or Log10Config()
self._http_client = httpx.Client()
Expand All @@ -25,9 +28,7 @@ def _post_request(self, url: str, json_payload: dict) -> httpx.Response:
headers = {"x-log10-token": self._log10_config.token, "Content-Type": "application/json"}
json_payload["organization_id"] = self._log10_config.org_id
try:
res = self._http_client.post(
self._log10_config.url + url, headers=headers, json=json_payload
)
res = self._http_client.post(self._log10_config.url + url, headers=headers, json=json_payload)
res.raise_for_status()
return res
except Exception as e:
Expand All @@ -45,6 +46,7 @@ def create(self, name: str, task_schema: dict) -> httpx.Response:
res = self._post_request(self.feedback_task_create_url, json_payload)
return res


# create a cli interface for FeebackTask.create function
@click.command()
@click.option("--name", prompt="Enter feedback task name", help="Name of the task")
Expand Down
8 changes: 4 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,17 @@ together = "^0.2.7"

[tool.ruff]
# Never enforce `E501` (line length violations).
ignore = ["C901", "E501", "E741", "F402", "F823" ]
select = ["C", "E", "F", "I", "W"]
lint.ignore = ["C901", "E501", "E741", "F402", "F823" ]
lint.select = ["C", "E", "F", "I", "W"]
line-length = 119

# Ignore import violations in all `__init__.py` files.
[tool.ruff.per-file-ignores]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["E402", "F401", "F403", "F811"]
"log10/langchain.py" = ["E402"]
"examples/logging/*.py" = ["E402", "F821"]

[tool.ruff.isort]
[tool.ruff.lint.isort]
lines-after-imports = 2
known-first-party = ["log10"]

Expand Down

0 comments on commit c42a2e5

Please sign in to comment.