Skip to content

Omit verified default query parameters from extract.custom requests #1194

Description

@ebhills

Simplify the URL produced by extract.custom while preserving its input/output, batching and endpoint behavior.

wrangles/extract.py currently always adds responseFormat, boolean flags and sort to the query. For a backend whose defaults have been verified, the default request should be:

POST /wrangles/extract/custom?model_id=<model_id>

An override remains explicit, for example:

POST /wrangles/extract/custom?model_id=<model_id>&use_labels=True&sort=input_order

The input stays in the existing JSON request body. This is URL cleanup, not a fix for server memory pressure or an API body redesign.

Proposed contract

For the built-in pattern extractor, verify and explicitly encode these server defaults: responseFormat=array, use_labels=false, caseSensitive=false, extract_raw=false, use_spellcheck=false, sort=training_order.

  • Normalize known parameter types deliberately, then omit only values proven equivalent to that backend's default.
  • Preserve explicit non-default options and existing keyword-argument precedence. Never generically remove falsy values, zero, blank strings or unknown parameters; invalid inputs must not silently become defaults.
  • Preserve the distinction between transport responseFormat and local output-shaping options such as output_format, first_element and include_empty_labels.
  • Use the metadata already obtained by the caller to scope the optimization. Validate AI/custom/bespoke contracts independently and preserve existing explicit parameters where equivalence is unverified.
  • Keep model ID, authentication, configured API base, JSON payload, batching and returned values unchanged.
  • Document that meaningful diagnostic context comes from effective options and a request ID, not a long exception URL. Retain server error/request identifiers when exposed, without including credentials or input content.

Acceptance criteria

  • Default built-in extraction produces the minimal URL above and returns the same results as the explicit-default form.
  • Non-default booleans, sort, response format and extra keyword parameters survive serialization correctly.
  • Invalid/falsy/unknown values preserve existing validation semantics.
  • Scalar/list input, batching and output-shaping behavior remain unchanged.
  • AI/bespoke handling has an explicit compatibility decision and regression coverage.
  • The JavaScript client uses the same documented default contract.

Use mocked request assertions and small synthetic response fixtures; this change does not require production model data.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions