graphdoc.data.dspy_data.quality_data_helper module

class graphdoc.data.dspy_data.quality_data_helper.QualityDataHelper[source]

Bases: DspyDataHelper

A helper class for creating data objects related to our Documentation Quality dspy.Signature.

The example signature is defined as:

database_schema: str = dspy.InputField()
category: Literal["perfect", "almost perfect", "poor but correct", "incorrect"] = (
    dspy.OutputField()
)
rating: Literal[4, 3, 2, 1] = dspy.OutputField()
static example(inputs: dict[str, Any]) Example[source]

Given a dictionary of inputs, return a dspy.Example object.

Parameters:

inputs (dict[str, Any]) – A dictionary of inputs.

Returns:

A dspy.Example object.

Return type:

dspy.Example

static example_example() Example[source]

Return an example dspy.Example object with the inputs set to the example values.

Returns:

A dspy.Example object.

Return type:

dspy.Example

static model_signature() ModelSignature[source]

Return a mlflow.models.ModelSignature object. Based on the example object, removes the output fields and utilizes the remaining fields to infer the model signature.

Returns:

A mlflow.models.ModelSignature object.

Return type:

mlflow.models.ModelSignature

static prediction(inputs: dict[str, Any]) Prediction[source]

Given a dictionary of inputs, return a dspy.Prediction object.

Parameters:

inputs (dict[str, Any]) – A dictionary of inputs.

Returns:

A dspy.Prediction object.

Return type:

dspy.Prediction

static prediction_example() Prediction[source]

Return an example dspy.Prediction object with the inputs set to the example values.

Returns:

A dspy.Prediction object.

Return type:

dspy.Prediction

static trainset(inputs: dict[str, Any] | Dataset, filter_args: dict[str, Any] | None = None) list[Example][source]

Given a dictionary of inputs or a datasets.Dataset object, return a list of dspy.Example objects.

Parameters:
  • inputs (Union[dict[str, Any], datasets.Dataset]) – A dictionary of inputs or a datasets.Dataset object.

  • filter_args (Optional[dict[str, Any]]) – A dictionary of filter arguments. These are instructions for how we will filter and / or transform the inputs.

Returns:

A list of dspy.Example objects.

Return type:

list[dspy.Example]