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

Replace print commands with structured messages #282

Open
wants to merge 42 commits into
base: main
Choose a base branch
from

Conversation

kumaranvpl
Copy link
Collaborator

Why are these changes needed?

Related issue number

Checks

@kumaranvpl kumaranvpl marked this pull request as draft December 23, 2024 14:56
@davorrunje davorrunje changed the title Custom structured messages Replace print commands with structured messages Dec 23, 2024
@davorrunje davorrunje self-assigned this Dec 23, 2024
Copy link
Collaborator

@sonichi sonichi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Could you check whether any doc change is needed, for example, about the interface to get usage summary? cc @yiranwu0 @marklysze

MessageRole = Literal["assistant", "function", "tool"]


class BaseMessage(BaseModel):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: add docstr to explain how to use this class in a number of steps for developers who need to define a new message type. For example, 1. define a subclass with a few data fields and override the print method, 2. define a function to create an instance of the subclass, like create_..., 3. In agentchat, when ..., do ....

Question: Can this class support multimodal messages, such as image, audio, video? cc @BabyCNM

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just the first part of the task, the next one is to refactor IOStream classes to use structured messages, especially with WebSockets. We'll write a blog post on how to use it to build UI easier.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'll have to add multimodal messages in another PR. It needs to be supported by client classes in a unified way first.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I create the followup issue #331

@sonichi sonichi requested review from marklysze and BabyCNM December 30, 2024 18:53
@kumaranvpl
Copy link
Collaborator Author

Looks good. Could you check whether any doc change is needed, for example, about the interface to get usage summary? cc @yiranwu0 @marklysze

No docs change needed because I didn't modify signature of existing functions and methods. I just moved the print statements to single place.

I am not done yet though, still there are few places to change.

@davorrunje davorrunje marked this pull request as ready for review January 2, 2025 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants