Skip to content

Commit

Permalink
minimal orm test passes
Browse files Browse the repository at this point in the history
  • Loading branch information
norton120 committed Jul 8, 2024
1 parent 3e6f906 commit 94ce074
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions memgpt/orm/organization.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from memgpt.orm.source import Source
from memgpt.orm.tool import Tool
from memgpt.orm.preset import Preset
from memgpt.orm.document import Document
from memgpt.orm.memory_templates import HumanMemoryTemplate, PersonaMemoryTemplate
from sqlalchemy.orm import Session

Expand All @@ -30,6 +31,7 @@ class Organization(SqlalchemyBase):
presets: Mapped["Preset"] = relationship("Preset", back_populates="organization", cascade="all, delete-orphan")
personas: Mapped["PersonaMemoryTemplate"] = relationship("PersonaMemoryTemplate", back_populates="organization", cascade="all, delete-orphan")
humans: Mapped["HumanMemoryTemplate"] = relationship("HumanMemoryTemplate", back_populates="organization", cascade="all, delete-orphan")
documents: Mapped["Document"] = relationship("Document", back_populates="organization", cascade="all, delete-orphan")

@classmethod
def default(cls, db_session:"Session") -> "Organization":
Expand Down
2 changes: 2 additions & 0 deletions memgpt/orm/user.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
if TYPE_CHECKING:
from memgpt.orm.agent import Agent
from memgpt.orm.token import Token
from memgpt.orm.job import Job

class User(SqlalchemyBase, OrganizationMixin):
"""User ORM class"""
Expand All @@ -28,4 +29,5 @@ class User(SqlalchemyBase, OrganizationMixin):
back_populates="users",
doc="the agents associated with this user.")
tokens: Mapped[List["Token"]] = relationship("Token", back_populates="user", doc="the tokens associated with this user.")
jobs: Mapped[List["Job"]] = relationship("Job", back_populates="user", doc="the jobs associated with this user.")

2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def db_session(request) -> "Session":
case "sqlite_chroma":
database_uri = f"sqlite:///{adapter['database']}"
case "postgres":
url_parts = list(urlsplit(settings.postgres_uri))
url_parts = list(urlsplit(settings.backend.database_uri))
PATH_PARAM = 2
url_parts[PATH_PARAM] = f"/{adapter['database']}"
database_uri = urlunsplit(url_parts)
Expand Down
3 changes: 1 addition & 2 deletions tests/test_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@
from memgpt import Admin, create_client
from memgpt.agent import Agent
from memgpt.config import MemGPTConfig
from memgpt.constants import DEFAULT_PRESET
from memgpt.credentials import MemGPTCredentials
from memgpt.memory import ChatMemory
from memgpt.settings import settings
from tests.utils import create_config

test_agent_name = f"test_client_{str(uuid.uuid4())}"
# test_preset_name = "test_preset"
test_preset_name = DEFAULT_PRESET
test_preset_name = settings.preset
test_agent_state = None
client = None

Expand Down

0 comments on commit 94ce074

Please sign in to comment.