Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 702306b

Browse filesBrowse files
committed
docs: Restore functionary docs in README
1 parent 47bad30 commit 702306b
Copy full SHA for 702306b

File tree

Expand file treeCollapse file tree

1 file changed

+20
-5
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+20
-5
lines changed

‎README.md

Copy file name to clipboardExpand all lines: README.md
+20-5Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,14 +365,10 @@ To constrain the response further to a specific JSON Schema add the schema to th
365365

366366
### Function Calling
367367

368-
The high-level API also provides a simple interface for function calling. This is possible through the `functionary` pre-trained models chat format or through the generic `chatml-function-calling` chat format.
369-
370-
The gguf-converted files for functionary can be found here: [functionary-7b-v1](https://huggingface.co/abetlen/functionary-7b-v1-GGUF)
368+
The high-level API supports OpenAI compatible function and tool calling. This is possible through the `functionary` pre-trained models chat format or through the generic `chatml-function-calling` chat format.
371369

372370
```python
373371
>>> from llama_cpp import Llama
374-
>>> llm = Llama(model_path="path/to/functionary/llama-model.gguf", chat_format="functionary")
375-
>>> # or
376372
>>> llm = Llama(model_path="path/to/chatml/llama-model.gguf", chat_format="chatml-function-calling")
377373
>>> llm.create_chat_completion(
378374
messages = [
@@ -416,6 +412,25 @@ The gguf-converted files for functionary can be found here: [functionary-7b-v1](
416412
)
417413
```
418414

415+
<details>
416+
<summary>Functionary v2</summary>
417+
418+
The various gguf-converted files for this set of models can be found [here](https://huggingface.co/meetkai). Functionary is able to intelligently call functions and also analyze any provided function outputs to generate coherent responses. All v2 models of functionary supports **parallel function calling**. You can provide either `functionary-v1` or `functionary-v2` for the `chat_format` when initializing the Llama class.
419+
420+
Due to discrepancies between llama.cpp and HuggingFace's tokenizers, it is required to provide HF Tokenizer for functionary. The `LlamaHFTokenizer` class can be initialized and passed into the Llama class. This will override the default llama.cpp tokenizer used in Llama class. The tokenizer files are already included in the respective HF repositories hosting the gguf files.
421+
422+
```python
423+
>>> from llama_cpp import Llama
424+
>>> from llama_cpp.llama_tokenizer import LlamaHFTokenizer
425+
>>> llm = Llama.from_pretrained(
426+
repo_id="meetkai/functionary-7b-v1-GGUF",
427+
filename="functionary-small-v2.2.q4_0.gguf",
428+
chat_format="functionary-v2",
429+
tokenizer=LlamaHFTokenizer.from_pretrained("meetkai/functionary-7b-v1-GGUF")
430+
)
431+
```
432+
</details>
433+
419434
### Multi-modal Models
420435

421436
`llama-cpp-python` supports the llava1.5 family of multi-modal models which allow the language model to

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.