Skip to content

Add models method to all providers in OPENAI directory #51

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 17, 2025

Conversation

OEvortex
Copy link
Owner

@OEvortex OEvortex commented May 17, 2025

User description

Add a models method to each provider in the webscout/Provider/OPENAI directory to return a list of available models.

  • ai4chat.py

    • Add a models method to return the list of available models for AI4Chat.
  • Cloudflare.py

    • Add a models method to return the list of available models for Cloudflare.
  • freeaichat.py

    • Add a models method to return the list of available models for FreeAIChat.
  • glider.py

    • Add a models method to return the list of available models for Glider.
  • groq.py

    • Add a models method to return the list of available models for Groq.
  • netwrck.py

    • Add a models method to return the list of available models for Netwrck.
  • scirachat.py

    • Add a models method to return the list of available models for SciraChat.
  • textpollinations.py

    • Add a models method to return the list of available models for TextPollinations.
  • typefully.py

    • Add a models method to return the list of available models for TypefullyAI.
  • typegpt.py

    • Add a models method to return the list of available models for TypeGPT.
  • base.py

    • Add an abstract models method to the OpenAICompatibleProvider class.

For more details, open the Copilot Workspace session.


PR Type

Enhancement


Description

  • Add models class method to all OpenAI provider classes

    • Returns list of available models for each provider
    • Ensures consistent interface across providers
  • Define abstract models method in OpenAI base provider

  • Add devcontainer configuration for build and test tasks


Changes walkthrough 📝

Relevant files
Enhancement
11 files
ai4chat.py
Add `models` class method to AI4Chat provider                       
+5/-0     
Cloudflare.py
Add `models` class method to Cloudflare provider                 
+6/-1     
freeaichat.py
Add `models` class method to FreeAIChat provider                 
+5/-0     
glider.py
Add `models` class method to Glider provider                         
+5/-0     
groq.py
Add `models` class method to Groq provider                             
+5/-0     
netwrck.py
Add `models` class method to Netwrck provider                       
+5/-0     
scirachat.py
Add `models` class method to SciraChat provider                   
+5/-0     
textpollinations.py
Add `models` class method to TextPollinations provider     
+4/-0     
typefully.py
Add `models` class method to TypefullyAI provider               
+4/-0     
typegpt.py
Add `models` class method to TypeGPT provider                       
+5/-0     
base.py
Add abstract `models` method to OpenAI base provider         
+5/-0     
Configuration changes
1 files
devcontainer.json
Add devcontainer config for build and test tasks                 
+6/-0     

Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Add a `models` method to each provider in the `webscout/Provider/OPENAI` directory to return a list of available models.
    
    * **ai4chat.py**
      - Add a `models` method to return the list of available models for AI4Chat.
    
    * **Cloudflare.py**
      - Add a `models` method to return the list of available models for Cloudflare.
    
    * **freeaichat.py**
      - Add a `models` method to return the list of available models for FreeAIChat.
    
    * **glider.py**
      - Add a `models` method to return the list of available models for Glider.
    
    * **groq.py**
      - Add a `models` method to return the list of available models for Groq.
    
    * **netwrck.py**
      - Add a `models` method to return the list of available models for Netwrck.
    
    * **scirachat.py**
      - Add a `models` method to return the list of available models for SciraChat.
    
    * **textpollinations.py**
      - Add a `models` method to return the list of available models for TextPollinations.
    
    * **typefully.py**
      - Add a `models` method to return the list of available models for TypefullyAI.
    
    * **typegpt.py**
      - Add a `models` method to return the list of available models for TypeGPT.
    
    * **base.py**
      - Add an abstract `models` method to the `OpenAICompatibleProvider` class.
    
    ---
    
    For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/OEvortex/Webscout?shareId=XXXX-XXXX-XXXX-XXXX).
    Copy link

    Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account here.

    CI Feedback 🧐

    A test triggered by this PR failed. Here is an AI-generated analysis of the failure:

    Action: add-labels

    Failed stage: Labeler [❌]

    Failure summary:

    The action failed because the GitHub labeler configuration file (.github/labeler.yml) contains an
    invalid format for the label 'docs'. According to the error message, the label 'docs' should be
    configured as an array of options, but it was defined with an unexpected type instead.

    Relevant error logs:
    1:  ##[group]Runner Image Provisioner
    2:  Hosted Compute Agent
    ...
    
    25:  Getting action download info
    26:  ##[group]Download immutable action package 'actions/[email protected]'
    27:  Version: 5.0.0
    28:  Digest: sha256:7b5b5e82426c591719aec44567030cf552bdf2c54fd91e4eac231f1986b929a6
    29:  Source commit SHA: 8558fd74291d67161a8a78ce36a881fa63b766a9
    30:  ##[endgroup]
    31:  Complete job name: add-labels
    32:  ##[group]Run actions/[email protected]
    33:  with:
    34:  repo-token: ***
    35:  configuration-path: .github/labeler.yml
    36:  sync-labels: false
    37:  dot: true
    38:  ##[endgroup]
    39:  The configuration file (path: .github/labeler.yml) was not found locally, fetching via the api
    40:  ##[error]Error: found unexpected type for label 'docs' (should be array of config options)
    41:  ##[error]found unexpected type for label 'docs' (should be array of config options)
    42:  Cleaning up orphan processes
    

    Copy link

    Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account here.

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Return Type Mismatch

    The models method returns list(cls.AVAILABLE_MODELS.keys()) while other providers return cls.AVAILABLE_MODELS directly. This inconsistency might cause issues if AVAILABLE_MODELS is structured differently across providers.

    """Return the list of available models for SciraChat."""
    return list(cls.AVAILABLE_MODELS.keys())
    Missing Import

    The abstract method models() specifies a return type of List[str], but the List type hint import is missing from the file.

    def models(cls) -> List[str]:
        """Return the list of available models for the provider."""
    Unused Method

    The new models() method doesn't use the existing get_models() method, which appears to provide dynamic model discovery. Consider leveraging this functionality instead of returning the static list.

    @classmethod
    def models(cls):
        """Return the list of available models for Groq."""
        return cls.AVAILABLE_MODELS

    Copy link

    Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account here.

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    Possible issue
    Ensure consistent return type

    The implementation of models() for SciraChat is inconsistent with other
    providers. It returns list(cls.AVAILABLE_MODELS.keys()) while other providers
    return cls.AVAILABLE_MODELS directly. This suggests that AVAILABLE_MODELS might
    have a different structure in SciraChat (dictionary vs list).

    webscout/Provider/OPENAI/scirachat.py [466-469]

     @classmethod
     def models(cls):
         """Return the list of available models for SciraChat."""
    -    return list(cls.AVAILABLE_MODELS.keys())
    +    return cls.AVAILABLE_MODELS
    • Apply / Chat
    Suggestion importance[1-10]: 7

    __

    Why: The suggestion correctly identifies an inconsistency in the return type of the models() method compared to other providers. However, it assumes that AVAILABLE_MODELS is always a list, which may not be true if SciraChat's models are stored as a dictionary. The suggestion is valid if consistency is desired and the structure allows it, but care must be taken not to break existing code.

    Medium
    • More

    @OEvortex OEvortex merged commit 6258503 into main May 17, 2025
    2 of 3 checks passed
    @OEvortex OEvortex deleted the add-models-method branch May 21, 2025 04:12
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant