File tree Expand file tree Collapse file tree 1 file changed +24
-0
lines changed
Expand file tree Collapse file tree 1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -765,6 +765,30 @@ def __init__(
765765 ** kwargs , # type: ignore
766766 ):
767767 """Load a llama.cpp model from `model_path`.
768+
769+ Examples:
770+ Basic usage
771+
772+ >>> import llama_cpp
773+ >>> model = llama_cpp.Llama(
774+ ... model_path="path/to/model",
775+ ... )
776+ >>> print(model("The quick brown fox jumps ", stop=["."])["choices"][0]["text"])
777+ the lazy dog
778+
779+ Loading a chat model
780+
781+ >>> import llama_cpp
782+ >>> model = llama_cpp.Llama(
783+ ... model_path="path/to/model",
784+ ... chat_format="llama-2",
785+ ... )
786+ >>> print(model.create_chat_completion(
787+ ... messages=[{
788+ ... "role": "user",
789+ ... "content": "what is the meaning of life?"
790+ ... }]
791+ ... ))
768792
769793 Args:
770794 model_path: Path to the model.
You can’t perform that action at this time.
0 commit comments