Skip to content

Add model_args for judge LLM#1241

Open
haihongtran wants to merge 2 commits intomodelscope:mainfrom
haihongtran:feat/judge-model-args
Open

Add model_args for judge LLM#1241
haihongtran wants to merge 2 commits intomodelscope:mainfrom
haihongtran:feat/judge-model-args

Conversation

@haihongtran
Copy link

Problem

Evaluation target comes with the model_args argument, which is very helpful for users to add customized headers to the OpenAI client, for example:

model_args = {
    "default_headers": {
        "X-API-KEY": "your-api-key",
    }
}

openai_client = OpenAI(
    api_key="EMPTY",
    base_url="https://api.organization.com/v1",
    **model_args
)

However, the above model_args is not currently available for the judge LLM.

Solution

Adding model_args to the LLMJudge class in the evalscope/metrics/llm_judge.py and making sure it is used in the get_model function.

I verified that the modification worked well in my environment.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces the capability to pass custom model_args to the judge LLM within the LLMJudge class. This enhancement provides greater flexibility for users to configure their LLM clients, such as adding specific API headers, aligning the judge LLM's configuration options with those already available for evaluation targets.

Highlights

  • LLMJudge Initialization: Added a new model_args parameter to the LLMJudge constructor, allowing users to pass custom arguments for configuring the underlying LLM client.
  • Documentation Update: Updated the docstring for the LLMJudge constructor to clearly describe the purpose and usage of the new model_args parameter.
  • Configuration Storage: Stored the provided model_args as an instance variable self.model_args within the LLMJudge class, defaulting to an empty dictionary if not specified.
  • LLM Client Integration: Integrated self.model_args into the _init_server_adapter method, ensuring these custom arguments are passed to the ServerAdapter when initializing the LLM client.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request adds the model_args parameter to the LLMJudge class, allowing for more flexible configuration of the judge model, similar to how it's done for evaluation targets. The change is well-contained and correctly passes the arguments down to the model initialization. However, there is a critical issue with the type hint for model_args which will cause a runtime error. I've left a comment with a suggestion to fix it.

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