-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #39 from LyzrCore/refactor/data-analyzr
Fixes and structural code changes
- Loading branch information
Showing
22 changed files
with
1,195 additions
and
795 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
from lyzr.base.file_utils import read_file, describe_dataset | ||
from lyzr.base.llm import LyzrLLMFactory | ||
from lyzr.base.llm import LyzrLLMFactory, LiteLLM | ||
from lyzr.base.llms import LLM, get_model | ||
from lyzr.base.service import LyzrService | ||
from lyzr.base.vector_store import LyzrVectorStoreIndex | ||
from lyzr.base.retrievers import LyzrRetriever | ||
from lyzr.base.prompt import Prompt | ||
from lyzr.base.prompt import LyzrPromptFactory | ||
from lyzr.base.base import ChatMessage, UserMessage, SystemMessage | ||
|
||
__all__ = [ | ||
"LyzrLLMFactory", | ||
"LyzrService", | ||
"LyzrVectorStoreIndex", | ||
"LLM", | ||
"Prompt", | ||
"get_model", | ||
"read_file", | ||
"describe_dataset", | ||
"LyzrRetriever", | ||
"LiteLLM", | ||
"LyzrPromptFactory", | ||
"ChatMessage", | ||
"UserMessage", | ||
"SystemMessage", | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
from enum import Enum | ||
from typing import Optional | ||
from pydantic import BaseModel, Field | ||
|
||
|
||
class MessageRole(str, Enum): | ||
"""Message role enum.""" | ||
|
||
USER = "user" | ||
ASSISTANT = "assistant" | ||
SYSTEM = "system" | ||
FUNCTION = "function" | ||
TOOL = "tool" | ||
|
||
|
||
class ChatMessage(BaseModel): | ||
"""Chat message.""" | ||
|
||
role: MessageRole = MessageRole.USER | ||
content: Optional[str] = "" | ||
additional_kwargs: dict = Field(default_factory=dict) | ||
|
||
def __str__(self) -> str: | ||
return f"{self.role.value}: {self.content}" | ||
|
||
|
||
class UserMessage(ChatMessage): | ||
"""User message.""" | ||
|
||
role: MessageRole = MessageRole.USER | ||
|
||
|
||
class AssistantMessage(ChatMessage): | ||
"""Assistant message.""" | ||
|
||
role: MessageRole = MessageRole.ASSISTANT | ||
|
||
|
||
class SystemMessage(ChatMessage): | ||
"""System message.""" | ||
|
||
role: MessageRole = MessageRole.SYSTEM | ||
|
||
|
||
class ChatResponse(BaseModel): | ||
"""Chat response.""" | ||
|
||
message: ChatMessage | ||
raw: Optional[dict] = None | ||
delta: Optional[str] = None | ||
additional_kwargs: dict = {} | ||
|
||
def __str__(self) -> str: | ||
return str(self.message) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.