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

Add structured message for user input #536

Open
Tracked by #523
davorrunje opened this issue Jan 17, 2025 · 0 comments · May be fixed by #557
Open
Tracked by #523

Add structured message for user input #536

davorrunje opened this issue Jan 17, 2025 · 0 comments · May be fixed by #557
Assignees

Comments

@davorrunje
Copy link
Collaborator

Add new messages for inputs and use them in IOStream classes. E.g.

class InputMessageRequest(BaseMessage):
    pass

class InputMessageTextRequest(InputMessageRequest):
    prompt: str = ""

class InputMessagePasswordRequest(InputMessageRequest):
    prompt: str = ""

class InputMessageSingleChoiceRequest(InputMessageRequest):
    prompt: str = ""
    choices: list[str]

class InputMessageMultipleChoiceResponse(InputMessageResponse):
    prompt: str = ""
    choices: list[str]

class InputMessageResponse(BaseMessage):
    request: InputMessageRequest

class InputMessageTextResponse(InputMessageResponse):
    text: str

class InputMessagePasswordResponse(InputMessageResponse):
    password: str

class InputMessageSingleChoiceResponse(InputMessageResponse):
    choice: str

class InputMessageMultipleChoiceResponse(InputMessageResponse):
    choice: str


class InputStream(Protocol):
    def request_input(self, InputMessageRequest) -> InputMessageResponse:
        ...  # pragma: no cover
@davorrunje davorrunje moved this to Todo in ag2 Jan 17, 2025
@davorrunje davorrunje added this to ag2 Jan 17, 2025
@davorrunje davorrunje assigned davorrunje and unassigned kumaranvpl Jan 20, 2025
@davorrunje davorrunje linked a pull request Jan 20, 2025 that will close this issue
3 tasks
@davorrunje davorrunje linked a pull request Jan 20, 2025 that will close this issue
3 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

2 participants