Skip to content

docs: Add 2026 Modernization Upgrade Report - #33

Open
dhar174 wants to merge 2 commits into
mainfrom
upgrade-report-2026-3832584157719285792
Open

dhar174 wants to merge 2 commits into
mainfrom
upgrade-report-2026-3832584157719285792

Conversation

@dhar174

@dhar174 dhar174 commented Sep 17, 2026

Copy link
Copy Markdown
Owner

This commit adds the comprehensive report outlining paths to modernize the repository to 2026 best practices. It covers transitioning to LangGraph for orchestration, Pydantic v2 and OpenAI Structured Outputs to eliminate regex, DSPy for prompt management, and local SLMs/llama.cpp for complexity measurements, along with effort estimates.


PR created automatically by Jules for task 3832584157719285792 started by @dhar174

Co-authored-by: dhar174 <5241499+dhar174@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Co-authored-by: dhar174 <5241499+dhar174@users.noreply.github.com>
@dhar174
dhar174 marked this pull request as ready for review September 18, 2026 06:26
Copilot AI lite review requested due to automatic review settings September 18, 2026 06:26
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-18T06:29:37.056348Z ff3c050 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ff3c050938

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread UPGRADE_REPORT_2026.md
### 2. Structured Outputs and Validation
* **Current State:** The codebase relies excessively on Regex patterns and manual string replacements to extract actions, steps, and outputs. For example, `complexity_measures.py` uses `escape_regex` and string manipulations, while `conversation_manager.py` attempts to validate messages via `re.compile(r"\b(" + "|".join(question_words) + r")\b", re.IGNORECASE)` (line 87+).
* **2026 Best Practice:** Leverage **OpenAI's Structured Outputs** natively combined with **Pydantic v2**. Pydantic v2 brings substantial performance improvements (Rust core) and superior typing capabilities.
* **Recommendation:** Rip out the regex-based validation. Migrate existing `BaseModel` classes (e.g., `StepComponentType`, `FinalStepOutput`) to Pydantic v2. Use the OpenAI SDK's `response_format` parameter with strict Pydantic models to guarantee JSON structures, eliminating the need for string parsing entirely.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Correct the already-completed structured-output roadmap

This recommendation presents Pydantic v2 and OpenAI Structured Outputs as unimplemented work, but the reviewed baseline already imports and uses v2-only APIs such as field_validator, model_validate, and model_json_schema, while advanced_prompting.py, conversation_manager.py, and complexity_measures.py contain numerous beta.chat.completions.parse(..., response_format=<BaseModel>) calls. As written, the report classifies existing functionality as a high-impact medium-sized migration and could cause maintainers to plan duplicate work; it should instead identify only the remaining unstructured call sites and parsing paths.

Useful? React with 👍 / 👎.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Correct inaccurate code references and clarify the proposed migration scope and scoring contract.

Get a fresh assessment by requesting another Copilot review.

Pull request overview

Adds a 2026 modernization roadmap covering orchestration, structured outputs, prompt management, and local complexity analysis.

Changes:

  • Recommends LangGraph, Pydantic/OpenAI Structured Outputs, DSPy, and local SLMs.
  • Provides prioritization and effort estimates.
File summaries
File Description
UPGRADE_REPORT_2026.md Documents modernization recommendations and estimates.
Review details

Suppressed comments (4)

UPGRADE_REPORT_2026.md:16

  • This presents Pydantic v2 and OpenAI Structured Outputs as a future migration, but the repository already uses Pydantic v2 APIs such as field_validator, model_validate, and model_json_schema, and already calls client.beta.chat.completions.parse(..., response_format=...) in several paths. Please frame this as standardizing and expanding the existing structured-output usage; otherwise the report misstates the current state and effort.
