diff --git a/src/log10/litellm.py b/src/log10/litellm.py index 41877f2..961b321 100644 --- a/src/log10/litellm.py +++ b/src/log10/litellm.py @@ -94,7 +94,6 @@ def log_failure_event(self, kwargs, response_obj, start_time, end_time): run = self.runs.get(litellm_call_id, None) self.api_request( f"/api/completions/{run['completion_id']}", - "POST", update_log_row, ) diff --git a/src/log10/llm.py b/src/log10/llm.py index 0c732db..9513d32 100644 --- a/src/log10/llm.py +++ b/src/log10/llm.py @@ -163,7 +163,7 @@ def chat(self, messages: List[Message], hparams: dict = None) -> ChatCompletion: def chat_request(self, messages: List[Message], hparams: dict = None) -> dict: raise Exception("Not implemented") - def api_request(self, rel_url: str, method: str, request: dict): + def api_request(self, rel_url: str, request: dict): def is_safe_url(url: str) -> bool: parsed = urlparse(url) base_domain = urlparse(self.log10_config.url).netloc @@ -173,8 +173,7 @@ def is_safe_url(url: str) -> bool: if not is_safe_url(full_url): raise ValueError("Invalid URL: " + full_url) - return requests.request( - method, + return requests.post( full_url, headers={ "x-log10-token": self.log10_config.token, @@ -188,7 +187,7 @@ def log_start(self, request, kind: Kind, tags: Optional[List[str]] = None): if not self.log10_config: return None - res = self.api_request("/api/completions", "POST", {"organization_id": self.log10_config.org_id}) + res = self.api_request("/api/completions", {"organization_id": self.log10_config.org_id}) self.last_completion_response = res.json() completion_id = res.json()["completionID"] @@ -200,7 +199,6 @@ def log_start(self, request, kind: Kind, tags: Optional[List[str]] = None): res = self.api_request( f"/api/completions/{completion_id}", - "POST", { "kind": kind == Kind.text and "completion" or "chat", "organization_id": self.log10_config.org_id, @@ -238,7 +236,6 @@ def log_end(self, completion_id: str, response: dict, duration: int): self.api_request( f"/api/completions/{completion_id}", - "POST", { "organization_id": self.log10_config.org_id, "response": json.dumps(response),