Skip to content

add option to pass 'api_key' to gen_answers, judge_answers#128

Merged
mergify[bot] merged 1 commit into
instructlab:mainfrom
sallyom:add-api-key
Sep 13, 2024
Merged

add option to pass 'api_key' to gen_answers, judge_answers#128
mergify[bot] merged 1 commit into
instructlab:mainfrom
sallyom:add-api-key

Conversation

@sallyom

@sallyom sallyom commented Sep 11, 2024

Copy link
Copy Markdown
Contributor

I notice the api_key is hard-coded which is preventing from using an external judge server. This adds an optional api_key to provide an openai_client in gen_answers and judge_answers. Note, candidate-server & judge-server may have unique tokens so the env var OPENAI_API_KEY should not be used.

@danmcp danmcp 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.

+1 to moving to judge and generate in mt_bench. Needs to be an option where ever server_url is passed.

@mergify mergify Bot added testing Relates to testing ci-failure labels Sep 12, 2024
@sallyom sallyom changed the title look for OPENAI_API_KEY before setting to NO_API_KEY add option to pass 'api_key' to gen_answers, judge_answers Sep 12, 2024
@mergify mergify Bot added ci-failure and removed ci-failure labels Sep 12, 2024
@nathan-weinberg

Copy link
Copy Markdown
Member

@sallyom thanks for the contribution! some CI failures here - you can run the checks locally with make verify - ping me if you have any issues there 😄

Comment thread src/instructlab/eval/mt_bench.py Outdated
Comment thread src/instructlab/eval/mt_bench.py Outdated
Comment thread src/instructlab/eval/mt_bench_answers.py Outdated
Comment thread src/instructlab/eval/mt_bench_judgment.py Outdated
Comment thread tests/test_branch_judge_answers.py Outdated
Comment thread src/instructlab/eval/mt_bench_common.py Outdated
Comment thread src/instructlab/eval/mt_bench.py Outdated

@danmcp danmcp 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.

Looks good except my question around whether the test changes are helpful and the commits need to be squashed and/or made more descriptive.

Comment thread tests/test_branch_gen_answers.py Outdated
`api_key` is optional and this PR remains backwards compatible.
This allows for externally served models that require authentication.
A helper function is added in mt_bench_common for creating the
openai_client necessary for model requests.

Signed-off-by: sallyom <somalley@redhat.com>
@sallyom

sallyom commented Sep 13, 2024

Copy link
Copy Markdown
Contributor Author

thanks for your review @danmcp, I really appreciate your help.

@danmcp

danmcp commented Sep 13, 2024

Copy link
Copy Markdown
Contributor

thanks for your review @danmcp, I really appreciate your help.

Thanks for the commit and working through the minutia!

@mergify mergify Bot added the one-approval label Sep 13, 2024

@nathan-weinberg nathan-weinberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Appreciate the contribution @sallyom!

@mergify mergify Bot removed the one-approval label Sep 13, 2024
@mergify
mergify Bot merged commit 83f9d95 into instructlab:main Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

testing Relates to testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants