forked from phoenix/litellm-mirror
(test) ollama test
This commit is contained in:
parent
26c6c1a03e
commit
67518387f1
1 changed files with 14 additions and 7 deletions
|
@ -16,15 +16,22 @@ import litellm
|
|||
from litellm.utils import get_optional_params, get_llm_provider
|
||||
|
||||
def test_get_ollama_params():
|
||||
converted_params = get_optional_params(custom_llm_provider="ollama", model="llama2", max_tokens=20, temperature=0.5, stream=True)
|
||||
print("Converted params", converted_params)
|
||||
assert converted_params == {'num_predict': 20, 'stream': True, 'temperature': 0.5}, f"{converted_params} != {'num_predict': 20, 'stream': True, 'temperature': 0.5}"
|
||||
try:
|
||||
converted_params = get_optional_params(custom_llm_provider="ollama", model="llama2", max_tokens=20, temperature=0.5, stream=True)
|
||||
print("Converted params", converted_params)
|
||||
assert converted_params == {'num_predict': 20, 'stream': True, 'temperature': 0.5}, f"{converted_params} != {'num_predict': 20, 'stream': True, 'temperature': 0.5}"
|
||||
except Exception as e:
|
||||
pytest.fail(f"Error occurred: {e}")
|
||||
# test_get_ollama_params()
|
||||
|
||||
|
||||
def test_get_ollama_model():
|
||||
model, custom_llm_provider, _, _ = get_llm_provider("ollama/code-llama-22")
|
||||
print("Model", "custom_llm_provider", model, custom_llm_provider)
|
||||
assert custom_llm_provider == "ollama", f"{custom_llm_provider} != ollama"
|
||||
assert model == "code-llama-22", f"{model} != code-llama-22"
|
||||
try:
|
||||
model, custom_llm_provider, _, _ = get_llm_provider("ollama/code-llama-22")
|
||||
print("Model", "custom_llm_provider", model, custom_llm_provider)
|
||||
assert custom_llm_provider == "ollama", f"{custom_llm_provider} != ollama"
|
||||
assert model == "code-llama-22", f"{model} != code-llama-22"
|
||||
except Exception as e:
|
||||
pytest.fail(f"Error occurred: {e}")
|
||||
|
||||
# test_get_ollama_model()
|
Loading…
Add table
Add a link
Reference in a new issue