Skip to content

Commit

Permalink
ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesturk committed Nov 25, 2023
1 parent c36ae0e commit 7442085
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/scrapeghost/apicall.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ def __init__(
self.postprocessors = postprocessors

def _raw_api_request(
self, model: str, messages: list[dict[str, str]], response: Response,
self,
model: str,
messages: list[dict[str, str]],
response: Response,
) -> Response:
"""
Make an OpenAPI request and return the raw response.
Expand All @@ -101,7 +104,10 @@ def _raw_api_request(
)
start_t = time.time()
completion = client.chat.completions.create(
model=model, messages=messages, **self.model_params, **json_mode, # type: ignore
model=model,
messages=messages,
**self.model_params,
**json_mode, # type: ignore
)
elapsed = time.time() - start_t
if completion.usage:
Expand Down Expand Up @@ -136,7 +142,7 @@ def _raw_api_request(
f"(prompt_tokens={p_tokens}, "
f"completion_tokens={c_tokens})"
)
response.data = choice.message.content # type: ignore
response.data = choice.message.content # type: ignore
return response

def _api_request(self, html: str) -> Response:
Expand Down

0 comments on commit 7442085

Please sign in to comment.