Skip to content

feat(compact): complete remaining issue #30 items - #726

Draft
crstrn13 wants to merge 2 commits into
praxis-proxy:mainfrom
crstrn13:feat/compact-filter-issue-30
Draft

feat(compact): complete remaining issue #30 items#726
crstrn13 wants to merge 2 commits into
praxis-proxy:mainfrom
crstrn13:feat/compact-filter-issue-30

Conversation

@crstrn13

Copy link
Copy Markdown
Contributor

Summary

Completes the remaining work items from #30:

  • Use previous_usage for token estimationshould_compact() checks the stored usage.total_tokens from the rehydrated response before falling back to local tiktoken counting
  • Configurable summary prefixsummary_prefix config option (default: [Previous conversation summary]) carried through to compaction items and both translation paths
  • Hide compaction items from input_items APInormalize_input_items() filters out {"type": "compaction"} items so clients never see internal state
  • Persist compaction as a stored response — after summarization, the compacted response is written back to the response store with the compaction item in its input
  • Explicit compact endpointPOST /v1/responses/{id}/compact triggers compaction on a previously stored response

Test plan

  • cargo test -p praxis-ai-apis — new unit tests for all 5 items
  • cargo test -p praxis-ai-filters — no regressions in filter tests
  • make lint passes
  • Manual test with example config against a real inference backend

- Use previous_usage total_tokens before falling back to tiktoken
- Add configurable summary_prefix (default: "[Previous conversation summary]\n\n")
- Persist compaction as a separate response record in the store
- Hide compaction items from GET /v1/responses/{id}/input_items
- Handle explicit POST /v1/responses/compact endpoint

Closes praxis-proxy#30

Signed-off-by: Alexander Cristurean <acristur@redhat.com>
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