Skip to content

Commit

Permalink
Merge branch 'main' into documentation-updates-simple-wording-updates
Browse files Browse the repository at this point in the history
  • Loading branch information
albertkimjunior authored Jun 26, 2024
2 parents 6ef207f + 6d17133 commit 2072ee9
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 18 deletions.
12 changes: 1 addition & 11 deletions agentops/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def end_session(
video (str, optional): URL to a video recording of the session
is_auto_end (bool, optional): is this an automatic use of end_session and should be skipped with bypass_auto_end_session
"""
Client().end_session(
return Client().end_session(
end_state=end_state,
end_state_reason=end_state_reason,
video=video,
Expand Down Expand Up @@ -184,16 +184,6 @@ def set_tags(tags: List[str]):
Client().set_tags(tags)


@check_init
def record_function(event_name: str):
return decorators.record_function(event_name)


@check_init
def track_agent(name: Union[str, None] = None):
return agent.track_agent(name)


def get_api_key() -> str:
return Client().api_key

Expand Down
14 changes: 9 additions & 5 deletions agentops/client.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""
AgentOps client module that provides a client class with public interfaces and configuration.
AgentOps client module that provides a client class with public interfaces and configuration.
Classes:
Client: Provides methods to interact with the AgentOps service.
Classes:
Client: Provides methods to interact with the AgentOps service.
"""

import os
Expand Down Expand Up @@ -80,7 +80,6 @@ def __init__(
inherited_session_id: Optional[str] = None,
skip_auto_end_session: Optional[bool] = False,
):

if override is not None:
logger.warning(
"The 'override' parameter is deprecated. Use 'instrument_llm_calls' instead.",
Expand Down Expand Up @@ -389,7 +388,7 @@ def end_session(
end_state_reason: Optional[str] = None,
video: Optional[str] = None,
is_auto_end: Optional[bool] = None,
):
) -> Decimal:
"""
End the current session with the AgentOps service.
Expand All @@ -398,6 +397,9 @@ def end_session(
end_state_reason (str, optional): The reason for ending the session.
video (str, optional): The video screen recording of the session
is_auto_end (bool, optional): is this an automatic use of end_session and should be skipped with skip_auto_end_session
Returns:
Decimal: The token cost of the session. Returns 0 if the cost is unknown.
"""

if is_auto_end and self.config.skip_auto_end_session:
Expand All @@ -420,6 +422,7 @@ def end_session(

if token_cost is None or token_cost == "unknown":
logger.info("Could not determine cost of run.")
token_cost_d = Decimal(0)
else:
token_cost_d = Decimal(token_cost)
logger.info(
Expand All @@ -439,6 +442,7 @@ def end_session(

self._session = None
self._worker = None
return token_cost_d

def create_agent(self, name: str, agent_id: Optional[str] = None):
if agent_id is None:
Expand Down
2 changes: 1 addition & 1 deletion examples/openai-gpt.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@
"for chunk in res:\n",
" if chunk.choices[0].delta.content is not None:\n",
" full_response += chunk.choices[0].delta.content\n",
" \n",
"\n",
"print(full_response.strip())"
]
},
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "agentops"
version = "0.2.4"
version = "0.2.5"
authors = [
{ name="Alex Reibman", email="[email protected]" },
{ name="Shawn Qiu", email="[email protected]" },
Expand Down

0 comments on commit 2072ee9

Please sign in to comment.