Skip to content

Commit

Permalink
Fix not initialized response latencies (All-Hands-AI#5679)
Browse files Browse the repository at this point in the history
  • Loading branch information
enyst authored Dec 22, 2024
1 parent 2cfbd26 commit 4a8bf3d
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions openhands/llm/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,14 @@ def costs(self) -> list[Cost]:

@property
def response_latencies(self) -> list[ResponseLatency]:
if not hasattr(self, '_response_latencies'):
self._response_latencies = []
return self._response_latencies

@response_latencies.setter
def response_latencies(self, value: list[ResponseLatency]) -> None:
self._response_latencies = value

def add_cost(self, value: float) -> None:
if value < 0:
raise ValueError('Added cost cannot be negative.')
Expand Down

0 comments on commit 4a8bf3d

Please sign in to comment.