architxt.labelling#

Functions

apply_renaming(forest, renames)

Apply a collection of renaming to a forest.

llm_group_labelling(schema, llm, *[, ...])

Get a group renaming for a forest using an LLM.

llm_relation_labelling(schema, llm, *[, ...])

Get a renaming of relations for a forest using an LLM.

Classes

Renaming(node_type, old_name, new_name)

class architxt.labelling.Renaming(node_type, old_name, new_name)[source]#

Bases: object

new_name#

Type:    str

node_type#

Type:    NodeType

old_name#

Type:    str

architxt.labelling.apply_renaming(forest, renames)[source]#

Apply a collection of renaming to a forest.

Parameters:
  • forest (Forest) – The forest to modify in-place.

  • renames (Collection[Renaming]) – The collection of renaming to apply.

Return type:

None

architxt.labelling.llm_group_labelling(schema, llm, *, forest=None, sample_size=5)[source]#

Get a group renaming for a forest using an LLM.

Parameters:
  • schema (Schema) – The schema to relabel.

  • llm (BaseChatModel) – The LLM model to use.

  • forest (Forest | None) – The forest to relabel, needed to provide sample data.

  • sample_size (int) – Number of sample instances to provide to the LLM for each group.

Return type:

set[Renaming]

Returns:

A set of renaming for groups.

architxt.labelling.llm_relation_labelling(schema, llm, *, group_renames=None)[source]#

Get a renaming of relations for a forest using an LLM.

Parameters:
  • schema (Schema) – The schema to relabel.

  • llm (BaseChatModel) – The LLM model to use.

  • group_renames (Collection[Renaming] | None) – A collection of renaming for groups to provide context.

Return type:

set[Renaming]

Returns:

The renaming for relations.