Skip to content

Actor Method don't support custom object #795

Open
@heavenwing

Description

@heavenwing

Expected Behavior

my actor interface defines below:

from abc import abstractmethod

from dapr.actor import ActorInterface, actormethod

from common_models.agent import ReportGuideAgentResult


class ReportGuideAgentActorInterface(ActorInterface):
    @abstractmethod
    @actormethod(name="Answer")
    async def answer(self, user_input: str) -> ReportGuideAgentResult: ...

Actual Behavior

But got a ERR_ACTOR_INVOKE_METHOD error: "ReportGuideAgentResult is not JSON serializable"

I have to change return type into str, and serialize it in my Actor class, and deserialize it in my Client class.

VERSION is 1.15

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions