Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement]: Display SDK Version in Deployed Applications (openapi.json) #2353

Merged
Show file tree
Hide file tree
Changes from 3 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
4 changes: 2 additions & 2 deletions agenta-cli/agenta/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ def check_latest_version() -> Union[str, None]:


def notify_update(available_version: str):
import pkg_resources
import importlib.metadata

installed_version = pkg_resources.get_distribution("agenta").version
installed_version = importlib.metadata.version("agenta")
if available_version > installed_version:
click.echo(
click.style(
Expand Down
4 changes: 4 additions & 0 deletions agenta-cli/agenta/sdk/decorators/routing.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from agenta.sdk.context.routing import routing_context_manager, routing_context
from agenta.sdk.context.tracing import tracing_context
from agenta.sdk.router import router
from agenta.sdk.utils import helpers
from agenta.sdk.utils.exceptions import suppress
from agenta.sdk.utils.logging import log
from agenta.sdk.types import (
Expand Down Expand Up @@ -287,6 +288,9 @@ async def wrapper_deployed(*args, **kwargs) -> Any:
app.openapi_schema = None # Forces FastAPI to re-generate the schema
openapi_schema = app.openapi()

# Inject the current version of the SDK into the openapi_schema
openapi_schema["agenta_sdk"] = {"version": helpers.get_current_version()}

for route in entrypoint.routes:
self.override_schema(
openapi_schema=openapi_schema,
Expand Down
8 changes: 8 additions & 0 deletions agenta-cli/agenta/sdk/utils/helpers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import importlib.metadata


def get_current_version():
"""Returns the current version of Agenta's SDK."""

version = importlib.metadata.version("agenta")
return version
2 changes: 1 addition & 1 deletion agenta-cli/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "agenta"
version = "0.28.0"
version = "0.28.2a1"
aybruhm marked this conversation as resolved.
Show resolved Hide resolved
aybruhm marked this conversation as resolved.
Show resolved Hide resolved
description = "The SDK for agenta is an open-source LLMOps platform."
readme = "README.md"
authors = ["Mahmoud Mabrouk <[email protected]>"]
Expand Down
Loading