diff --git a/semantic_router/encoders/mistral.py b/semantic_router/encoders/mistral.py
index 5beabb71d3a966625abc15946b1bd9877c19bf63..0ab5682408c1d8da5eeb34964f8a0990fea051c9 100644
--- a/semantic_router/encoders/mistral.py
+++ b/semantic_router/encoders/mistral.py
@@ -4,13 +4,11 @@ from time import sleep
 from typing import List, Optional, Any
 
 
-
 from semantic_router.encoders import BaseEncoder
 from semantic_router.utils.defaults import EncoderDefault
 from pydantic.v1 import PrivateAttr
 
 
-
 class MistralEncoder(BaseEncoder):
     """Class to encode text using MistralAI"""
 
@@ -32,26 +30,25 @@ class MistralEncoder(BaseEncoder):
         if api_key is None:
             raise ValueError("Mistral API key not provided")
         self._client = self._initialize_client(mistralai_api_key)
-       
+
     def _initialize_client(self, api_key):
         try:
             from mistralai.client import MistralClient
         except ImportError:
-             raise ImportError(
+            raise ImportError(
                 "Please install MistralAI to use MistralEncoder. "
                 "You can install it with: "
                 "`pip install 'semantic-router[mistralai]'`"
             )
         try:
-             from mistralai.exceptions import MistralException
-             from mistralai.models.embeddings import EmbeddingResponse
+            from mistralai.exceptions import MistralException
+            from mistralai.models.embeddings import EmbeddingResponse
         except ImportError:
-             raise ImportError(
+            raise ImportError(
                 "Please install MistralAI to use MistralEncoder. "
                 "You can install it with: "
                 "`pip install 'semantic-router[mistralai]'`"
             )
-       
 
         try:
             self.client = MistralClient(api_key=api_key)
@@ -60,10 +57,7 @@ class MistralEncoder(BaseEncoder):
         except Exception as e:
             raise ValueError(f"Unable to connect to MistralAI {e.args}: {e}") from e
 
-    
     def __call__(self, docs: List[str]) -> List[List[float]]:
-
-       
         if self.client is None:
             raise ValueError("Mistral client not initialized")
         embeds = None
@@ -81,7 +75,11 @@ class MistralEncoder(BaseEncoder):
             except Exception as e:
                 raise ValueError(f"Unable to connect to MistralAI {e.args}: {e}") from e
 
-        if not embeds or not isinstance(embeds, self.embedding_response) or not embeds.data:
+        if (
+            not embeds
+            or not isinstance(embeds, self.embedding_response)
+            or not embeds.data
+        ):
             raise ValueError(f"No embeddings returned from MistralAI: {error_message}")
         embeddings = [embeds_obj.embedding for embeds_obj in embeds.data]
-        return embeddings
\ No newline at end of file
+        return embeddings
diff --git a/semantic_router/llms/llamacpp.py b/semantic_router/llms/llamacpp.py
index 2586d2e4253e485445c9c5e5bc1b3b81061c8279..527d97c14f8cca5200d527581298010549b42117 100644
--- a/semantic_router/llms/llamacpp.py
+++ b/semantic_router/llms/llamacpp.py
@@ -2,7 +2,7 @@ from contextlib import contextmanager
 from pathlib import Path
 from typing import Any, Optional
 
-from llama_cpp import Llama, LlamaGrammar
+# from llama_cpp import Llama, LlamaGrammar
 
 from semantic_router.llms.base import BaseLLM
 from semantic_router.schema import Message
@@ -10,18 +10,18 @@ from semantic_router.utils.logger import logger
 
 
 class LlamaCppLLM(BaseLLM):
-    llm: Llama
+    llm: Any
     temperature: float
     max_tokens: Optional[int] = 200
-    grammar: Optional[LlamaGrammar] = None
+    grammar: Optional[Any] = None
 
     def __init__(
         self,
-        llm: Llama,
+        llm: Any,
         name: str = "llama.cpp",
         temperature: float = 0.2,
         max_tokens: Optional[int] = 200,
-        grammar: Optional[LlamaGrammar] = None,
+        grammar: Optional[Any] = None,
     ):
         super().__init__(
             name=name,
@@ -30,6 +30,17 @@ class LlamaCppLLM(BaseLLM):
             max_tokens=max_tokens,
             grammar=grammar,
         )
+
+        try:
+            from llama_cpp import Llama, LlamaGrammar
+        except ImportError:
+            raise ImportError(
+                "Please install LlamaCPP to use Llama CPP llm. "
+                "You can install it with: "
+                "`pip install 'semantic-router[llama-cpp-python]'`"
+            )
+        llm = Llama
+        grammar = Optional[LlamaGrammar]
         self.llm = llm
         self.temperature = temperature
         self.max_tokens = max_tokens
@@ -62,7 +73,7 @@ class LlamaCppLLM(BaseLLM):
         grammar_path = Path(__file__).parent.joinpath("grammars", "json.gbnf")
         assert grammar_path.exists(), f"{grammar_path}\ndoes not exist"
         try:
-            self.grammar = LlamaGrammar.from_file(grammar_path)
+            self.grammar = self.grammar.from_file(grammar_path)
             yield
         finally:
             self.grammar = None
diff --git a/semantic_router/llms/mistral.py b/semantic_router/llms/mistral.py
index 42cbe46d026991f4112fac07b675f3fb152beeb7..c873bd2508b46e21b74c88c415029b338224b086 100644
--- a/semantic_router/llms/mistral.py
+++ b/semantic_router/llms/mistral.py
@@ -2,7 +2,6 @@ import os
 from typing import List, Optional, Any
 
 
-
 from semantic_router.llms import BaseLLM
 from semantic_router.schema import Message
 from semantic_router.utils.defaults import EncoderDefault
@@ -37,7 +36,7 @@ class MistralAILLM(BaseLLM):
         try:
             from mistralai.client import MistralClient
         except ImportError:
-             raise ImportError(
+            raise ImportError(
                 "Please install MistralAI to use MistralEncoder. "
                 "You can install it with: "
                 "`pip install 'semantic-router[mistralai]'`"
@@ -48,7 +47,7 @@ class MistralAILLM(BaseLLM):
             raise ValueError(
                 f"MistralAI API client failed to initialize. Error: {e}"
             ) from e
-       
+
     def __call__(self, messages: List[Message]) -> str:
         if self.client is None:
             raise ValueError("MistralAI client is not initialized.")