| 7 | |
| 8 | |
| 9 | class LlamaLLM(LLM): |
| 10 | model_path: str |
| 11 | llm: Llama |
| 12 | |
| 13 | @property |
| 14 | def _llm_type(self) -> str: |
| 15 | return "llama-cpp-python" |
| 16 | |
| 17 | def __init__(self, model_path: str, **kwargs: Any): |
| 18 | model_path = model_path |
| 19 | llm = Llama(model_path=model_path) |
| 20 | super().__init__(model_path=model_path, llm=llm, **kwargs) |
| 21 | |
| 22 | def _call(self, prompt: str, stop: Optional[List[str]] = None) -> str: |
| 23 | response = self.llm(prompt, stop=stop or []) |
| 24 | return response["choices"][0]["text"] |
| 25 | |
| 26 | @property |
| 27 | def _identifying_params(self) -> Mapping[str, Any]: |
| 28 | return {"model_path": self.model_path} |
| 29 | |
| 30 | |
| 31 | parser = argparse.ArgumentParser() |
no outgoing calls
no test coverage detected
searching dependent graphs…