Skip to content

Commit

Permalink
use parse signature for Predict forward method
Browse files Browse the repository at this point in the history
  • Loading branch information
axiomofjoy committed Jan 30, 2024
1 parent ba2d3ed commit 46a1de0
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,11 @@ def __call__(
span_name,
attributes={
SpanAttributes.OPENINFERENCE_SPAN_KIND: OpenInferenceSpanKindValues.CHAIN.value,
SpanAttributes.INPUT_VALUE: json.dumps(kwargs, cls=DSPyJSONEncoder),
SpanAttributes.INPUT_VALUE: _get_input_value(
wrapped,
*args,
**kwargs,
),
SpanAttributes.INPUT_MIME_TYPE: OpenInferenceMimeTypeValues.JSON.value,
},
) as span:
Expand Down Expand Up @@ -213,9 +217,12 @@ def _get_input_value(method: Callable[..., Any], *args: Any, **kwargs: Any) -> s
)
return json.dumps(
{
argument_name: argument_value
for argument_name, argument_value in bound_arguments.arguments.items()
if argument_name != "self"
**{
argument_name: argument_value
for argument_name, argument_value in bound_arguments.arguments.items()
if argument_name not in ["self", "cls", "kwargs"]
},
**bound_arguments.arguments.get("kwargs", {}),
},
cls=DSPyJSONEncoder,
)
Expand Down

0 comments on commit 46a1de0

Please sign in to comment.