feat: add instructions field to sources (#2089)

This commit is contained in:
jnjpng
2025-05-09 14:07:41 -07:00
committed by GitHub
parent 3fa1a295ba
commit b2e9d4bbfc
3 changed files with 35 additions and 0 deletions

View File

@@ -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 ###

View File

@@ -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.")

View File

@@ -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):
# optional
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.")
@@ -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.")