Skip to content

feat: harden inference path and add drop-in sql entry point - #2

Merged
eddietejeda merged 2 commits into
mainfrom
feat/inference-hardening-and-sql-entry
Sep 23, 2026
Merged

eddietejeda merged 2 commits into
mainfrom
feat/inference-hardening-and-sql-entry

Conversation

@eddietejeda

@eddietejeda eddietejeda commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Ask about each distinct input once per invocation and copy the answer to every row sharing it, so constant input costs one request
  • Scale the probability-sum tolerance with the criteria count
  • Measure the per-row cap and batch split on JSON-encoded size; only suggest lowering batch_size when the batch has more than one row
  • Keep score criterion labels in the request when a description is set
  • Accept dictionary-encoded text input
  • Hold the concurrency permit only while a request is in flight
  • Add datafusion_jev::sql / sql_with_options as a drop-in for SessionContext::sql, with a clear error on strict SQL dialects
  • Rewrite README and crate docs for users; tests expanded from 12 to 24

Validation

  • cargo fmt --check, cargo clippy --all-targets -- -D warnings, cargo test all pass
  • Validated in a downstream host application: its integration tests pass, and live queries against the provider returned correct noul, choice, and score results with input and expression dedup confirmed

- Ask about each distinct input once per invocation and copy the
  answer to every row sharing it, so constant input costs one request
- Scale the probability-sum tolerance with the criteria count
- Measure the per-row cap and batch split on JSON-encoded size; only
  suggest lowering batch_size when the batch has more than one row
- Keep score criterion labels in the request when a description is set
- Accept dictionary-encoded text input
- Hold the concurrency permit only while a request is in flight
- Add datafusion_jev::sql / sql_with_options as a drop-in for
  SessionContext::sql, with a clear error on strict SQL dialects
- Rewrite README and crate docs for users; expand tests to 24
@eddietejeda
eddietejeda requested a review from a team as a code owner September 23, 2026 17:21
@eddietejeda
eddietejeda requested review from rohan-hotdata and removed request for a team September 23, 2026 17:21
Comment thread README.md Outdated
This first version supports single-question calls. `questions := ...` and the JSON configuration escape hatch are not implemented. It follows MotherDuck's public interface for the supported subset; it is not MotherDuck code.
- **NULL text** returns NULL without calling the service.
- **Repeated text** is asked once and the answer is copied to every matching row.
A constant like `prompt_jev('hello', ...)` costs one request no matter how many rows.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

nit: Qualify the dedup claim as per batch of up to 256 rows. (not blocking)

Dedup state lives inside one invoke_async_with_args call. ideal_batch_size returns 256 (src/udf.rs:359), and each partition invokes separately. A constant over 10,000 rows therefore costs about 40 requests, not one. Users who trust "no matter how many rows" underestimate cost.

Suggested change
A constant like `prompt_jev('hello', ...)` costs one request no matter how many rows.
Within each batch of up to 256 rows, a constant like `prompt_jev('hello', ...)` costs one request.

claude[bot]
claude Bot previously approved these changes Sep 23, 2026
@eddietejeda
eddietejeda merged commit 1e54ea9 into main Sep 23, 2026
3 checks passed
@eddietejeda
eddietejeda deleted the feat/inference-hardening-and-sql-entry branch September 23, 2026 21:01
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