Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 19 additions & 2 deletions agentops/instrumentation/ag2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,24 @@
than individual message exchanges.
"""

from agentops.instrumentation.ag2.instrumentor import AG2Instrumentor
from agentops.instrumentation.ag2.version import LIBRARY_NAME, LIBRARY_VERSION
from agentops.logging import logger

Check warning on line 8 in agentops/instrumentation/ag2/__init__.py

View check run for this annotation

Codecov / codecov/patch

agentops/instrumentation/ag2/__init__.py#L8

Added line #L8 was not covered by tests


def get_version() -> str:

Check warning on line 11 in agentops/instrumentation/ag2/__init__.py

View check run for this annotation

Codecov / codecov/patch

agentops/instrumentation/ag2/__init__.py#L11

Added line #L11 was not covered by tests
"""Get the version of the AG2 package, or 'unknown' if not found"""
try:
from importlib.metadata import version

Check warning on line 14 in agentops/instrumentation/ag2/__init__.py

View check run for this annotation

Codecov / codecov/patch

agentops/instrumentation/ag2/__init__.py#L13-L14

Added lines #L13 - L14 were not covered by tests

return version("ag2")
except ImportError:
logger.debug("Could not find AG2 version")
return "unknown"

Check warning on line 19 in agentops/instrumentation/ag2/__init__.py

View check run for this annotation

Codecov / codecov/patch

agentops/instrumentation/ag2/__init__.py#L16-L19

Added lines #L16 - L19 were not covered by tests


LIBRARY_NAME = "ag2"
LIBRARY_VERSION: str = get_version()

Check warning on line 23 in agentops/instrumentation/ag2/__init__.py

View check run for this annotation

Codecov / codecov/patch

agentops/instrumentation/ag2/__init__.py#L22-L23

Added lines #L22 - L23 were not covered by tests

# Import after defining constants to avoid circular imports
from agentops.instrumentation.ag2.instrumentor import AG2Instrumentor # noqa: E402

Check warning on line 26 in agentops/instrumentation/ag2/__init__.py

View check run for this annotation

Codecov / codecov/patch

agentops/instrumentation/ag2/__init__.py#L26

Added line #L26 was not covered by tests

__all__ = ["AG2Instrumentor", "LIBRARY_NAME", "LIBRARY_VERSION"]
2 changes: 1 addition & 1 deletion agentops/instrumentation/ag2/instrumentor.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
from wrapt import wrap_function_wrapper

from agentops.logging import logger
from agentops.instrumentation.ag2.version import LIBRARY_NAME, LIBRARY_VERSION
from agentops.instrumentation.ag2 import LIBRARY_NAME, LIBRARY_VERSION

Check warning on line 16 in agentops/instrumentation/ag2/instrumentor.py

View check run for this annotation

Codecov / codecov/patch

agentops/instrumentation/ag2/instrumentor.py#L16

Added line #L16 was not covered by tests
from agentops.semconv import Meters
from agentops.semconv.message import MessageAttributes
from agentops.semconv.span_attributes import SpanAttributes
Expand Down
4 changes: 0 additions & 4 deletions agentops/instrumentation/ag2/version.py

This file was deleted.

Loading