plugins.operators.undeclared_fields#
Builtin operators.
Functions:
|
Finds the values stored on the dataset's samples and frames under fields that its schema does not declare. |
|
Removes the stored values of the given undeclared fields, and marks the samples and frames that stored them as modified. |
|
Adds the given undeclared fields to the dataset's schema, with the type of their stored values. |
Classes:
|
- plugins.operators.undeclared_fields.find_undeclared_fields(dataset)#
Finds the values stored on the datasetβs samples and frames under fields that its schema does not declare.
A sample or frame that stores such a value cannot be loaded, so it cannot be saved either. Values like this are typically left behind when a field is removed from the schema while documents still store it, for example by a run that is deleted while it is writing. Undeclared attributes of labels are not reported: labels accept them.
This reads every sample (and frame) of the dataset.
- Parameters:
dataset β a
fiftyone.core.dataset.Dataset- Returns:
a dict mapping each undeclared field (frame fields prefixed with
"frames.") to a dict with thecountof documents that store it and the sorted BSONtypesof its stored values
- plugins.operators.undeclared_fields.remove_undeclared_fields(dataset, fields)#
Removes the stored values of the given undeclared fields, and marks the samples and frames that stored them as modified.
A field that the schema declares when this runs is never touched, so a field declared since it was found keeps its values.
- Parameters:
dataset β a
fiftyone.core.dataset.Datasetfields β the undeclared fields, as returned by
find_undeclared_fields()
- Returns:
the list of fields whose values were removed
- plugins.operators.undeclared_fields.declare_undeclared_fields(dataset, fields)#
Adds the given undeclared fields to the datasetβs schema, with the type of their stored values.
The field must hold every stored value, so a field whose values have more than one type is skipped, except ints mixed with floats, which are declared as a float field when the ints fit one exactly. So is a field whose values are documents of different kinds, or whose name cannot be a field name. A list field whose elements have different types is declared as an untyped list.
- Parameters:
dataset β a
fiftyone.core.dataset.Datasetfields β the undeclared fields, as returned by
find_undeclared_fields()
- Returns:
a tuple of
the list of fields that were declared
a dict mapping the fields that were skipped to the reason
- class plugins.operators.undeclared_fields.CleanUpUndeclaredFields(_builtin=False)#
Bases:
OperatorAttributes:
The
OperatorConfigfor the operator.Whether the operator is builtin.
The effective risk level of the operator, which is used by guardrail systems of an agent to classify tool calls.
The unique identifier of the operator:
plugin_name/operator_name.Methods:
resolve_input(ctx)Returns the resolved input property.
execute(ctx)Executes the operator.
resolve_output(ctx)Returns the resolved output property.
add_secrets(secrets)Adds secrets to the operator.
method_to_uri(method_name)Converts a method name to a URI.
resolve_delegation(ctx)Returns the resolved forced delegation flag.
Returns the resolved execution options.
resolve_placement(ctx)Returns the resolved placement of the operator.
resolve_run_name(ctx)Returns the resolved run name of the operator.
resolve_type(ctx,Β type)Returns the resolved input or output property.
to_json()Returns a JSON representation of the operator.
- property config#
The
OperatorConfigfor the operator.
- resolve_input(ctx)#
Returns the resolved input property.
Subclasses can implement this method to define the inputs to the operator. This method should never be called directly. Instead use
resolve_type().By default, this method is called once when the operator is created. If the operator is dynamic, this method is called each time the input changes.
- Parameters:
ctx β the
fiftyone.operators.executor.ExecutionContext- Returns:
a
fiftyone.operators.types.Property, or None
- execute(ctx)#
Executes the operator.
Subclasses must implement this method.
- Parameters:
ctx β the
fiftyone.operators.executor.ExecutionContext- Returns:
JSON serializable data, or None
- resolve_output(ctx)#
Returns the resolved output property.
Subclasses can implement this method to define the outputs of the operator.
By default, this method is called once when the operator is created. If the operator is dynamic, this method is called after the operator is executed.
- Parameters:
ctx β the
fiftyone.operators.executor.ExecutionContext- Returns:
a
fiftyone.operators.types.Property, or None
- add_secrets(secrets)#
Adds secrets to the operator.
- Parameters:
secrets β a list of secrets
- property builtin#
Whether the operator is builtin.
- method_to_uri(method_name)#
Converts a method name to a URI.
- Parameters:
method_name β the method name
- Returns:
a URI
- property name#
- resolve_delegation(ctx) bool | None#
Returns the resolved forced delegation flag.
Subclasses can implement this method to decide if delegated execution should be forced for the given operation.
- Parameters:
ctx β the
fiftyone.operators.executor.ExecutionContext- Returns:
whether the operation should be delegated (True), run immediately (False), or None to defer to
resolve_execution_options()to specify the available options
- resolve_execution_options(ctx)#
Returns the resolved execution options.
Subclasses can implement this method to define the execution options available for the operation.
- Parameters:
ctx β the
fiftyone.operators.executor.ExecutionContext- Returns:
a
fiftyone.operators.executor.ExecutionOptionsinstance
- resolve_placement(ctx)#
Returns the resolved placement of the operator.
Subclasses can implement this method to define the placement of the operator.
- Parameters:
ctx β the
fiftyone.operators.executor.ExecutionContext- Returns:
a
fiftyone.operators.types.Placement, or None
- resolve_run_name(ctx)#
Returns the resolved run name of the operator.
Subclasses can implement this method to define the run name of the operator.
- Parameters:
ctx β the
fiftyone.operators.executor.ExecutionContext- Returns:
a string, or None
- resolve_type(ctx, type)#
Returns the resolved input or output property.
- Parameters:
ctx β the
fiftyone.operators.executor.ExecutionContexttype β the type of property to resolve, either
"inputs"or"outputs"
- Returns:
a
fiftyone.operators.types.Property, or None
- property risk_level#
The effective risk level of the operator, which is used by guardrail systems of an agent to classify tool calls.
- to_json()#
Returns a JSON representation of the operator.
- Returns:
a JSON dict
- property uri#
The unique identifier of the operator:
plugin_name/operator_name.