feat: Add interactive demo CLI for PTC with ReqLLM integration#75
feat: Add interactive demo CLI for PTC with ReqLLM integration#75andreasronge merged 3 commits intomainfrom
Conversation
Add a demo application showcasing PtcRunner's key value proposition: enabling LLMs to query large datasets efficiently by keeping data in BEAM memory while only passing small results through LLM context. Features: - Interactive CLI chat interface for querying sample datasets - Two generation modes: structured (reliable) and text (with retry) - Sample data: 500 products, 1000 orders, 200 employees, 800 expenses - Automated test runner with constraint-based assertions - Schema metadata simulating MCP tool discovery The demo demonstrates how PtcRunner reduces token costs by 10-100x compared to traditional function calling that passes raw data through LLM context. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
PR Review: feat: Add interactive demo CLI for PTC with ReqLLM integrationSummaryThis PR adds a standalone demo application ( What's Good
Issues (Must Fix)
Suggestions (Optional)
SecurityNo concerns. The demo:
VerdictRequest Changes - The data regeneration issue in the test runner (Issue #2) could lead to confusing test results. Issue #1 is lower risk but worth fixing for robustness. Once these are addressed, this is ready to merge. The demo effectively showcases PtcRunner's core value proposition and will be useful for users evaluating the library. |
|
@claude please fix these issues from PR review: Issue 1: Add nil check for empty message list in structured modeLocation: user_question =
context.messages
|> Enum.filter(fn msg -> msg.role == :user end)
|> List.last()
|> case do
nil -> ""
msg -> msg |> Map.get(:content, "") |> extract_text_content()
endPlease fix this issue in a single commit with minimal changes. |
Auto-Triage SummaryDecisions Made
RationaleIssue 1 (FIX_NOW): Although unlikely in practice (user question is always added to context before generate_program), defensive nil checking is important for a demo showcasing the library. The fix is mechanical (simple case statement). Issue 2 (DEFER_ISSUE): This is a real architectural issue - test validation uses freshly generated random data instead of the data the program was executed against. However, fixing it requires moderate changes (adding last_result to state, updating API). Given that constraint-based assertions provide some resilience, this is better addressed in a follow-up issue. Issues 3-5 (IGNORE): These are optional enhancements marked as "nice-to-have" in the review. They don't affect correctness and can be considered for future iterations if needed. Status
|
Fix SummaryIssue Fixed: Added nil check for empty message list in structured mode Location: demo/lib/ptc_demo/agent.ex:214-221 Changes:
Verification:
|
PR Review: feat: Add interactive demo CLI for PTC with ReqLLM integrationSummaryThis PR adds a well-structured interactive demo application demonstrating PtcRunner's value proposition with LLM integration. The demo shows how PTC keeps large datasets in BEAM memory while only passing compact programs to LLMs. The implementation is solid overall, with good separation of concerns. What's Good
Issues (Must Fix)
Suggestions (Optional)
SecurityNo concerns. The demo:
VerdictRequest Changes - The missing explicit Dotenvy dependency should be added before merge. This is a one-line fix. |
|
@claude please fix this issue from PR review: Issue 1: Add explicit Dotenvy dependency to demo/mix.exsLocation: defp deps do
[
{:ptc_runner, path: ".."},
{:req_llm, "~> 1.0.0-rc"},
{:dotenvy, "~> 1.1"}
]
endPlease fix this issue in a single commit with minimal changes. |
Auto-Triage Summary (Cycle 2)Decisions Made
RationaleIssue 1 (FIX_NOW): The demo CLI directly calls
Status
NotesAll other items from the review were already addressed in the first triage cycle or marked as optional suggestions. |
The demo CLI uses Dotenvy.source!/1 at demo/lib/ptc_demo/cli.ex:13-14, but dotenvy was not listed as an explicit dependency. While it works as a transitive dependency of req_llm, Elixir best practice requires explicitly declaring dependencies that are directly referenced in code.
SummaryIssue Fixed: Added explicit Dotenvy dependency to demo/mix.exs Changes Made:
Verification:
Rationale: While dotenvy was available as a transitive dependency of req_llm, Elixir best practice requires explicitly declaring all dependencies that are directly referenced in code. This ensures the application won't break if req_llm changes its dependencies in the future. |
PR Review: feat: Add interactive demo CLI for PTC with ReqLLM integrationSummaryThis PR adds a standalone demo application under What's Good
Issues (Must Fix)None identified. The PR is well-implemented for its purpose as a demo application. Suggestions (Optional)
SecurityNo concerns. The demo uses environment variables for API keys (standard practice), doesn't expose sensitive data, and runs PTC programs in PtcRunner's existing sandbox. VerdictApprove - This is a well-crafted demo that clearly illustrates PtcRunner's value proposition. The code is clean, compiles without warnings, and the one known issue (test data consistency) is already tracked in GitHub issue #76. |
Auto-Triage Summary (Cycle 3 - Final)Review Verdict✅ APPROVED - All must-fix issues have been resolved across 3 review cycles. Complete Triage HistoryCycle 1
Cycle 2
Cycle 3
Final Status
Ready for MergePR is now approved with all critical issues resolved. Auto-merge will handle merging once all CI checks complete. |
Summary
Features
structured(default) - Usesgenerate_object!for guaranteed valid JSONtext- Usesgenerate_text!with retry logic for debuggingUsage
Test plan
🤖 Generated with Claude Code