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

feat: support chat format #72

Merged
merged 6 commits into from
Jul 28, 2024
Merged

feat: support chat format #72

merged 6 commits into from
Jul 28, 2024

Conversation

jhen0409
Copy link
Member

Support convert OpenAI API compatible message ([{ role, content }, ...] and then llama_chat_apply_template.

  • New field: context.model.isChatTemplateSupported
  • context.completion(...): Add messages: RNLlamaOAICompatibleMessage[] in params
    • It is not recommended to use messages if the model is not supported chat template
  • New util: context.getFormattedChat(messages: RNLlamaOAICompatibleMessage[]): string)
    • If the chat template is not supported in model, we will fallback to use chatml as format
    • context.completion also uses it to convert messages to prompt

@jhen0409 jhen0409 merged commit 030ebaf into main Jul 28, 2024
4 checks passed
@jhen0409 jhen0409 deleted the chat-format branch July 28, 2024 08:29
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