Skip to content

Commit

Permalink
Enforce in Union[str, Dict[str, Any]] in BaseResponse in SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
jp-agenta committed Aug 23, 2024
1 parent 892a351 commit 3cad5db
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
21 changes: 13 additions & 8 deletions agenta-cli/agenta/sdk/decorators/llm_entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,11 @@ async def wrapper(*args, **kwargs) -> Any:
{
"func": func.__name__,
"endpoint": route,
"params": {**config_params, **func_signature.parameters}
if not config
else func_signature.parameters,
"params": (
{**config_params, **func_signature.parameters}
if not config
else func_signature.parameters
),
"config": config,
}
)
Expand All @@ -229,9 +231,11 @@ async def wrapper(*args, **kwargs) -> Any:
{
"func": func.__name__,
"endpoint": route,
"params": {**config_params, **func_signature.parameters}
if not config
else func_signature.parameters,
"params": (
{**config_params, **func_signature.parameters}
if not config
else func_signature.parameters
),
"config": config,
}
)
Expand Down Expand Up @@ -402,15 +406,16 @@ async def execute_function(

# PATCH : if result is not a dict, make it a dict
if not isinstance(result, dict):
data = result
data = str(result)
else:
# PATCH : if result is a legacy dict, clean it up
if (
"message" in result.keys()
and "cost" in result.keys()
and "usage" in result.keys()
):
data = result["message"]
data = str(result["message"])

# END OF PATH

if data is None:
Expand Down
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.24.0"
version = "0.24.1a0"
description = "The SDK for agenta is an open-source LLMOps platform."
readme = "README.md"
authors = ["Mahmoud Mabrouk <[email protected]>"]
Expand Down

0 comments on commit 3cad5db

Please sign in to comment.