orcalib.curate#
Curator
#
The Curator class provides an interface to record and query model feedback and input/output data.
Attributes:
-
model_id
–The model id to filter runs by.
-
model_version
–The model version to filter runs by.
-
runs
(RunsHandle
) –The runs table handle.
Examples:
Given a model with a lookup layer:
Create a curator for the model:
Record feedback and input/output data for a model run:
>>> curator.record_model_feedback(
... run_ids=1,
... feedback=0.5,
... name="default",
... kind="CONTINUOUS"
... )
>>> curator.record_model_input_output(
... run_ids=1,
... inputs="test input",
... outputs="test output"
... )
Query the runs of a model:
>>> runs_handle = curator.runs
>>> runs_handle.select(
... "inputs", "outputs", "default_feedback"
... ).where(runs_handle.id == 1).fetch()
[{'inputs': 'test input', 'outputs': 'test output', 'default_feedback': 0.5}]
Query the memories of a model:
>>> my_memories_handle = curator.get_memories_handle("my_index")
>>> my_memories_handle.select("label", "text").aggregate_runs(
... fn.avg(runs_handle.default_feedback).alias("avg_feedback"),
... fn.count(runs_handle.id).alias("num_runs")
... ).fetch(1)
[{'label': 'my_label', 'text': 'my_text', 'avg_feedback': 0.5, 'num_runs': 1}]
Parameters:
-
target
(Union[OrcaModule, OrcaDatabase, str]
) –The target model or database to curate.
-
model_id
(str | None
, default:None
) –The model id to filter the results by.
-
model_version
(str | None
, default:None
) –The model version to filter the results by.
get_memories_handle
#
Get a handle to query the memories table associated with the given index or table name.
Parameters:
-
index_name
(str
) –The index name associated with the memories.
Returns:
-
MemoriesHandle
–A handle to query the memories table.
Examples:
record_model_feedback
#
Records feedback for the given model runs.
Parameters: