Skip to content

Conversation

@rolandwalker
Copy link
Contributor

@rolandwalker rolandwalker commented Oct 25, 2025

Description

  • truncate text/binary sample data fields to 1024 characters (or smaller if judged to be needed)
  • truncate entire tables from schema representation if the representation is very large
  • for latency improvement, cache sample data and schema representation, passing the dbname in both cases to invalidate the cache if changing the db
  • add separate progress message when generating sample data

The target_size values are chosen somewhat arbitrarily, and it could be nice for the user to be able to control these.

We could also apply final size limits to the prompt string, though meaning-preserving truncation at that point is harder.

Addresses #1348.

Untested at the time of writing.

Checklist

  • I've added this contribution to the changelog.md.
  • I've added my name to the AUTHORS file (or it's already there).
  • I ran uv run ruff check && uv run ruff format && uv run mypy --install-types . to lint and format the code.

@rolandwalker rolandwalker self-assigned this Oct 25, 2025
 * truncate text/binary sample data fields to 1024 characters (or
   smaller if judged to be needed)
 * truncate entire tables from schema representation if the
   representation is very large
 * for latency improvement, cache sample data and schema representation,
   passing the dbname in both cases to invalidate the cache if changing
   the db
 * add separate progress message when generating sample data

The target_size values are chosen somewhat arbitrarily.

We could also apply final size limits to the prompt string, though
meaning-preserving truncation at that point is harder.

Addresses #1348.
@rolandwalker rolandwalker force-pushed the RW/conserve-llm-tokens-and-cache branch from 8cf2200 to a4eefea Compare October 25, 2025 22:40
@rolandwalker rolandwalker requested a review from amjith October 27, 2025 10:44
@rolandwalker rolandwalker changed the title Reduce size of LLM prompts Reduce size of LLM prompts + cache context Oct 27, 2025
@rolandwalker rolandwalker changed the title Reduce size of LLM prompts + cache context Reduce size of LLM prompts + cache per-schema context Oct 27, 2025
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.

2 participants