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

Handle assistant messages with 'tool_calls' when used in chat_template #5

Merged
merged 2 commits into from
Oct 4, 2024

Conversation

Jeadie
Copy link

@Jeadie Jeadie commented Oct 4, 2024

🗣 Description

  • When using a chat_template that parse the tool call results (from an assistant message), the current implementation of MessageContent does not support the possible nesting.
  • The core change here is
-pub type MessageContent = Either<String, Vec<IndexMap<String, String>>>;
+pub type MessageContent = Either<String, Vec<IndexMap<String, Value>>>;
  • Also, change BasicProcessor to use template_action() -> MessagesAction::Keep (instead of MessagesAction::FlattenOnlyText) .

🔨 Related Issues

@Jeadie Jeadie self-assigned this Oct 4, 2024
Copy link

github-actions bot commented Oct 4, 2024

Code Metrics Report
  ===============================================================================
 Language            Files        Lines         Code     Comments       Blanks
===============================================================================
 C Header                2           35           28            0            7
 Dockerfile              1           34           25            0            9
 Happy                   1          442          369            0           73
 JSON                   12          105          104            0            1
 Python                 52         2268         1930           69          269
 TOML                   20          625          559            2           64
 YAML                    2           21           19            2            0
-------------------------------------------------------------------------------
 Jupyter Notebooks       4            0            0            0            0
 |- Markdown             2           77           32           31           14
 |- Python               2          196          169            1           26
 (Total)                            273          201           32           40
-------------------------------------------------------------------------------
 Markdown               38         2760            0         2094          666
 |- BASH                 6          103          100            0            3
 |- JSON                 1           12           12            0            0
 |- Python               5           92           82            0           10
 |- Rust                 9          322          274            0           48
 |- TOML                 2           75           63            0           12
 (Total)                           3364          531         2094          739
-------------------------------------------------------------------------------
 Rust                  260        75712        68239         1548         5925
 |- Markdown           123         1217           25         1117           75
 (Total)                          76929        68264         2665         6000
===============================================================================
 Total                 393        82002        71273         3715         7014
===============================================================================
  

@Jeadie Jeadie merged commit 470e0c1 into master Oct 4, 2024
11 checks passed
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.

1 participant