Module src.models.models

Expand source code
from enum import Enum

from pydantic import BaseModel


class ConversationRolesEnum(str, Enum):
    """Conversation roles for the LLM API."""

    SYSTEM = "system"
    USER = "user"
    ASSISTANT = "assistant"
    FUNCTION = "function"


class ConversationRolesInternalEnum(str, Enum):
    """Conversation roles for the internal usage."""

    CODE = "code_generation"
    ANALYSIS = "analysis_suggestion_interpretation"


class Message(BaseModel):
    """Messages are the basic building blocks of a conversation."""

    role: ConversationRolesEnum | ConversationRolesInternalEnum
    content: str


class LLMType(Enum):
    """The type of LLM to use."""

    GPT4 = "gpt4"
    LLAMA2 = "llama2"

Classes

class ConversationRolesEnum (value, names=None, *, module=None, qualname=None, type=None, start=1)

Conversation roles for the LLM API.

Expand source code
class ConversationRolesEnum(str, Enum):
    """Conversation roles for the LLM API."""

    SYSTEM = "system"
    USER = "user"
    ASSISTANT = "assistant"
    FUNCTION = "function"

Ancestors

  • builtins.str
  • enum.Enum

Class variables

var ASSISTANT
var FUNCTION
var SYSTEM
var USER
class ConversationRolesInternalEnum (value, names=None, *, module=None, qualname=None, type=None, start=1)

Conversation roles for the internal usage.

Expand source code
class ConversationRolesInternalEnum(str, Enum):
    """Conversation roles for the internal usage."""

    CODE = "code_generation"
    ANALYSIS = "analysis_suggestion_interpretation"

Ancestors

  • builtins.str
  • enum.Enum

Class variables

var ANALYSIS
var CODE
class LLMType (value, names=None, *, module=None, qualname=None, type=None, start=1)

The type of LLM to use.

Expand source code
class LLMType(Enum):
    """The type of LLM to use."""

    GPT4 = "gpt4"
    LLAMA2 = "llama2"

Ancestors

  • enum.Enum

Class variables

var GPT4
var LLAMA2
class Message (**data: Any)

Messages are the basic building blocks of a conversation.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

__init__ uses __pydantic_self__ instead of the more common self for the first arg to allow self as a field name.

Expand source code
class Message(BaseModel):
    """Messages are the basic building blocks of a conversation."""

    role: ConversationRolesEnum | ConversationRolesInternalEnum
    content: str

Ancestors

  • pydantic.main.BaseModel

Class variables

var content : str
var model_config
var model_fields
var roleConversationRolesEnum | ConversationRolesInternalEnum