File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -159,17 +159,18 @@ def split_messages(
159159
160160 Args:
161161 messages: List of messages (either AnyMessage or dicts) to split.
162- by_tags: The additional_kwargs tag keys to use for splitting.
162+ by_tags: The tags in additional_kwargs to use for splitting.
163+ Tag will be in the format of {"tag": tag}.
163164
164165 Returns:
165166 Dict with keys as tags and values as lists of messages.
166167 """
167168 tagged_msgs = defaultdict (list )
168169 for msg in messages :
169170 additional_kwargs = getattr (msg , "additional_kwargs" , {})
170- if any (additional_kwargs .get (tag ) for tag in by_tags ):
171+ if any (additional_kwargs .get (" tag" ) == tag for tag in by_tags ):
171172 for tag in by_tags :
172- if additional_kwargs .get (tag ) :
173+ if additional_kwargs .get (" tag" ) == tag :
173174 tagged_msgs [tag ].append (msg )
174175 else :
175176 tagged_msgs ["default" ].append (msg )
You can’t perform that action at this time.
0 commit comments