-
Notifications
You must be signed in to change notification settings - Fork 33
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
refactor: signature does not match between interface and implementations #17
Comments
the problem is that different LLMs can and will have different arguments when generating. E.g. a regular LLM will just need a prompt(str) while a ChatLLM will require a conversation history. And these might differ even more when we start adding LLMs from APIs other than OpenAI |
Then you might want to take a look at the strategy pattern: you do not change the function signature of an interface in its implementation - it takes the whole concept of having an interface away. |
Note: Check strategy pattern & protocol class |
llmflows/llmflows/llms/llm.py
Line 24 in 6ce79a8
One of the main points of having an interface is that all implementations for an abstract method will match the function signature of the abstract method. This way, you will be able to be generic in high-level functions (read: dependency inversion) and at the same make sure that you can swap all subclasses of
BaseLLM
without breaking the code (read: Liskov Substitution Principle).The text was updated successfully, but these errors were encountered: