Skip to content
Snippets Groups Projects
Unverified Commit 62c96196 authored by James Briggs's avatar James Briggs
Browse files

fix for tests

parent 4909b470
No related branches found
No related tags found
No related merge requests found
......@@ -10,9 +10,9 @@ from semantic_router.utils.logger import logger
class LlamaCppLLM(BaseLLM):
llm: Optional[Llama] = None
temperature: Optional[float] = None
max_tokens: Optional[int] = None
llm: Llama
temperature: float
max_tokens: int
grammar: Optional[LlamaGrammar] = None
def __init__(
......@@ -24,7 +24,7 @@ class LlamaCppLLM(BaseLLM):
):
if not llm:
raise ValueError("`llama_cpp.Llama` llm is required")
super().__init__(name=name)
super().__init__(name=name, llm=llm, temperature=temperature, max_tokens=max_tokens)
self.llm = llm
self.temperature = temperature
self.max_tokens = max_tokens
......
......@@ -3,10 +3,13 @@ import pytest
from semantic_router.llms import LlamaCppLLM
from semantic_router.schema import Message
from llama_cpp import Llama
@pytest.fixture
def llamacpp_llm(mocker):
llm = mocker.Mock()
mock_llama = mocker.patch("llama_cpp.Llama", spec=Llama)
llm = mock_llama.return_value
return LlamaCppLLM(llm=llm)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment