File size: 719 Bytes
d005419
062179e
d005419
 
 
062179e
 
d005419
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
from pathlib import Path

from repository.intel_npu import IntelNpuRepository
from repository.ollama import OllamaRepository
from repository.repository_abc import Model


def get_repository(implementation: str, model: Model, system_msg: str = None, log_to_file: Path = None):
    known_implementations = ["ollama", "intel_npu"]
    if not implementation or implementation.lower() not in ["ollama", "intel_npu"]:
        raise ValueError(f"Unknown implementation {implementation}. Known implementations: {known_implementations}")
    if "ollama" == implementation:
        return OllamaRepository(model, system_msg)
    if "intel_npu" == implementation:
        return IntelNpuRepository(model, system_msg, log_to_file)