Support other model providers besides OpenAI (Anthropic, Gemini, ...)
Description
This one is pretty self-explanatory. Currently, HypotheSAEs only supports the OpenAI API. We'd like to add support for other model providers.
Proposed Solution
- Modify [llm_api.py]:
- Instead of only looking for
OPENAI_KEY_SAE, look for OPENAI_KEY_SAE or ANTHROPIC_KEY_SAE, etc.
- Change
get_client() so that it can produce a client for another provider
- Create a dictionary mapping from models to providers
get_completion() should check what provider is being used and generate a completion accordingly.
- Assert that the model being requested for a completion has a valid API key (that is, user cannot request
gpt-4o if the only API key provided is for Anthropic)
- Wherever we check that
OPENAI_KEY_SAE is set, instead make sure that any one of the API keys is set.
- Wherever we use default models, set the defaults based on what API key is actually present in the environment variable.
Testing
- [test_workflow.py] Show that the unit tests pass using a different model provider besides OpenAI.
Nice-to-have
- Add a screenshot of your results on the [quickstart.ipynb] notebook to the PR, using a pair of interpreter/annotator models from whatever additional API(s) you added.
Notes
I am happy to advise on this. If you have an implementation in progress on a fork, feel free to reply asking for a review or any questions.
Support other model providers besides OpenAI (Anthropic, Gemini, ...)
Description
This one is pretty self-explanatory. Currently, HypotheSAEs only supports the OpenAI API. We'd like to add support for other model providers.
Proposed Solution
OPENAI_KEY_SAE, look forOPENAI_KEY_SAEorANTHROPIC_KEY_SAE, etc.get_client()so that it can produce a client for another providerget_completion()should check what provider is being used and generate a completion accordingly.gpt-4oif the only API key provided is for Anthropic)OPENAI_KEY_SAEis set, instead make sure that any one of the API keys is set.Testing
Nice-to-have
Notes
I am happy to advise on this. If you have an implementation in progress on a fork, feel free to reply asking for a review or any questions.