Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Jul 9, 2025

Add dynamic model selection to CI workflow

Summary

This PR modifies the CI workflow to dynamically select an available model from the server instead of using a hardcoded model name. The workflow now calls the /v1/models API endpoint to fetch available models and automatically selects the first one in the list.

Key Changes:

  • Added new "Get Available Model" step that queries the API endpoint
  • Replaced hardcoded MODEL_NAME: lfm-3b with dynamic model selection in both evaluation and judge steps
  • Added error handling for empty model lists and malformed API responses
  • Enhanced logging to show the selected model name in console output

Review & Testing Checklist for Human

  • Test API endpoint response format - Verify the actual API returns the expected JSON structure with {"data":[{"id":"model-name",...}]} format
  • Test error handling scenarios - Try with empty data arrays, malformed JSON, and network failures to ensure graceful failure
  • Verify end-to-end workflow - Run the complete CI pipeline to ensure model selection works correctly with both evaluation and judge steps
  • Confirm judge model behavior - Check if the judge model name ("lfm-7b") should also be dynamic or remain hardcoded
  • Test with different API responses - Verify behavior with various models in the data array and confirm first model selection works as expected

Recommended Test Plan:

  1. Trigger the workflow manually and verify the "Get Available Model" step logs show the API response and selected model
  2. Test with a server that returns an empty models list to confirm error handling
  3. Run a complete evaluation cycle to ensure the selected model works in both generation and judgment phases

Diagram

%%{ init : { "theme" : "default" }}%%
graph TD
    subgraph "CI Workflow"
        A["Install dependencies"]
        B["Get Available Model<br/>(NEW STEP)"]:::major-edit
        C["Run API Evaluation Script"]:::minor-edit
        D["Run OpenAI Judge"]:::minor-edit
    end
    
    subgraph "External"
        E["MODEL_URL/v1/models<br/>API Endpoint"]:::context
    end
    
    A --> B
    B --> C
    C --> D
    B -.->|"curl + jq parsing"| E
    B -.->|"model_name output"| C
    B -.->|"model_name output"| D
    
    subgraph Legend
        L1[Major Edit]:::major-edit
        L2[Minor Edit]:::minor-edit  
        L3[Context/No Edit]:::context
    end

    classDef major-edit fill:#90EE90
    classDef minor-edit fill:#87CEEB
    classDef context fill:#FFFFFF
Loading

Notes

Link to Devin run: https://app.devin.ai/sessions/92e0a8e247284979b4f8a658feef4c85

Requested by: @tuliren

Important: The judge model name remains hardcoded as "lfm-7b" - please confirm if this should also be dynamic or if it's intentionally static.

Testing limitation: This change couldn't be tested locally due to requiring live API credentials and endpoint access. The JSON parsing logic and error handling should be validated against the actual API response format.

- Add new step to fetch available models from API endpoint
- Parse JSON response to extract first model ID from data array
- Add error handling for empty data arrays
- Replace hardcoded MODEL_NAME with dynamically selected model
- Output chosen model name to console for visibility

Co-Authored-By: Liren <tuliren@gmail.com>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@tuliren tuliren closed this Jul 9, 2025
@tuliren tuliren deleted the devin/1720562661-dynamic-model-selection branch July 9, 2025 21:25
Co-Authored-By: Liren <tuliren@gmail.com>
@tuliren tuliren reopened this Jul 9, 2025
@tuliren tuliren merged commit 28ead52 into main Jul 9, 2025
1 check passed
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