Skip to content

Commit

Permalink
Added session link to end_session (#213)
Browse files Browse the repository at this point in the history
* Added session link to end_session

* Fixes

* changed to f string
  • Loading branch information
HowieG authored May 22, 2024
1 parent 99183ed commit eaa00d7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions agentops/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ def _check_for_partner_frameworks(self, instrument_llm_calls, auto_start_session
except ImportError:
pass
except Exception as e:
logger.warning(
f"Failed to set up autogen logger with AgentOps. Error: {e}")
logger.warning(f"Failed to set up AutoGen logger with AgentOps. Error: {e}")

return partner_frameworks[framework]

Expand Down Expand Up @@ -303,8 +302,7 @@ def start_session(self, tags: Optional[List[str]] = None, config: Optional[Confi
self._session = None
return logger.warning("Cannot start session - No server response")

logger.info('\x1b[34mView info on this session at https://app.agentops.ai/drilldown?session_id=%s\x1b[0m',
self._session.session_id)
logger.info(f'\x1b[34mSession Replay: https://app.agentops.ai/drilldown?session_id={self._session.session_id}\x1b[0m')

return self._session.session_id

Expand Down Expand Up @@ -337,8 +335,11 @@ def end_session(self,
logger.info('Could not determine cost of run.')
else:
token_cost_d = Decimal(token_cost)
logger.info('This run cost ${}'.format('{:.2f}'.format(
logger.info('This run\'s cost ${}'.format('{:.2f}'.format(
token_cost_d) if token_cost_d == 0 else '{:.6f}'.format(token_cost_d)))

logger.info(f'\x1b[34mSession Replay: https://app.agentops.ai/drilldown?session_id={self._session.session_id}\x1b[0m')

self._session = None
self._worker = None

Expand Down

0 comments on commit eaa00d7

Please sign in to comment.