Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,5 @@ llmstudio/llm_engine/logs/execution_logs.jsonl
*.db
.prettierignore

# DB Docker Compose
docker-compose*.yml
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new line

removed and actually added a compose for testing the examples/core.py with mysql or with postgres tracking

1 change: 1 addition & 0 deletions libs/tracker/llmstudio_tracker/db/migrations/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ def run_migrations_online() -> None:
target_metadata=target_metadata,
render_as_batch=is_sqlite,
compare_type=True,
compare_server_default=True,
version_table=alembic_table_name,
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Initial schema
"""initial_schema_setup

Revision ID: 6053ab0a97dc
Revision ID: 76452705dac2
Revises:
Create Date: 2025-05-05 11:27:42.586355
Create Date: 2025-05-19 16:07:58.586960

"""
from typing import Sequence, Union
Expand All @@ -11,7 +11,7 @@
from alembic import op

# revision identifiers, used by Alembic.
revision: str = "6053ab0a97dc"
revision: str = "76452705dac2"
down_revision: Union[str, None] = None
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None
Expand All @@ -24,15 +24,16 @@ def upgrade() -> None:
"logs_default",
sa.Column("log_id", sa.Integer(), nullable=False),
sa.Column("created_at", sa.DateTime(timezone=True), nullable=True),
sa.Column("session_id", sa.String(), nullable=True),
sa.Column("chat_input", sa.String(), nullable=True),
sa.Column("chat_output", sa.String(), nullable=True),
sa.Column("session_id", sa.String(length=191), nullable=True),
sa.Column("chat_input", sa.Text(), nullable=True),
sa.Column("chat_output", sa.Text(), nullable=True),
sa.Column("context", sa.JSON(), nullable=True),
sa.Column("provider", sa.String(), nullable=True),
sa.Column("model", sa.String(), nullable=True),
sa.Column("deployment", sa.String(), nullable=True),
sa.Column("provider", sa.String(length=191), nullable=True),
sa.Column("model", sa.String(length=191), nullable=True),
sa.Column("deployment", sa.String(length=191), nullable=True),
sa.Column("parameters", sa.JSON(), nullable=True),
sa.Column("metrics", sa.JSON(), nullable=True),
sa.Column("extras", sa.JSON(), nullable=True),
sa.PrimaryKeyConstraint("log_id"),
)
with op.batch_alter_table("logs_default", schema=None) as batch_op:
Expand All @@ -42,15 +43,15 @@ def upgrade() -> None:

op.create_table(
"prompts",
sa.Column("prompt_id", sa.String(), nullable=False),
sa.Column("prompt_id", sa.String(length=191), nullable=False),
sa.Column("config", sa.JSON(), nullable=True),
sa.Column("prompt", sa.String(), nullable=True),
sa.Column("prompt", sa.Text(), nullable=True),
sa.Column("is_active", sa.Boolean(), nullable=True),
sa.Column("name", sa.String(), nullable=False),
sa.Column("model", sa.String(), nullable=False),
sa.Column("provider", sa.String(), nullable=False),
sa.Column("name", sa.String(length=191), nullable=False),
sa.Column("model", sa.String(length=191), nullable=False),
sa.Column("provider", sa.String(length=191), nullable=False),
sa.Column("version", sa.Integer(), nullable=False),
sa.Column("label", sa.String(), nullable=True),
sa.Column("label", sa.String(length=191), nullable=True),
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=True),
sa.Column("created_at", sa.DateTime(timezone=True), nullable=True),
sa.PrimaryKeyConstraint("prompt_id"),
Expand All @@ -61,7 +62,7 @@ def upgrade() -> None:
op.create_table(
"sessions",
sa.Column("message_id", sa.Integer(), nullable=False),
sa.Column("session_id", sa.String(), nullable=True),
sa.Column("session_id", sa.String(length=191), nullable=True),
sa.Column("chat_history", sa.JSON(), nullable=True),
sa.Column("extras", sa.JSON(), nullable=True),
sa.Column("updated_at", sa.DateTime(timezone=True), nullable=True),
Expand Down

This file was deleted.

14 changes: 7 additions & 7 deletions libs/tracker/llmstudio_tracker/db/models/logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from llmstudio_tracker.base_class import Base
from llmstudio_tracker.config import DB_TYPE
from llmstudio_tracker.db_utils import JSONEncodedDict
from sqlalchemy import JSON, Column, DateTime, Integer, String
from sqlalchemy import JSON, Column, DateTime, Integer, String, Text


class LogDefault(Base):
Expand Down Expand Up @@ -35,13 +35,13 @@ class LogDefault(Base):
created_at = Column(
DateTime(timezone=True), default=lambda: datetime.now(timezone.utc)
)
session_id = Column(String)
chat_input = Column(String)
chat_output = Column(String)
session_id = Column(String(191))
chat_input = Column(Text)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@diogoncalves test on mdclone with postgresql and sqlite

chat_output = Column(Text)
context = Column(JSON)
provider = Column(String)
model = Column(String)
deployment = Column(String)
provider = Column(String(191))
model = Column(String(191))
deployment = Column(String(191))
parameters = Column(JSON)
metrics = Column(JSON)
extras = Column(JSON)
13 changes: 7 additions & 6 deletions libs/tracker/llmstudio_tracker/db/models/prompt_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
DateTime,
Integer,
String,
Text,
UniqueConstraint,
event,
func,
Expand All @@ -30,17 +31,17 @@ class PromptDefault(Base):
config = Column(JSONEncodedDict, nullable=True)
else:
prompt_id = Column(
String, primary_key=True, default=lambda: str(uuid.uuid4())
String(191), primary_key=True, default=lambda: str(uuid.uuid4())
) # Generate UUID as a string
config = Column(JSON, nullable=True)

prompt = Column(String)
prompt = Column(Text)
is_active = Column(Boolean, default=False)
name = Column(String, nullable=False)
model = Column(String, nullable=False)
provider = Column(String, nullable=False)
name = Column(String(191), nullable=False)
model = Column(String(191), nullable=False)
provider = Column(String(191), nullable=False)
version = Column(Integer, nullable=False)
label = Column(String)
label = Column(String(191))
updated_at = Column(
DateTime(timezone=True),
onupdate=lambda: datetime.now(timezone.utc),
Expand Down
2 changes: 1 addition & 1 deletion libs/tracker/llmstudio_tracker/db/models/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class SessionDefault(Base):

else:
message_id = Column(Integer, primary_key=True, index=True)
session_id = Column(String, index=True)
session_id = Column(String(191), index=True)
chat_history = Column(JSON)
extras = Column(JSON)

Expand Down
Loading