This PR changes the nature of the crate to not only support OpenAI APIs but also models exposed by other LLM providers. It introduces a standard way of adding new models and a new abstraction called Completions that can be used with any model from any provider.
Key highlights:
[ ] llm_models::LLMModel trait is the centerpiece of changes. It specifies what functions need to be implemented for an enum containing LLM Models from a provider for that enum to work with the Completions struct.
[ ] llm_models::OpenAIModels is a re-implementation of the previously existing models::OpenAIModels but through implementation of the new trait.
[ ] llm_models::AnthropicModels and llm_models::MistralModels are new model enums for Anthropic and Mistral respectively.
[ ] Completions is a new module that is mostly a direct copy of the previously existing openai module, just modified to accept any enum that implements the new trait as model attribute.
[ ] use_completions is a new file to test how different models work.
[ ] openai module and models::OpenAIModels were purposefully unchanged to ensure backwards compatibility. We should probably add some depreciation warnings and remove them over time.
This PR changes the nature of the crate to not only support OpenAI APIs but also models exposed by other LLM providers. It introduces a standard way of adding new models and a new abstraction called Completions that can be used with any model from any provider.
Key highlights:
llm_models::LLMModel
trait is the centerpiece of changes. It specifies what functions need to be implemented for an enum containing LLM Models from a provider for that enum to work with theCompletions
struct.llm_models::OpenAIModels
is a re-implementation of the previously existingmodels::OpenAIModels
but through implementation of the new trait.llm_models::AnthropicModels
andllm_models::MistralModels
are new model enums for Anthropic and Mistral respectively.Completions
is a new module that is mostly a direct copy of the previously existingopenai
module, just modified to accept any enum that implements the new trait as model attribute.use_completions
is a new file to test how different models work.openai
module andmodels::OpenAIModels
were purposefully unchanged to ensure backwards compatibility. We should probably add some depreciation warnings and remove them over time.