Skip to content

Interactive#21

Merged
dbreunig merged 1 commit into
mainfrom
interactive
Nov 13, 2025
Merged

Interactive#21
dbreunig merged 1 commit into
mainfrom
interactive

Conversation

@dbreunig
Copy link
Copy Markdown
Contributor

Added interactive new behavior, walking users through project and program creation.

@dbreunig dbreunig merged commit 443e8d5 into main Nov 13, 2025
1 of 2 checks passed
@dbreunig dbreunig deleted the interactive branch November 13, 2025 22:23
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Nov 13, 2025

Greptile Overview

Greptile Summary

This PR adds interactive mode to the dspy-cli new command, guiding users through project setup with prompts for project name, program details, module type, signature, and model configuration. Key changes include:

  • New utilities: Added interactive.py with prompt functions and model_utils.py for provider detection and configuration
  • Enhanced new command: Made project_name argument optional to enable interactive mode, added options for --module-type and --model
  • Refactoring: Extracted MODULE_TYPES constant to shared constants.py for reuse between new and generate commands
  • Dynamic templates: Updated config templates to accept user-selected models and API keys during project creation
  • Documentation: Updated docs to recommend interactive mode with clear examples

The implementation is comprehensive and well-structured, but contains a critical bug where the default model is set to the non-existent gpt-5-mini instead of gpt-4o-mini.

Confidence Score: 4/5

  • Safe to merge after fixing the invalid model name
  • The PR implements a well-designed interactive workflow with proper error handling and validation. However, the default model name gpt-5-mini is invalid and will cause runtime errors when users accept the default. This needs to be fixed to gpt-4o-mini before merging.
  • Fix src/dspy_cli/commands/new.py:149 and src/dspy_cli/utils/interactive.py:218 - both use invalid model name gpt-5-mini

Important Files Changed

File Analysis

Filename Score Overview
src/dspy_cli/utils/interactive.py 4/5 New utility module for interactive prompts; well-structured with comprehensive input validation, but has invalid default model name gpt-5-mini
src/dspy_cli/utils/model_utils.py 5/5 New utility module for model provider handling; clean implementation with proper provider detection and configuration generation
src/dspy_cli/commands/new.py 4/5 Enhanced with interactive mode; comprehensive implementation, but has invalid default model gpt-5-mini and unused import prompt_api_base

Sequence Diagram

sequenceDiagram
    participant User
    participant CLI as dspy-cli new
    participant Interactive as interactive.py
    participant ModelUtils as model_utils.py
    participant FileSystem as File System

    User->>CLI: dspy-cli new
    CLI->>Interactive: prompt_project_name()
    Interactive->>User: "What is your project name?"
    User->>Interactive: "my-project"
    
    CLI->>Interactive: prompt_setup_first_program()
    Interactive->>User: "Customize first program?"
    User->>Interactive: Yes
    
    CLI->>Interactive: prompt_program_name()
    Interactive->>User: "Program name?"
    User->>Interactive: "my_program"
    
    CLI->>Interactive: prompt_module_type()
    Interactive->>User: "Choose module type (1-6)"
    User->>Interactive: "1" (Predict)
    
    CLI->>Interactive: prompt_signature()
    Interactive->>User: "Enter signature or '?'"
    User->>Interactive: "question -> answer"
    Interactive->>Interactive: parse_signature_string()
    
    CLI->>Interactive: prompt_model()
    Interactive->>User: "Enter model"
    User->>Interactive: "openai/gpt-4o-mini"
    
    CLI->>ModelUtils: parse_model_string()
    ModelUtils-->>CLI: {provider, model, full}
    
    CLI->>ModelUtils: detect_api_key(provider)
    ModelUtils-->>CLI: (api_key, env_var_name)
    
    CLI->>Interactive: prompt_api_key()
    Interactive->>User: "Enter API key or skip"
    User->>Interactive: "sk-..."
    
    CLI->>ModelUtils: generate_model_config()
    ModelUtils-->>CLI: model_config_dict
    
    CLI->>FileSystem: Create directory structure
    CLI->>FileSystem: Write config files (dspy.config.yaml, .env)
    CLI->>FileSystem: Write Python code (modules, signatures)
    CLI->>FileSystem: Initialize git repo
    
    CLI->>User: "✓ Project created successfully!"
Loading

Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

9 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile


# Prompt for model
if model is None:
model = prompt_model(default="openai/gpt-5-mini")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

syntax: gpt-5-mini doesn't exist, should be gpt-4o-mini

Suggested change
model = prompt_model(default="openai/gpt-5-mini")
model = prompt_model(default="openai/gpt-4o-mini")
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/dspy_cli/commands/new.py
Line: 149:149

Comment:
**syntax:** `gpt-5-mini` doesn't exist, should be `gpt-4o-mini`

```suggestion
        model = prompt_model(default="openai/gpt-4o-mini")
```

How can I resolve this? If you propose a fix, please make it concise.

Model string (e.g., "anthropic/claude-sonnet-4-5")
"""
if not default:
default = "openai/gpt-5-mini"
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

syntax: gpt-5-mini doesn't exist, should be gpt-4o-mini

Suggested change
default = "openai/gpt-5-mini"
default = "openai/gpt-4o-mini"
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/dspy_cli/utils/interactive.py
Line: 218:218

Comment:
**syntax:** `gpt-5-mini` doesn't exist, should be `gpt-4o-mini`

```suggestion
        default = "openai/gpt-4o-mini"
```

How can I resolve this? If you propose a fix, please make it concise.

prompt_signature,
prompt_model,
prompt_api_key,
prompt_api_base,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

style: prompt_api_base is imported but never used in this file

Prompt To Fix With AI
This is a comment left during a code review.
Path: src/dspy_cli/commands/new.py
Line: 17:17

Comment:
**style:** `prompt_api_base` is imported but never used in this file

How can I resolve this? If you propose a fix, please make it concise.

@greptile-apps greptile-apps Bot mentioned this pull request Nov 14, 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.

1 participant