mirror of
https://github.com/hwchase17/langchain.git
synced 2025-09-22 19:09:57 +00:00
experimental[minor]: adds mixtral wrapper (#17423)
**Description:** Adds a chat wrapper for Mixtral models using the [prompt template](https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1#instruction-format). --------- Co-authored-by: Bagatur <baskaryan@gmail.com>
This commit is contained in:
@@ -17,10 +17,11 @@ an interface where "chat messages" are the inputs and outputs.
|
||||
AIMessage, BaseMessage, HumanMessage
|
||||
""" # noqa: E501
|
||||
|
||||
from langchain_experimental.chat_models.llm_wrapper import Llama2Chat, Orca, Vicuna
|
||||
from langchain_experimental.chat_models.llm_wrapper import (
|
||||
Llama2Chat,
|
||||
Mixtral,
|
||||
Orca,
|
||||
Vicuna,
|
||||
)
|
||||
|
||||
__all__ = [
|
||||
"Llama2Chat",
|
||||
"Orca",
|
||||
"Vicuna",
|
||||
]
|
||||
__all__ = ["Llama2Chat", "Orca", "Vicuna", "Mixtral"]
|
||||
|
@@ -148,6 +148,23 @@ class Llama2Chat(ChatWrapper):
|
||||
usr_0_end: str = " [/INST]"
|
||||
|
||||
|
||||
class Mixtral(ChatWrapper):
|
||||
"""See https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1#instruction-format""" # noqa: E501
|
||||
|
||||
@property
|
||||
def _llm_type(self) -> str:
|
||||
return "mixtral"
|
||||
|
||||
sys_beg: str = "<s>[INST] "
|
||||
sys_end: str = "\n"
|
||||
ai_n_beg: str = " "
|
||||
ai_n_end: str = " </s>"
|
||||
usr_n_beg: str = " [INST] "
|
||||
usr_n_end: str = " [/INST]"
|
||||
usr_0_beg: str = ""
|
||||
usr_0_end: str = " [/INST]"
|
||||
|
||||
|
||||
class Orca(ChatWrapper):
|
||||
"""Wrapper for Orca-style models."""
|
||||
|
||||
|
Reference in New Issue
Block a user