*   **2026 Best Practice:** Leverage **OpenAI's Structured Outputs** natively combined with **Pydantic v2**. Pydantic v2 brings substantial performance improvements (Rust core) and superior typing capabilities.
    *   **Recommendation:** Rip out the regex-based validation. Migrate existing `BaseModel` classes (e.g., `StepComponentType`, `FinalStepOutput`) to Pydantic v2. Use the OpenAI SDK's `response_format` parameter with strict Pydantic models to guarantee JSON structures, eliminating the need for string parsing entirely.

UPGRADE_REPORT_2026.md:32

  • The estimate claims this work eliminates brittle regex in both modules, but Structured Outputs only replaces parsing of model responses. complexity_measures.py also uses regex to parse free-form plans, detect keywords, and compare text; removing those expressions wholesale would remove unrelated behavior. Scope the estimate to response parsing or identify separate replacements for each semantic heuristic.
| **Pydantic v2 & OpenAI Structured Outputs** | High | **Medium** | Eliminates brittle regex in `conversation_manager.py` & `complexity_measures.py`. High ROI for system stability. |

UPGRADE_REPORT_2026.md:35

  • The claimed line-count reduction does not follow from the proposed change: is_complex_final currently invokes many other metrics besides is_complex_nlp_dependency and is_complex_sentiment (including SRL, ML, graph, recursive, AST, entropy, and others). Replacing only the two named functions will leave most of the 4,000+ lines and dependencies active; either enumerate the full removal scope or reduce the estimate.
| **llama.cpp / Local SLM for Complexity Metrics** | Medium | **Medium** | Simplifies `complexity_measures.py` from 4,000+ lines of disparate NLP toolings to unified model calls. |

UPGRADE_REPORT_2026.md:9

  • The cited run_conversation path is not currently using only raw chat.completions.create calls: its structured decision paths use client.beta.chat.completions.parse with Pydantic response models (for example around conversation_manager.py:2268 and later mediator paths). The raw call around line 2113 is outside this function, so please distinguish the legacy helpers from the orchestration loop before using this as the modernization baseline.
*   **Current State:** The orchestration logic in `advanced_prompting.py` and `conversation_manager.py` (e.g., `run_conversation` starting around line 2138) is deeply entangled. Agent interactions, voting, and consensus mechanisms are hardcoded using standard `while` loops, basic conditionals, and raw API calls (`openai.chat.completions.create`). This makes it difficult to pause execution, debug state, or branch logic cleanly.
  • Files reviewed: 1/1 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread UPGRADE_REPORT_2026.md
* **Recommendation:** Refactor the rigid `run_conversation` and multi-agent interaction loops into a formal LangGraph state machine. Each agent becomes a node in the graph, passing a shared `State` object. This allows seamless state tracking, easier debugging of agent trajectories, and robust error recovery without monolithic loop constructs.

### 2. Structured Outputs and Validation
* **Current State:** The codebase relies excessively on Regex patterns and manual string replacements to extract actions, steps, and outputs. For example, `complexity_measures.py` uses `escape_regex` and string manipulations, while `conversation_manager.py` attempts to validate messages via `re.compile(r"\b(" + "|".join(question_words) + r")\b", re.IGNORECASE)` (line 87+).
Comment thread UPGRADE_REPORT_2026.md
### 4. Local Execution and Modern NLP Tooling
* **Current State:** `complexity_measures.py` uses legacy `transformers` pipelines, spaCy, NLTK, and TextBlob for NLP and complexity analysis (e.g., `is_complex_nlp_dependency` at line 487). These are traditional, disjointed 2010s-era ML approaches.
* **2026 Best Practice:** Integrate **llama.cpp** or lightweight local LLMs via `Ollama`/`vLLM` for fast, private, and cheap local inference. Complexity analysis (like sentiment, cognitive load, etc.) is better handled holistically by specialized local SLMs (Small Language Models).
* **Recommendation:** Deprecate the monolithic statistical implementations in `complexity_measures.py`. Replace functions like `is_complex_nlp_dependency` and `is_complex_sentiment` with a single, cohesive local LLM call using `llama.cpp` Python bindings, asking the local model to grade the complexity out of 10. This will remove thousands of lines of legacy dependencies.
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