Skip to content

Commit

Permalink
Style fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nqn committed Dec 10, 2024
1 parent cb4c3bb commit fd6792e
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions src/log10/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,7 @@ def __init__(


class Message(ABC):
def __init__(
self, role: Role, content: str, id: str = None, completion: str = None
):
def __init__(self, role: Role, content: str, id: str = None, completion: str = None):
self.id = id
self.role = role
self.content = content
Expand Down Expand Up @@ -86,9 +84,7 @@ class Completion(ABC):


class ChatCompletion(Completion):
def __init__(
self, role: str, content: str, response: dict = None, completion_id: str = None
):
def __init__(self, role: str, content: str, response: dict = None, completion_id: str = None):
self.role = role
self.content = content
self.response = response
Expand Down Expand Up @@ -212,9 +208,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", {"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"]

Expand All @@ -238,15 +232,9 @@ def log_start(self, request, kind: Kind, tags: Optional[List[str]] = None):
"organization_id": self.log10_config.org_id,
"session_id": self.session_id,
"orig_module": (
"openai.api_resources.completion"
if kind == Kind.text
else "openai.api_resources.chat_completion"
),
"orig_qualname": (
"Completion.create"
if kind == Kind.text
else "ChatCompletion.create"
"openai.api_resources.completion" if kind == Kind.text else "openai.api_resources.chat_completion"
),
"orig_qualname": ("Completion.create" if kind == Kind.text else "ChatCompletion.create"),
"status": "started",
"tags": tags,
"request": json.dumps(request),
Expand Down

0 comments on commit fd6792e

Please sign in to comment.