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] Update SDK to return BaseResponse version 3.0 and new trace tree format #2251

Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
d0a55a6
refactor (cli:sdk): remove legacy spans for `inline_trace` and update…
aybruhm Nov 13, 2024
6a1f627
refactor (web): new trace tree format from observability
aybruhm Nov 13, 2024
c2e7a54
fix (style): format TestView component
aybruhm Nov 13, 2024
544cd40
cleanup (web/cli): remove redundant `_parse_to_legacy_span` function,…
aybruhm Nov 13, 2024
e6b8692
fix (build): resolve lint_and_build error on web
aybruhm Nov 13, 2024
5935899
refactor (backend) `extract_result_from_response` to support version …
aybruhm Nov 13, 2024
554fcef
fix(frontend): added span key to NodeTimeDTO
bekossy Nov 13, 2024
66f6341
fix(frontend): updated types and fixed bugs
bekossy Nov 14, 2024
4895127
refactor (cli:sdk): regenerate SDK client for updated observability r…
aybruhm Nov 14, 2024
dd7eb6c
refactor (web): add backward compatibility for v2 and v3 base respons…
aybruhm Nov 15, 2024
e316157
refactor (cli:sdk): update `parse_inline_trace` function in sdk to ma…
aybruhm Nov 15, 2024
622b18a
refactor (web): update logic for setting additional data list for bas…
aybruhm Nov 15, 2024
d5d494b
refactor (cli): bump version to 0.27.2a1
aybruhm Nov 15, 2024
a484239
chore (style): format sdk client backend
aybruhm Nov 15, 2024
81cadd7
Merge branch 'feature/age-1285-inline-traces-update-sdk-to-return-bas…
aybruhm Nov 16, 2024
bd4dcc8
Merge branch 'feature/age-1285-inline-traces-update-sdk-to-return-bas…
aybruhm Nov 16, 2024
8b2e03b
fix(frontend): updated BaseResponse type and modified code to match type
bekossy Nov 17, 2024
c056702
fix(frontend): removed unused helper function
bekossy Nov 17, 2024
f5b2df6
feat(frontend): added trace helper to check trace version
bekossy Nov 17, 2024
f280490
Merge branch 'feature/age-1285-inline-traces-update-sdk-to-return-bas…
bekossy Nov 17, 2024
6095ea8
feat (backend): add helper functions to process distributed traces an…
aybruhm Nov 17, 2024
772b9f3
refactor (backend): ensure keys can be retrieved optionally to avoid …
aybruhm Nov 17, 2024
c024460
refactor (backend_: make use of version from mapping_inputs
aybruhm Nov 17, 2024
f9421df
feat (tests): add unit tests for rag evaluators for baseresponses wit…
aybruhm Nov 17, 2024
291323d
chore (backend): add doc string back to `_make_spans_tree` function
aybruhm Nov 17, 2024
e7ead58
refactor (backend): add error management on extract_result from response
aybruhm Nov 18, 2024
572119b
fix(frontend): restored baseresponse helper function
bekossy Nov 18, 2024
7dfad2f
Merge pull request #2271 from Agenta-AI/AGE-1286/-update-web-ui-to-us…
bekossy Nov 19, 2024
de19c05
refactor (cli): rename `trace` attribute in BaseResponse to `tree`
aybruhm Nov 19, 2024
66fbc2d
refactor (backend): update backend to make use of new naming from `tr…
aybruhm Nov 19, 2024
8d75400
minor refactor (backend): simplify if-elif-else condition for mapping…
aybruhm Nov 19, 2024
438b87f
Merge pull request #2253 from Agenta-AI/feature/age-1288-inline-trace…
aybruhm Nov 19, 2024
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
63 changes: 63 additions & 0 deletions agenta-cli/agenta/client/backend/__init__.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
# This file was auto-generated by Fern from our API Definition.

from .types import (
AgentaNodeDto,
AgentaNodeDtoNodesValue,
AgentaNodesResponse,
AgentaRootDto,
AgentaRootsResponse,
AgentaTreeDto,
AgentaTreesResponse,
AggregatedResult,
AggregatedResultEvaluatorConfig,
App,
AppVariantResponse,
AppVariantRevision,
BaseOutput,
BodyImportTestset,
CollectStatusResponse,
ConfigDb,
ConfigDto,
ConfigResponseModel,
Expand All @@ -32,6 +40,7 @@
EvaluatorConfig,
EvaluatorMappingOutputInterface,
EvaluatorOutputInterface,
ExceptionDto,
GetConfigResponse,
HttpValidationError,
HumanEvaluation,
Expand All @@ -43,30 +52,50 @@
Image,
InviteRequest,
LifecycleDto,
LinkDto,
ListApiKeysResponse,
LlmRunRateLimit,
LlmTokens,
LmProvidersEnum,
NewHumanEvaluation,
NewTestset,
NodeDto,
NodeType,
OTelContextDto,
OTelEventDto,
OTelExtraDto,
OTelLinkDto,
OTelSpanDto,
OTelSpanKind,
OTelSpansResponse,
OTelStatusCode,
Organization,
OrganizationOutput,
Outputs,
ParentDto,
Permission,
ReferenceDto,
ReferenceRequestModel,
Result,
RootDto,
Score,
SimpleEvaluationOutput,
Span,
SpanDetail,
SpanDto,
SpanDtoNodesValue,
SpanStatusCode,
SpanVariant,
StatusCode,
StatusDto,
Template,
TemplateImageInfo,
TestSetOutputResponse,
TestSetSimpleResponse,
TimeDto,
TraceDetail,
TreeDto,
TreeType,
UpdateAppOutput,
Uri,
ValidationError,
Expand All @@ -90,16 +119,25 @@
evaluations,
evaluators,
observability,
observability_v_1,
testsets,
variants,
)
from .client import AgentaApi, AsyncAgentaApi
from .containers import ContainerTemplatesResponse
from .observability_v_1 import Format, QueryTracesResponse
from .variants import AddVariantFromBaseAndConfigResponse

__all__ = [
"AddVariantFromBaseAndConfigResponse",
"AgentaApi",
"AgentaNodeDto",
"AgentaNodeDtoNodesValue",
"AgentaNodesResponse",
"AgentaRootDto",
"AgentaRootsResponse",
"AgentaTreeDto",
"AgentaTreesResponse",
"AggregatedResult",
"AggregatedResultEvaluatorConfig",
"App",
Expand All @@ -108,6 +146,7 @@
"AsyncAgentaApi",
"BaseOutput",
"BodyImportTestset",
"CollectStatusResponse",
"ConfigDb",
"ConfigDto",
"ConfigResponseModel",
Expand All @@ -133,6 +172,8 @@
"EvaluatorConfig",
"EvaluatorMappingOutputInterface",
"EvaluatorOutputInterface",
"ExceptionDto",
"Format",
"GetConfigResponse",
"HttpValidationError",
"HumanEvaluation",
Expand All @@ -144,30 +185,51 @@
"Image",
"InviteRequest",
"LifecycleDto",
"LinkDto",
"ListApiKeysResponse",
"LlmRunRateLimit",
"LlmTokens",
"LmProvidersEnum",
"NewHumanEvaluation",
"NewTestset",
"NodeDto",
"NodeType",
"OTelContextDto",
"OTelEventDto",
"OTelExtraDto",
"OTelLinkDto",
"OTelSpanDto",
"OTelSpanKind",
"OTelSpansResponse",
"OTelStatusCode",
"Organization",
"OrganizationOutput",
"Outputs",
"ParentDto",
"Permission",
"QueryTracesResponse",
"ReferenceDto",
"ReferenceRequestModel",
"Result",
"RootDto",
"Score",
"SimpleEvaluationOutput",
"Span",
"SpanDetail",
"SpanDto",
"SpanDtoNodesValue",
"SpanStatusCode",
"SpanVariant",
"StatusCode",
"StatusDto",
"Template",
"TemplateImageInfo",
"TestSetOutputResponse",
"TestSetSimpleResponse",
"TimeDto",
"TraceDetail",
"TreeDto",
"TreeType",
"UnprocessableEntityError",
"UpdateAppOutput",
"Uri",
Expand All @@ -189,6 +251,7 @@
"evaluations",
"evaluators",
"observability",
"observability_v_1",
"testsets",
"variants",
]
44 changes: 22 additions & 22 deletions agenta-cli/agenta/client/backend/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from .environments.client import EnvironmentsClient
from .bases.client import BasesClient
from .configs.client import ConfigsClient
from .observability_v_1.client import ObservabilityV1Client
from .core.request_options import RequestOptions
from .types.list_api_keys_response import ListApiKeysResponse
from .core.pydantic_utilities import parse_obj_as
Expand Down Expand Up @@ -40,6 +41,7 @@
from .environments.client import AsyncEnvironmentsClient
from .bases.client import AsyncBasesClient
from .configs.client import AsyncConfigsClient
from .observability_v_1.client import AsyncObservabilityV1Client

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)
Expand Down Expand Up @@ -89,17 +91,13 @@ def __init__(
self._client_wrapper = SyncClientWrapper(
base_url=base_url,
api_key=api_key,
httpx_client=(
httpx_client
if httpx_client is not None
else (
httpx.Client(
timeout=_defaulted_timeout, follow_redirects=follow_redirects
)
if follow_redirects is not None
else httpx.Client(timeout=_defaulted_timeout)
)
),
httpx_client=httpx_client
if httpx_client is not None
else httpx.Client(
timeout=_defaulted_timeout, follow_redirects=follow_redirects
)
if follow_redirects is not None
else httpx.Client(timeout=_defaulted_timeout),
timeout=_defaulted_timeout,
)
self.observability = ObservabilityClient(client_wrapper=self._client_wrapper)
Expand All @@ -112,6 +110,9 @@ def __init__(
self.environments = EnvironmentsClient(client_wrapper=self._client_wrapper)
self.bases = BasesClient(client_wrapper=self._client_wrapper)
self.configs = ConfigsClient(client_wrapper=self._client_wrapper)
self.observability_v_1 = ObservabilityV1Client(
client_wrapper=self._client_wrapper
)

def list_api_keys(
self, *, request_options: typing.Optional[RequestOptions] = None
Expand Down Expand Up @@ -1619,17 +1620,13 @@ def __init__(
self._client_wrapper = AsyncClientWrapper(
base_url=base_url,
api_key=api_key,
httpx_client=(
httpx_client
if httpx_client is not None
else (
httpx.AsyncClient(
timeout=_defaulted_timeout, follow_redirects=follow_redirects
)
if follow_redirects is not None
else httpx.AsyncClient(timeout=_defaulted_timeout)
)
),
httpx_client=httpx_client
if httpx_client is not None
else httpx.AsyncClient(
timeout=_defaulted_timeout, follow_redirects=follow_redirects
)
if follow_redirects is not None
else httpx.AsyncClient(timeout=_defaulted_timeout),
timeout=_defaulted_timeout,
)
self.observability = AsyncObservabilityClient(
Expand All @@ -1644,6 +1641,9 @@ def __init__(
self.environments = AsyncEnvironmentsClient(client_wrapper=self._client_wrapper)
self.bases = AsyncBasesClient(client_wrapper=self._client_wrapper)
self.configs = AsyncConfigsClient(client_wrapper=self._client_wrapper)
self.observability_v_1 = AsyncObservabilityV1Client(
client_wrapper=self._client_wrapper
)

async def list_api_keys(
self, *, request_options: typing.Optional[RequestOptions] = None
Expand Down
22 changes: 15 additions & 7 deletions agenta-cli/agenta/client/backend/core/http_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ def get_request_body(
json_body = maybe_filter_request_body(json, request_options, omit)

# If you have an empty JSON body, you should just send None
return (json_body if json_body != {} else None), (
data_body if data_body != {} else None
)
return (
json_body if json_body != {} else None
), data_body if data_body != {} else None


class HttpClient:
Expand Down Expand Up @@ -250,7 +250,9 @@ def request(
data=data_body,
content=content,
files=(
convert_file_dict_to_httpx_tuples(remove_none_from_dict(files))
convert_file_dict_to_httpx_tuples(
remove_omit_from_dict(remove_none_from_dict(files), omit)
)
if (files is not None and files is not omit)
else None
),
Expand Down Expand Up @@ -351,7 +353,9 @@ def stream(
data=data_body,
content=content,
files=(
convert_file_dict_to_httpx_tuples(remove_none_from_dict(files))
convert_file_dict_to_httpx_tuples(
remove_omit_from_dict(remove_none_from_dict(files), omit)
)
if (files is not None and files is not omit)
else None
),
Expand Down Expand Up @@ -458,7 +462,9 @@ async def request(
data=data_body,
content=content,
files=(
convert_file_dict_to_httpx_tuples(remove_none_from_dict(files))
convert_file_dict_to_httpx_tuples(
remove_omit_from_dict(remove_none_from_dict(files), omit)
)
if files is not None
else None
),
Expand Down Expand Up @@ -558,7 +564,9 @@ async def stream(
data=data_body,
content=content,
files=(
convert_file_dict_to_httpx_tuples(remove_none_from_dict(files))
convert_file_dict_to_httpx_tuples(
remove_omit_from_dict(remove_none_from_dict(files), omit)
)
if files is not None
else None
),
Expand Down
8 changes: 4 additions & 4 deletions agenta-cli/agenta/client/backend/observability/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def get_traces(
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

def delete_traces(
def delete_traces_legacy(
self,
*,
request: typing.Sequence[str],
Expand All @@ -307,7 +307,7 @@ def delete_traces(
api_key="YOUR_API_KEY",
base_url="https://yourhost.com/path/to/api",
)
client.observability.delete_traces(
client.observability.delete_traces_legacy(
request=["string"],
)
"""
Expand Down Expand Up @@ -901,7 +901,7 @@ async def main() -> None:
raise ApiError(status_code=_response.status_code, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

async def delete_traces(
async def delete_traces_legacy(
self,
*,
request: typing.Sequence[str],
Expand Down Expand Up @@ -933,7 +933,7 @@ async def delete_traces(


async def main() -> None:
await client.observability.delete_traces(
await client.observability.delete_traces_legacy(
request=["string"],
)

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# This file was auto-generated by Fern from our API Definition.

from .types import Format, QueryTracesResponse

__all__ = ["Format", "QueryTracesResponse"]
Loading
Loading