MCPcopy Create free account
hub / github.com/AQ-MedAI/MedMemoryBench / list

Method list

methods/letta/orm/sqlalchemy_base.py:51–263  ·  view source on GitHub ↗

List records with before/after pagination, ordering by created_at. Can use both before and after to fetch a window of records. Args: db_session: SQLAlchemy session before: ID of item to paginate before (upper bound) after: ID of item to p

(
        cls,
        *,
        db_session: "Session",
        before: Optional[str] = None,
        after: Optional[str] = None,
        start_date: Optional[datetime] = None,
        end_date: Optional[datetime] = None,
        limit: Optional[int] = 50,
        query_text: Optional[str] = None,
        query_embedding: Optional[List[float]] = None,
        ascending: bool = True,
        tags: Optional[List[str]] = None,
        match_all_tags: bool = False,
        actor: Optional["User"] = None,
        access: Optional[List[Literal["read", "write", "admin"]]] = ["read"],
        access_type: AccessType = AccessType.ORGANIZATION,
        join_model: Optional[Base] = None,
        join_conditions: Optional[Union[Tuple, List]] = None,
        identifier_keys: Optional[List[str]] = None,
        identity_id: Optional[str] = None,
        **kwargs,
    )

Source from the content-addressed store, hash-verified

49 @classmethod
50 @handle_db_timeout
51 def list(
52 cls,
53 *,
54 db_session: "Session",
55 before: Optional[str] = None,
56 after: Optional[str] = None,
57 start_date: Optional[datetime] = None,
58 end_date: Optional[datetime] = None,
59 limit: Optional[int] = 50,
60 query_text: Optional[str] = None,
61 query_embedding: Optional[List[float]] = None,
62 ascending: bool = True,
63 tags: Optional[List[str]] = None,
64 match_all_tags: bool = False,
65 actor: Optional["User"] = None,
66 access: Optional[List[Literal["read", "write", "admin"]]] = ["read"],
67 access_type: AccessType = AccessType.ORGANIZATION,
68 join_model: Optional[Base] = None,
69 join_conditions: Optional[Union[Tuple, List]] = None,
70 identifier_keys: Optional[List[str]] = None,
71 identity_id: Optional[str] = None,
72 **kwargs,
73 ) -> List["SqlalchemyBase"]:
74 """
75 List records with before/after pagination, ordering by created_at.
76 Can use both before and after to fetch a window of records.
77
78 Args:
79 db_session: SQLAlchemy session
80 before: ID of item to paginate before (upper bound)
81 after: ID of item to paginate after (lower bound)
82 start_date: Filter items after this date
83 end_date: Filter items before this date
84 limit: Maximum number of items to return
85 query_text: Text to search for
86 query_embedding: Vector to search for similar embeddings
87 ascending: Sort direction
88 tags: List of tags to filter by
89 match_all_tags: If True, return items matching all tags. If False, match any tag.
90 **kwargs: Additional filters to apply
91 """
92 if start_date and end_date and start_date > end_date:
93 raise ValueError("start_date must be earlier than or equal to end_date")
94
95 logger.debug(f"Listing {cls.__name__} with kwarg filters {kwargs}")
96
97 with db_session as session:
98 # Get the reference objects for pagination
99 before_obj = None
100 after_obj = None
101
102 if before:
103 before_obj = session.get(cls, before)
104 if not before_obj:
105 raise NoResultFound(f"No {cls.__name__} found with id {before}")
106
107 if after:
108 after_obj = session.get(cls, after)

Callers 15

anthropic_get_model_listFunction · 0.45
list_identitiesMethod · 0.45
list_sourcesMethod · 0.45
get_source_by_nameMethod · 0.45
list_filesMethod · 0.45
get_messages_by_idsMethod · 0.45
list_groupsMethod · 0.45
list_group_messagesMethod · 0.45
list_jobsMethod · 0.45
get_job_messagesMethod · 0.45
get_job_stepsMethod · 0.45

Calls 12

NoResultFoundClass · 0.90
adapt_arrayFunction · 0.90
filterMethod · 0.80
scalarsMethod · 0.80
debugMethod · 0.65
listFunction · 0.50
getMethod · 0.45
joinMethod · 0.45
countMethod · 0.45
itemsMethod · 0.45
executeMethod · 0.45

Tested by

no test coverage detected