From 3d1b80c917b3f79ff9f131abf04573722c8b398b Mon Sep 17 00:00:00 2001 From: Braelyn Boynton Date: Tue, 9 Apr 2024 16:23:29 -0700 Subject: [PATCH] handle unknown cost (#148) --- agentops/client.py | 7 +++++-- pyproject.toml | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/agentops/client.py b/agentops/client.py index 48255a75..5c1cd4eb 100644 --- a/agentops/client.py +++ b/agentops/client.py @@ -240,8 +240,11 @@ def end_session(self, self._session.video = video self._session.end_session(end_state, end_state_reason) - token_cost = float(self._worker.end_session(self._session)) - print('🖇 AgentOps: This run cost ${:.6f}'.format(token_cost)) + token_cost = self._worker.end_session(self._session) + if token_cost is 'unknown': + print('🖇 AgentOps: Could not determine cost of run.') + else: + print('🖇 AgentOps: This run cost ${:.6f}'.format(float(token_cost))) self._session = None self._worker = None diff --git a/pyproject.toml b/pyproject.toml index 1171f57e..5b7a34b6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "agentops" -version = "0.1.2" +version = "0.1.3" authors = [ { name="Alex Reibman", email="areibman@gmail.com" }, { name="Shawn Qiu", email="siyangqiu@gmail.com" },