| 6 | class ModelFactory: |
| 7 | @staticmethod |
| 8 | def create_model(model_name, *args): |
| 9 | try: |
| 10 | if model_name == 'gpt-4o' or model_name == 'gpt-4o-mini': |
| 11 | return GPT4o(model_name, *args) |
| 12 | elif model_name == 'gpt-4-vision-preview' or model_name == 'gpt-4-turbo': |
| 13 | return GPT4v(model_name, *args) |
| 14 | elif model_name.startswith("gemini"): |
| 15 | return Gemini(model_name, *args[1:]) |
| 16 | else: |
| 17 | # Llama/Llava models will work with the standard code I wrote for GPT4V without the assitant mode features of gpt4o |
| 18 | return GPT4v(model_name, *args) |
| 19 | except Exception as e: |
| 20 | raise ValueError(f'Unsupported model type {model_name}. Create entry in app/models/. Error: {e}') |