Aludel.Evals.TestCaseEditor (aludel v0.7.0)

Copy Markdown View Source

Coordinates suite test case editing workflows outside the web layer.

Summary

Functions

Converts a test case into parameters shared by the visual and JSON editors.

Builds the schemaless changeset used to validate the test-case editor form.

Creates an empty suite test case with variables derived from a prompt template.

Parses editor parameters and persists variables and assertions for a test case.

Functions

build_form_params(test_case)

@spec build_form_params(Aludel.Evals.TestCase.t()) :: map()

Converts a test case into parameters shared by the visual and JSON editors.

change_form(test_case_or_params, opts \\ [])

@spec change_form(
  Aludel.Evals.TestCase.t() | map(),
  keyword()
) :: Ecto.Changeset.t()

Builds the schemaless changeset used to validate the test-case editor form.

Pass :assertion_error or :action in opts to surface assertion parsing failures or set the changeset action.

create_test_case(suite_id, prompt)

@spec create_test_case(binary(), map()) ::
  {:ok, Aludel.Evals.TestCase.t()} | {:error, Ecto.Changeset.t()}

Creates an empty suite test case with variables derived from a prompt template.

update_test_case(test_case, params, edit_mode)

@spec update_test_case(
  Aludel.Evals.TestCase.t(),
  map(),
  Aludel.Evals.AssertionParser.parse_mode()
) ::
  {:ok, Aludel.Evals.TestCase.t()}
  | {:error, String.t()}
  | {:error, Ecto.Changeset.t()}

Parses editor parameters and persists variables and assertions for a test case.