cuery.tools.flex.entities ========================= .. py:module:: cuery.tools.flex.entities Attributes ---------- .. autoapisummary:: cuery.tools.flex.entities.PROMPT Classes ------- .. autoapisummary:: cuery.tools.flex.entities.EntityExtractor Functions --------- .. autoapisummary:: cuery.tools.flex.entities.prompt_definitions cuery.tools.flex.entities.make_entity_model cuery.tools.flex.entities.make_entities_model Module Contents --------------- .. py:data:: PROMPT :value: Multiline-String .. raw:: html
Show Value .. code-block:: python """ # Instructions From the Data Record section below extract entities in the following categories: ${definitions} For each entity, provide the entity name/text as it appears, and the type/category of entity. Ensure to report the names of entities always in lowercase and singular form, even if they appear in plural or uppercase in the source titles, to avoid inconsistencies in the output. Expected output format: [{"name": "", "type": ""}, ...] For example, if the data record contains "Apple iPhone 15 Pro Max Review", and entity definitions include a "brand" category and a "product" category, the expected output would be: [{"name": "apple", "type": "brand"}, {"name": "iphone 15", "type": "product"}] # Data Record ${record_template} """ .. raw:: html
.. py:function:: prompt_definitions(entities) Generate the definitions section for the entity extraction prompt. .. py:function:: make_entity_model(entities) Dynamically create a response model for a score based on provided parameters. .. py:function:: make_entities_model(entities) Create a response model for a list of entities. .. py:class:: EntityExtractor(/, **data) Bases: :py:obj:`cuery.tools.flex.base.FlexTool` "Extract SEO-relevant entities from Google SERP AI Overview data. .. py:attribute:: entities :type: dict[str, str] Dictionary of entity names/categories and their descriptions. .. py:property:: prompt :type: cuery.Prompt Defines the prompt for this tool (ClassVar or property). .. py:property:: response_model :type: cuery.ResponseClass Defines the response model for this tool (ClassVar or property). .. py:method:: __call__(**kwargs) :async: Normalize the nested input records back into individual columns in output.