Skip to content

Conversation

@CharlieFRuan
Copy link
Member

@CharlieFRuan CharlieFRuan commented Aug 5, 2024

This PR supports using function calling with only system, user, assistant, tool messages, without using OpenAI fields tools or tool_calls. This provides users with the most flexibility for each model, but users need to parse the output on their own.

The counterpart to "manual function calling" is "function calling with OpenAI style". The difference between function-calling-manual and function-calling-openai is explained in examples/function-calling/README.md.

Examples of using Llama3.1 and Hermes2 are added to examples/function-calling/function-calling-manual, recreating the official usecase examples:

To support this, we make the following changes to the internal code:

  • Deprecate cases when ChatConfig.conv_template is a string, as we expect all mlc-chat-config.json to be updated (related to [Announcement] Breaking changes regarding conversation template #344)
    • As a result, we remove offset from ConvTemplateConfig, remove Conversation defined in getConversation(),
    • For testings, we manually copy paste mlc-chat-config.json to the testing files (e.g. we did this for Llama3.1, Hermes2, and gorilla)
  • Allow the last message to be from tool, in addition to user; support messages from tool
  • Add tests for Hermes2 and Llama3.1 formatting for function calling

@CharlieFRuan CharlieFRuan merged commit 82a9461 into mlc-ai:main Aug 5, 2024
CharlieFRuan added a commit that referenced this pull request Aug 5, 2024
No breaking changes. The only delta are the following two PRs:

- #523
- #527
- Added example for manual function calling without using the `tools`
fields

TVMjs
No change, compiled at
apache/tvm@e647684
jingyi-zhao-01 pushed a commit to jingyi-zhao-01/web-llm that referenced this pull request Dec 8, 2024
This PR supports using function calling with only `system`, `user`,
`assistant`, `tool` messages, without using OpenAI fields `tools` or
`tool_calls`. This provides users with the most flexibility for each
model, but users need to parse the output on their own.

Examples of using Llama3.1 and Hermes2 are added to
`examples/function-calling/function-calling-manual`, recreating the
official use case examples.
jingyi-zhao-01 pushed a commit to jingyi-zhao-01/web-llm that referenced this pull request Dec 8, 2024
No breaking changes. The only delta are the following two PRs:

- mlc-ai#523
- mlc-ai#527
- Added example for manual function calling without using the `tools`
fields

TVMjs
No change, compiled at
apache/tvm@e647684
atebites-hub pushed a commit to atebites-hub/web-llm that referenced this pull request Oct 4, 2025
This PR supports using function calling with only `system`, `user`,
`assistant`, `tool` messages, without using OpenAI fields `tools` or
`tool_calls`. This provides users with the most flexibility for each
model, but users need to parse the output on their own.

Examples of using Llama3.1 and Hermes2 are added to
`examples/function-calling/function-calling-manual`, recreating the
official use case examples.
atebites-hub pushed a commit to atebites-hub/web-llm that referenced this pull request Oct 4, 2025
No breaking changes. The only delta are the following two PRs:

- mlc-ai#523
- mlc-ai#527
- Added example for manual function calling without using the `tools`
fields

TVMjs
No change, compiled at
apache/tvm@e647684
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