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

Add support for chat messages in LLM pipeline #718

Closed
davidmezzetti opened this issue May 18, 2024 · 0 comments
Closed

Add support for chat messages in LLM pipeline #718

davidmezzetti opened this issue May 18, 2024 · 0 comments
Assignees
Milestone

Comments

@davidmezzetti
Copy link
Member

All of the LLM generation frameworks (Hugging Face Transformers, llama.cpp and LiteLLM) support passing chat messages for completion.

The LLM pipeline should be modified to handle this format in addition to existing text prompt support. After this change, the following LLM pipeline calls will be equivalent.

messages = [
    {"role": "system", "content": "You are a friendly assistant. You answer questions from users."},
    {"role": "user", "content":"""
Answer the following question using only the context below. Only include information specifically discussed.

question: What is the speed of light?
context: The speed of light is 300K km/s"""}
]

llm(messages)
prompt = """<|im_start|>system
You are a friendly assistant. You answer questions from users.<|im_end|>
<|im_start|>user
Answer the following question using only the context below. Only include information specifically discussed.

question: What is the speed of light?
context: The speed of light is 300K km/s<|im_end|>
<|im_start|>assistant
"""

llm(prompt)
@davidmezzetti davidmezzetti added this to the v7.2.0 milestone May 18, 2024
@davidmezzetti davidmezzetti self-assigned this May 18, 2024
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

No branches or pull requests

1 participant