Files
letta-server/letta/orm/source.py
cthomas 33eaabb04a chore: bump version 0.8.14 (#2720)
Co-authored-by: Kian Jones <11655409+kianjones9@users.noreply.github.com>
Co-authored-by: Sarah Wooders <sarahwooders@gmail.com>
Co-authored-by: Matthew Zhou <mattzh1314@gmail.com>
Co-authored-by: Andy Li <55300002+cliandy@users.noreply.github.com>
Co-authored-by: jnjpng <jin@letta.com>
Co-authored-by: Jin Peng <jinjpeng@Jins-MacBook-Pro.local>
Co-authored-by: cpacker <packercharles@gmail.com>
Co-authored-by: Shubham Naik <shub@letta.com>
Co-authored-by: Shubham Naik <shub@memgpt.ai>
Co-authored-by: Kevin Lin <klin5061@gmail.com>
2025-07-14 11:03:15 -07:00

33 lines
1.4 KiB
Python

from typing import TYPE_CHECKING, Optional
from sqlalchemy import JSON, Index, UniqueConstraint
from sqlalchemy.orm import Mapped, mapped_column
from letta.orm.custom_columns import EmbeddingConfigColumn
from letta.orm.mixins import OrganizationMixin
from letta.orm.sqlalchemy_base import SqlalchemyBase
from letta.schemas.embedding_config import EmbeddingConfig
from letta.schemas.source import Source as PydanticSource
if TYPE_CHECKING:
pass
class Source(SqlalchemyBase, OrganizationMixin):
"""A source represents an embedded text passage"""
__tablename__ = "sources"
__pydantic_model__ = PydanticSource
__table_args__ = (
Index(f"source_created_at_id_idx", "created_at", "id"),
UniqueConstraint("name", "organization_id", name="uq_source_name_organization"),
{"extend_existing": True},
)
name: Mapped[str] = mapped_column(doc="the name of the source, must be unique within the org", nullable=False)
description: Mapped[str] = mapped_column(nullable=True, doc="a human-readable description of the source")
instructions: Mapped[str] = mapped_column(nullable=True, doc="instructions for how to use the source")
embedding_config: Mapped[EmbeddingConfig] = mapped_column(EmbeddingConfigColumn, doc="Configuration settings for embedding.")
metadata_: Mapped[Optional[dict]] = mapped_column(JSON, nullable=True, doc="metadata for the source.")