|
|
@ -42,12 +42,16 @@ DEFAULT_SYSTEM_PROMPT = """You are a helpful, respectful, and honest assistant."
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
@dataclass
|
|
|
|
class TGI_RESPONSE:
|
|
|
|
class TGI_RESPONSE:
|
|
|
|
|
|
|
|
"""Response from the TextGenInference API."""
|
|
|
|
|
|
|
|
|
|
|
|
choices: List[Any]
|
|
|
|
choices: List[Any]
|
|
|
|
usage: Dict
|
|
|
|
usage: Dict
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
|
@dataclass
|
|
|
|
class TGI_MESSAGE:
|
|
|
|
class TGI_MESSAGE:
|
|
|
|
|
|
|
|
"""Message to send to the TextGenInference API."""
|
|
|
|
|
|
|
|
|
|
|
|
role: str
|
|
|
|
role: str
|
|
|
|
content: str
|
|
|
|
content: str
|
|
|
|
tool_calls: List[Dict]
|
|
|
|
tool_calls: List[Dict]
|
|
|
@ -141,8 +145,7 @@ def _is_huggingface_pipeline(llm: Any) -> bool:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ChatHuggingFace(BaseChatModel):
|
|
|
|
class ChatHuggingFace(BaseChatModel):
|
|
|
|
"""
|
|
|
|
"""Hugging Face LLM's as ChatModels.
|
|
|
|
Wrapper for using Hugging Face LLM's as ChatModels.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Works with `HuggingFaceTextGenInference`, `HuggingFaceEndpoint`,
|
|
|
|
Works with `HuggingFaceTextGenInference`, `HuggingFaceEndpoint`,
|
|
|
|
`HuggingFaceHub`, and `HuggingFacePipeline` LLMs.
|
|
|
|
`HuggingFaceHub`, and `HuggingFacePipeline` LLMs.
|
|
|
|