lilac.concepts
: Concepts#
Concepts are customizable signals that help enrich documents.
- class lilac.concepts.ConceptUpdate#
An update to a concept.
- param remove: list[str] | None = []#
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- class lilac.concepts.DiskConceptDB(project_dir: str | Path | None = None)#
A concept database.
- concept_acls(namespace: str, name: str, user: UserInfo | None = None) ConceptACL #
Return the ACL for a concept.
- create(namespace: str, name: str, type: ConceptType | str = ConceptType.TEXT, metadata: ConceptMetadata | None = None, user: UserInfo | None = None) Concept #
Create a concept.
- edit(namespace: str, name: str, change: ConceptUpdate, user: UserInfo | None = None) Concept #
Edit a concept. If the concept doesn’t exist, throw an error.
- get(namespace: str, name: str, user: UserInfo | None = None) Concept | None #
Return a concept or None if there isn’t one.
- list(user: UserInfo | None = None) list[ConceptInfo] #
List all the concepts.
- merge_draft(namespace: str, name: str, draft: str, user: UserInfo | None = None) Concept #
Merge a draft concept.
- namespace_acls(namespace: str, user: UserInfo | None = None) ConceptNamespaceACL #
Return the ACL for a namespace.
- remove(namespace: str, name: str, user: UserInfo | None = None) None #
Remove a concept.
- update_metadata(namespace: str, name: str, metadata: ConceptMetadata, user: UserInfo | None = None) None #
Update the metadata of a concept.
- Parameters:
namespace – The namespace of the concept.
name – The name of the concept.
metadata – The metadata to update.
user – The user updating the metadata, if authentication is enabled.
- class lilac.concepts.DiskConceptModelDB(concept_db: ConceptDB, project_dir: str | Path | None = None)#
Interface for the concept model database.
- create(namespace: str, concept_name: str, embedding_name: str, user: UserInfo | None = None) ConceptModel #
Create the concept model.
- get(namespace: str, concept_name: str, embedding_name: str, user: UserInfo | None = None) ConceptModel | None #
Get the model associated with the provided concept the embedding.
Returns None if the model does not exist.
- get_models(namespace: str, concept_name: str, user: UserInfo | None = None) list[ConceptModel] #
List all the models associated with a concept.
- remove(namespace: str, concept_name: str, embedding_name: str, user: UserInfo | None = None) None #
Remove the model of a concept.
- class lilac.concepts.Example#
A single example in a concept used for training a concept model.
- param id: str [Required]#
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- class lilac.concepts.ExampleIn#
An example in a concept without the id (used for adding new examples).
- param draft: str | None = 'main'#
- param img: bytes | None = None#
- param label: bool [Required]#
- param origin: ExampleOrigin | None = None#
- param text: str | None = None#
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}#
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.