Skip to content

Commit

Permalink
drop metadata.py and api keys table
Browse files Browse the repository at this point in the history
  • Loading branch information
mattzh72 committed Dec 14, 2024
1 parent 4884967 commit c64ce55
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 57 deletions.
42 changes: 42 additions & 0 deletions alembic/versions/4e88e702f85e_drop_api_tokens_table_in_oss.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
"""Drop api tokens table in OSS
Revision ID: 4e88e702f85e
Revises: d05669b60ebe
Create Date: 2024-12-13 17:19:55.796210
"""

from typing import Sequence, Union

import sqlalchemy as sa

from alembic import op

# revision identifiers, used by Alembic.
revision: str = "4e88e702f85e"
down_revision: Union[str, None] = "d05669b60ebe"
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.drop_index("tokens_idx_key", table_name="tokens")
op.drop_index("tokens_idx_user", table_name="tokens")
op.drop_table("tokens")
# ### end Alembic commands ###


def downgrade() -> None:
# ### commands auto generated by Alembic - please adjust! ###
op.create_table(
"tokens",
sa.Column("id", sa.VARCHAR(), autoincrement=False, nullable=False),
sa.Column("user_id", sa.VARCHAR(), autoincrement=False, nullable=False),
sa.Column("key", sa.VARCHAR(), autoincrement=False, nullable=False),
sa.Column("name", sa.VARCHAR(), autoincrement=False, nullable=True),
sa.PrimaryKeyConstraint("id", name="tokens_pkey"),
)
op.create_index("tokens_idx_user", "tokens", ["user_id"], unique=False)
op.create_index("tokens_idx_key", "tokens", ["key"], unique=False)
# ### end Alembic commands ###
10 changes: 5 additions & 5 deletions alembic/versions/9a505cc7eca9_create_a_baseline_migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql

import letta.metadata
import letta.orm
from alembic import op

# revision identifiers, used by Alembic.
Expand Down Expand Up @@ -43,8 +43,8 @@ def upgrade() -> None:
sa.Column("memory", sa.JSON(), nullable=True),
sa.Column("system", sa.String(), nullable=True),
sa.Column("agent_type", sa.String(), nullable=True),
sa.Column("llm_config", letta.metadata.LLMConfigColumn(), nullable=True),
sa.Column("embedding_config", letta.metadata.EmbeddingConfigColumn(), nullable=True),
sa.Column("llm_config", letta.orm.custom_columns.LLMConfigColumn(), nullable=True),
sa.Column("embedding_config", letta.orm.custom_columns.EmbeddingConfigColumn(), nullable=True),
sa.Column("metadata_", sa.JSON(), nullable=True),
sa.Column("tools", sa.JSON(), nullable=True),
sa.PrimaryKeyConstraint("id"),
Expand Down Expand Up @@ -119,7 +119,7 @@ def upgrade() -> None:
sa.Column("agent_id", sa.String(), nullable=True),
sa.Column("source_id", sa.String(), nullable=True),
sa.Column("embedding", pgvector.sqlalchemy.Vector(dim=4096), nullable=True),
sa.Column("embedding_config", letta.metadata.EmbeddingConfigColumn(), nullable=True),
sa.Column("embedding_config", letta.orm.custom_columns.EmbeddingConfigColumn(), nullable=True),
sa.Column("metadata_", sa.JSON(), nullable=True),
sa.Column("created_at", sa.DateTime(timezone=True), nullable=True),
sa.PrimaryKeyConstraint("id"),
Expand All @@ -131,7 +131,7 @@ def upgrade() -> None:
sa.Column("user_id", sa.String(), nullable=False),
sa.Column("name", sa.String(), nullable=False),
sa.Column("created_at", sa.DateTime(timezone=True), server_default=sa.text("now()"), nullable=True),
sa.Column("embedding_config", letta.metadata.EmbeddingConfigColumn(), nullable=True),
sa.Column("embedding_config", letta.orm.custom_columns.EmbeddingConfigColumn(), nullable=True),
sa.Column("description", sa.String(), nullable=True),
sa.Column("metadata_", sa.JSON(), nullable=True),
sa.PrimaryKeyConstraint("id"),
Expand Down
1 change: 0 additions & 1 deletion letta/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
)
from letta.local_llm.constants import ASSISTANT_MESSAGE_CLI_SYMBOL
from letta.log import get_logger
from letta.metadata import MetadataStore
from letta.schemas.enums import OptionState
from letta.schemas.memory import ChatMemory, Memory
from letta.server.server import logger as server_logger
Expand Down
50 changes: 0 additions & 50 deletions letta/metadata.py

This file was deleted.

1 change: 0 additions & 1 deletion letta/services/organization_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class OrganizationManager:
DEFAULT_ORG_NAME = "default_org"

def __init__(self):
# This is probably horrible but we reuse this technique from metadata.py
# TODO: Please refactor this out
# I am currently working on a ORM refactor and would like to make a more minimal set of changes
# - Matt
Expand Down

0 comments on commit c64ce55

Please sign in to comment.