Skip to content
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

generator: promote OpenAICompatible as first class generator #1021

Merged
merged 3 commits into from
Dec 6, 2024

Conversation

jmartin-tech
Copy link
Collaborator

@jmartin-tech jmartin-tech commented Nov 22, 2024

fix #1008

Various generators extend this base template, usage and feedback suggest UX and usability improvements will be gained by promoting this class to be a Configurable generic OpenAI client based generator.

Verification

List the steps needed to make sure this thing works

  • Test against via mimic of nim configuration via generator config options:
    compatible.json:
{
    "openai": {
        "OpenAICompatible": {
            "uri": "https://integrate.api.nvidia.com/v1/",
            "suppressed_params": ["n", "frequency_penalty", "presence_penalty"]
        }
    }
}
python -m garak -m openai.OpenAICompatible -n meta/llama3-8b-instruct -p lmrc --generator_option_file compatible.json
  • Verify at least one additional modified generator groq / openai.OpenAIGenerator / nim with --parallel_attempts enabled.

@jmartin-tech jmartin-tech changed the title Prompt OpenAICompatible as first class generator Promote OpenAICompatible as first class generator Nov 22, 2024
Various generators extend this base template, usage and feedback
suggest UX and usability improvements will be gained by promoting
this class to be a `Configurable` generic OpenAI client based generator.

* default `uri`
* default implmentations of `_load_client()` and `_clear_client()`
* remove duplicate versions of `_clear_client()`

Signed-off-by: Jeffrey Martin <[email protected]>
@jmartin-tech jmartin-tech force-pushed the feature/promote-OpenAICompatible branch from f470652 to 5c56469 Compare November 22, 2024 20:45
Signed-off-by: Jeffrey Martin <[email protected]>
Copy link
Collaborator

@leondz leondz left a comment

Choose a reason for hiding this comment

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

let's update class naming. maybe i didn't get the uri param locking bit, either

garak/generators/openai.py Show resolved Hide resolved
garak/generators/openai.py Show resolved Hide resolved
tests/generators/test_generators.py Show resolved Hide resolved
@jmartin-tech jmartin-tech changed the title Promote OpenAICompatible as first class generator generator: promote OpenAICompatible as first class generator Nov 26, 2024
@jmartin-tech jmartin-tech requested a review from leondz December 3, 2024 20:00
@jmartin-tech
Copy link
Collaborator Author

@leondz since we are going to defer the rename, can this get an approval to land?

Copy link
Collaborator

@leondz leondz left a comment

Choose a reason for hiding this comment

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

nice

@leondz leondz merged commit 7499da1 into NVIDIA:main Dec 6, 2024
9 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Dec 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Support any OpenAI compatible endpoints by adding two flags
3 participants