Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.
feat: add instructions field to sources (#2089)
jnjpngc4790cb92ec3
diff --git a/alembic/versions/18e300709530_add_instructions_field_to_sources.py b/alembic/versions/18e300709530_add_instructions_field_to_sources.pynew file mode 100644index 000000000..138494d0a--- /dev/null+++ b/alembic/versions/18e300709530_add_instructions_field_to_sources.py@@ -0,0 +1,31 @@+"""add instructions field to sources++Revision ID: 18e300709530+Revises: 878607e41ca4+Create Date: 2025-05-08 17:56:20.877183++"""++from typing import Sequence, Union++import sqlalchemy as sa++from alembic import op++# revision identifiers, used by Alembic.+revision: str = "18e300709530"+down_revision: Union[str, None] = "878607e41ca4"+branch_labels: Union[str, Sequence[str], None] = None+depends_on: Union[str, Sequence[str], None] = None+++def upgrade() -> None:+ # ### commands auto generated by Alembic - please adjust! ###+ op.add_column("sources", sa.Column("instructions", sa.String(), nullable=True))+ # ### end Alembic commands ###+++def downgrade() -> None:+ # ### commands auto generated by Alembic - please adjust! ###+ op.drop_column("sources", "instructions")+ # ### end Alembic commands ###diff --git a/letta/orm/source.py b/letta/orm/source.pyindex b71e3989e..9423bdaf8 100644--- a/letta/orm/source.py+++ b/letta/orm/source.py@@ -30,6 +30,7 @@ class Source(SqlalchemyBase, OrganizationMixin):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.")diff --git a/letta/schemas/source.py b/letta/schemas/source.pyindex 46e041510..79476780f 100644--- a/letta/schemas/source.py+++ b/letta/schemas/source.py@@ -31,6 +31,7 @@ class Source(BaseSource):id: str = BaseSource.generate_id_field()name: str = Field(..., description="The name of the source.")description: Optional[str] = Field(None, description="The description of the source.")+ instructions: Optional[str] = Field(None, description="Instructions for how to use the source.")embedding_config: EmbeddingConfig = Field(..., description="The embedding configuration used by the source.")organization_id: Optional[str] = Field(None, description="The ID of the organization that created the source.")metadata: Optional[dict] = Field(None, validation_alias="metadata_", description="Metadata associated with the source.")@@ -59,6 +60,7 @@ class SourceCreate(BaseSource):# optionaldescription: Optional[str] = Field(None, description="The description of the source.")+ instructions: Optional[str] = Field(None, description="Instructions for how to use the source.")metadata: Optional[dict] = Field(None, description="Metadata associated with the source.")@@ -69,5 +71,6 @@ class SourceUpdate(BaseSource):name: Optional[str] = Field(None, description="The name of the source.")description: Optional[str] = Field(None, description="The description of the source.")+ instructions: Optional[str] = Field(None, description="Instructions for how to use the source.")metadata: Optional[dict] = Field(None, description="Metadata associated with the source.")embedding_config: Optional[EmbeddingConfig] = Field(None, description="The embedding configuration used by the source.")