Add research-paper-analyzer kit#163
Conversation
Adds kit metadata (lamatic.config.js), agent identity (agent.md), README with setup guide, safety constitution, and .gitignore. Uses plain JavaScript — no TypeScript — matching contributor's stack. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Defines the 4-node Lamatic flow (API Trigger → Extract From File → LLM Node → API Response) with full node/edge config and the structured prompt that produces title, authors, year, problem statement, methodology, findings, limitations, plain-English summary, and follow-up questions. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- orchestrate.js: maps flow ID from env to Lamatic workflow - lib/lamatic-client.js: initialises Lamatic SDK, validates env vars - actions/orchestrate.js: server action that calls executeFlow() and returns structured analysis or a typed error - package.json, jsconfig.json, next.config.mjs, tailwind + postcss configs: plain JS/JSX project setup (no TypeScript) - .env.example: documents required env vars Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
page.jsx (JSX, no TypeScript): - URL input form with loading state - Displays title, authors, year in a header bar - Plain English Summary always expanded (highlighted) - Problem statement, methodology, findings, limitations, follow-up questions all collapsible independently - Copy-to-JSON and New-paper reset buttons - Error state with icon layout.jsx + globals.css: Next.js App Router shell with Tailwind Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Next.js server actions, lamatic-client.js, next.config, tailwind/postcss configs, and App Router structure are all removed. The new backend will be FastAPI (Python) matching the contributor's stack, with a plain React + Vite frontend. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- main.py: POST /analyze accepts pdf_url, calls Lamatic flow via httpx, returns structured JSON; GET /health for readiness check - CORS configured for localhost:5173 (Vite) and localhost:3000 - Pydantic request model validates input - Typed error handling: 401, 404, 504 timeout, network errors - requirements.txt: fastapi, uvicorn, httpx, python-dotenv, pydantic - .env.example: documents all 4 required env vars Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- src/App.jsx: fetches POST /analyze from FastAPI backend; shows title/authors/year bar, Plain English Summary (always open), and collapsible sections for problem statement, methodology, key findings, limitations, follow-up questions - Copy-to-JSON and New-paper reset buttons - Error handling with icon display - vite.config.js: proxies /analyze and /health to localhost:8000 so no CORS issues in dev - VITE_BACKEND_URL env var for production deploys - Tailwind CSS for styling Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Adds architecture diagram: React → FastAPI → Lamatic → LLM - Separate startup instructions for backend (uvicorn) and frontend (vite) - Documents POST /analyze request/response schema - Updates tech stack section: FastAPI, Python, Vite (no Next.js) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Lamatic exposes a single GraphQL endpoint per project, not REST. Updated main.py to send the ExecuteWorkflow query with workflowId and payload variables. Also handles GraphQL-level errors from data.errors and checks execute_result.status == "success". Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Repository UI (base), Organization UI (inherited) Review profile: ASSERTIVE Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a new “Research Paper Analyzer” kit that extracts text from a PDF URL and returns a structured academic analysis via a Lamatic flow, with a bundled FastAPI backend and React/Vite frontend.
Changes:
- Introduces Lamatic flow + prompts/constitution for extracting and analyzing academic PDFs into structured JSON
- Adds a FastAPI service that calls Lamatic GraphQL to execute the flow
- Adds a React + Vite + Tailwind frontend UI to submit a PDF URL and render/copy results
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| kits/research-paper-analyzer/flows/research-paper-analyzer.js | Defines the Lamatic flow nodes, prompt wiring, and output schema for the analyzer |
| kits/research-paper-analyzer/prompts/analyze-paper.md | Adds the user prompt that requests a strict JSON breakdown of the paper |
| kits/research-paper-analyzer/constitutions/default.md | Adds safety/accuracy guardrails and an error behavior for non-paper input |
| kits/research-paper-analyzer/apps/backend/main.py | Implements a FastAPI proxy that executes the Lamatic workflow via GraphQL |
| kits/research-paper-analyzer/apps/frontend/src/App.jsx | Implements the UI + request handling and renders the structured analysis |
| kits/research-paper-analyzer/apps/frontend/package.json | Adds frontend dependencies/devDependencies for Vite/React/Tailwind |
| kits/research-paper-analyzer/README.md | Documents setup, architecture, and usage for the new kit |
| kits/research-paper-analyzer/agent.md | Documents agent identity, capabilities, and intended output schema |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| year: { type: ["number", "null"] }, | ||
| problem_statement: { type: "string" }, | ||
| methodology: { type: "string" }, | ||
| key_findings: { type: "array", items: { type: "string" } }, | ||
| limitations: { type: "array", items: { type: "string" } }, | ||
| plain_english_summary: { type: "string" }, | ||
| follow_up_questions: { type: "array", items: { type: "string" } }, | ||
| }, | ||
| required: [ | ||
| "title", "authors", "year", "problem_statement", "methodology", | ||
| "key_findings", "limitations", "plain_english_summary", "follow_up_questions", | ||
| ], |
| ## Accuracy | ||
| - Only draw conclusions directly supported by the paper's content | ||
| - Clearly flag when a section is missing, ambiguous, or truncated | ||
| - If the input is not an academic paper, return: `{"error": "Not an academic paper"}` |
| app.add_middleware( | ||
| CORSMiddleware, | ||
| allow_origins=["http://localhost:5173", "http://localhost:3000"], | ||
| allow_methods=["POST", "GET"], | ||
| allow_headers=["*"], | ||
| ) |
| const BACKEND_URL = import.meta.env.VITE_BACKEND_URL || ""; | ||
|
|
||
| async function callAnalyze(pdfUrl) { | ||
| const res = await fetch(`${BACKEND_URL}/analyze`, { |
| - **Extract From File** — file URL: `{{trigger.pdf_url}}` | ||
| - **LLM Node** — use prompt from `prompts/analyze-paper.md`, structured JSON output | ||
| - **API Response** — output: `{{LLMNode.output}}` |
| - Format all output as structured JSON matching the defined schema | ||
|
|
||
| ## Output Schema | ||
|
|
Adds a Pydantic field_validator on AnalyzeRequest.pdf_url that: - Rejects any non-HTTPS scheme (file://, http://, gopher://, etc.) - Rejects raw IP addresses in private/reserved ranges: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 127.0.0.0/8, 169.254.0.0/16 (cloud IMDS), 0.0.0.0/8, ::1/128, fc00::/7 Without this, an attacker could supply an internal URL and have Lamatic's servers fetch it, leaking cloud metadata or internal service responses back in the API response. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
kits/research-paper-analyzer— an AI kit that takes any academic PDF URL and returns a structured breakdownfollow-up questions