mirror of
https://github.com/cpacker/MemGPT.git
synced 2025-06-03 04:30:22 +00:00

Co-authored-by: Andy Li <55300002+cliandy@users.noreply.github.com> Co-authored-by: Kevin Lin <klin5061@gmail.com> Co-authored-by: Sarah Wooders <sarahwooders@gmail.com> Co-authored-by: jnjpng <jin@letta.com> Co-authored-by: Matthew Zhou <mattzh1314@gmail.com>
27 lines
1.1 KiB
Python
27 lines
1.1 KiB
Python
import uuid
|
|
|
|
from sqlalchemy import JSON, Index, String
|
|
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
|
|
|
from letta.orm.mixins import OrganizationMixin
|
|
from letta.orm.sqlalchemy_base import SqlalchemyBase
|
|
from letta.schemas.provider_trace import ProviderTrace as PydanticProviderTrace
|
|
|
|
|
|
class ProviderTrace(SqlalchemyBase, OrganizationMixin):
|
|
"""Defines data model for storing provider trace information"""
|
|
|
|
__tablename__ = "provider_traces"
|
|
__pydantic_model__ = PydanticProviderTrace
|
|
__table_args__ = (Index("ix_step_id", "step_id"),)
|
|
|
|
id: Mapped[str] = mapped_column(
|
|
primary_key=True, doc="Unique provider trace identifier", default=lambda: f"provider_trace-{uuid.uuid4()}"
|
|
)
|
|
request_json: Mapped[dict] = mapped_column(JSON, doc="JSON content of the provider request")
|
|
response_json: Mapped[dict] = mapped_column(JSON, doc="JSON content of the provider response")
|
|
step_id: Mapped[str] = mapped_column(String, nullable=True, doc="ID of the step that this trace is associated with")
|
|
|
|
# Relationships
|
|
organization: Mapped["Organization"] = relationship("Organization", lazy="selectin")
|