Skip to content

refactor!: replace ModelRequestError with EmbeddingRequestError - #10

Merged
TheGreatAxios merged 2 commits into
cl-9063-embedding-move-intx-to-peerdependenciesfrom
cl-9052-embedding-replace-copied-transport-and-modelrequesterror
Sep 27, 2026
Merged

TheGreatAxios merged 2 commits into
cl-9063-embedding-move-intx-to-peerdependenciesfrom
cl-9052-embedding-replace-copied-transport-and-modelrequesterror

Conversation

@TheGreatAxios

@TheGreatAxios TheGreatAxios commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Stacked on build(deps): move @intx/* to peers and require arktype ^2.2.3 #9.
  • Every request failure (transport, HTTP, non-JSON 200, malformed/short/duplicate reply, bad base64, empty probe) throws EmbeddingRequestError extends Error with reason: InferenceError and url, classified by @intx/inference and retried via createDefaultRetryPolicy.
  • ModelRequestError and the runJSONRequest/extractRetryAfterMs exports are removed; the transport is private.
  • RequestDependencies and RetryAfterExtractor are exported as the types of EmbedOptions fields.
  • options is optional; deps defaults to global fetch + createDefaultScheduler(), resolved once per embedTexts call.
  • Config is asserted with EmbedConfigSchema (invalid config throws arktype's TraversalError); request objects are explicit literals.
  • README Errors section, ARCHITECTURE.md and IMPLEMENTATION.md describe the new surface.

Verification

  • typecheck, build and bun run test (20 pass); CI passes.

Closes CL-9052
Closes CL-9059
Closes CL-9050
Closes CL-9048
Closes CL-9054
Closes CL-9056

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review

Independent review of the stack found: bad base64 replies escaped as a raw DOMException or silently truncated vectors; non-integer indices were accepted; duplicate-index and non-JSON-200 coverage was lost; the live suite failed instead of skipping when the model was absent. All fixed in this stack (strict base64 decode, number.integer index, restored harness tests, model-aware skip).

Remaining notes: peer range >=0.4.0 follows sibling convention. Each commit typechecks, tests, and builds standalone.

@TheGreatAxios
TheGreatAxios force-pushed the cl-9052-embedding-replace-copied-transport-and-modelrequesterror branch 2 times, most recently from 27a0c90 to e51c19d Compare September 25, 2026 14:08
@TheGreatAxios
TheGreatAxios force-pushed the cl-9052-embedding-replace-copied-transport-and-modelrequesterror branch from e51c19d to 327108b Compare September 25, 2026 15:14
@TheGreatAxios
TheGreatAxios force-pushed the cl-9052-embedding-replace-copied-transport-and-modelrequesterror branch from 327108b to e8a3a43 Compare September 25, 2026 17:36
@TheGreatAxios
TheGreatAxios force-pushed the cl-9052-embedding-replace-copied-transport-and-modelrequesterror branch from e8a3a43 to 334513d Compare September 25, 2026 23:49
@TheGreatAxios TheGreatAxios changed the title EmbeddingRequestError, private transport, optional deps Replace ModelRequestError with EmbeddingRequestError and make the transport private Sep 25, 2026
Every failure, including a malformed or short reply and an empty probe,
throws EmbeddingRequestError carrying the classified InferenceError.
ModelRequestError and the runJSONRequest/extractRetryAfterMs exports are
gone; RequestDependencies and RetryAfterExtractor are exported as the
types of EmbedOptions fields. Options are optional, with deps defaulting
to global fetch and createDefaultScheduler(). Config is asserted against
EmbedConfigSchema, replacing the hand-written batchSize RangeError, and
request objects are explicit literals instead of conditional spreads.

Also closes CL-9059, CL-9050, CL-9048, CL-9054, CL-9056.
@TheGreatAxios
TheGreatAxios force-pushed the cl-9052-embedding-replace-copied-transport-and-modelrequesterror branch from 334513d to d8692c4 Compare September 26, 2026 01:29
@TheGreatAxios TheGreatAxios changed the title Replace ModelRequestError with EmbeddingRequestError and make the transport private refactor!: replace ModelRequestError with EmbeddingRequestError Sep 26, 2026
@TheGreatAxios
TheGreatAxios added this pull request to stack #15 September 26, 2026 01:58
@TheGreatAxios
TheGreatAxios merged commit b976fa3 into main Sep 27, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant