Module: mellea.stdlib.mobject

MObject.

Classes

class mellea.stdlib.mobject.Query(obj: Component, query: str)

A Query component.

Constructor

Initializes a new instance of Query with the provided object and query.

Arguments

  • obj: The object to be queried.
  • query: The query string used for querying the object.

Methods

mellea.stdlib.mobject.Query.parts()
Get the parts of the query.
mellea.stdlib.mobject.Query.format_for_llm()
Format the query for llm.

class mellea.stdlib.mobject.Transform(obj: Component, transformation: str)

A Transform component.

Constructor

Initializes a new instance of Transform with the provided object and transformation description.

Arguments

  • obj: The object to be queried.
  • transformation: The string used for transforming the object.

Methods

mellea.stdlib.mobject.Transform.parts()
Get the parts of the transform.
mellea.stdlib.mobject.Transform.format_for_llm()
Format the transform for llm.

class mellea.stdlib.mobject.MObjectProtocol()

Protocol to describe the necessary functionality of a MObject. Implementers should prefer inheriting from MObject than MObjectProtocol.

Methods

mellea.stdlib.mobject.MObjectProtocol.parts()
Returns a list of parts for MObject.
mellea.stdlib.mobject.MObjectProtocol.get_query_object(query: str)
Returns the instantiated query object.

Arguments

  • query: The query string.

mellea.stdlib.mobject.MObjectProtocol.get_transform_object(transformation: str)
Returns the instantiated transform object.

Arguments

  • transformation: the transform string

mellea.stdlib.mobject.MObjectProtocol.content_as_string()
Returns the content of MObject as a string. The default value is just str(self). Subclasses should override this method.
mellea.stdlib.mobject.MObjectProtocol._get_all_members()
Returns a list of all methods from the MObject except methods of the super class. Undocumented and methods with [no-index] in doc string are ignored.
mellea.stdlib.mobject.MObjectProtocol.format_for_llm()
The template representation used by the formatter. The default TemplateRepresentation uses an automatic parsing for tools and fields. The content is retrieved from content_as_string().

class mellea.stdlib.mobject.MObject(query_type: type = Query, transform_type: type = Transform)

An extension of Component for adding query and transform operations.

Constructor

Initializes a new instance of MObject with a specified query type and transformation type.

Arguments

  • query_type: The type of query to be used, defaults to Query if not provided.
  • transform_type: The type of transform to be used, defaults to Transform if not provided.

Methods

mellea.stdlib.mobject.MObject.parts()
Returns a list of parts for MObject.
mellea.stdlib.mobject.MObject.get_query_object(query: str)
Returns the instantiated query object.

Arguments

  • query: The query string.

mellea.stdlib.mobject.MObject.get_transform_object(transformation: str)
Returns the instantiated transform object.

Arguments

  • transformation: the transform string

mellea.stdlib.mobject.MObject.content_as_string()
Returns the content of MObject as a string. The default value is just str(self). Subclasses should override this method.
mellea.stdlib.mobject.MObject._get_all_members()
Returns a list of all methods from the MObject except methods of the super class. Undocumented and methods with [no-index] in doc string are ignored.
mellea.stdlib.mobject.MObject.format_for_llm()
The template representation used by the formatter. The default TemplateRepresentation uses an automatic parsing for tools and fields. The content is retrieved from content_as_string().