Update chat templating docs to match new format
This commit is contained in:
parent
7fd0da44c6
commit
6148213a93
|
@ -300,10 +300,12 @@ function that has a valid docstring with parameter annotations and valid type hi
|
||||||
from transformers.utils import get_json_schema
|
from transformers.utils import get_json_schema
|
||||||
|
|
||||||
def multiply(a: float, b: float):
|
def multiply(a: float, b: float):
|
||||||
"""Multiply two numbers together.
|
"""
|
||||||
|
A function that multiplies two numbers
|
||||||
|
|
||||||
:param a: The first number to multiply.
|
Args:
|
||||||
:param b: The second number to multiply.
|
a: The first number to multiply
|
||||||
|
b: The second number to multiply
|
||||||
"""
|
"""
|
||||||
return a * b
|
return a * b
|
||||||
|
|
||||||
|
@ -348,10 +350,12 @@ def current_time():
|
||||||
|
|
||||||
@add_json_schema
|
@add_json_schema
|
||||||
def multiply(a: float, b: float):
|
def multiply(a: float, b: float):
|
||||||
"""Multiply two numbers together.
|
"""
|
||||||
|
A function that multiplies two numbers
|
||||||
|
|
||||||
:param a: The first number to multiply.
|
Args:
|
||||||
:param b: The second number to multiply.
|
a: The first number to multiply
|
||||||
|
b: The second number to multiply
|
||||||
"""
|
"""
|
||||||
return a * b
|
return a * b
|
||||||
|
|
||||||
|
@ -363,6 +367,16 @@ model_input = tokenizer.apply_chat_template(
|
||||||
)
|
)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
#### Notes on automatic conversion
|
||||||
|
|
||||||
|
`get_json_schema` and `add_json_schema` both expect a specific docstring format. The docstring should
|
||||||
|
begin with a description of the function, followed by an `Args:` block that describes each argument. It can also
|
||||||
|
optionally include a `Returns:` block that describes the value(s) returned by the function. Many templates ignore this,
|
||||||
|
because the model will see the return format after calling the function anyway, but some require it.
|
||||||
|
|
||||||
|
Argument descriptions in the docstring should not include the argument types - these are read from the type hints
|
||||||
|
in the function signature instead.
|
||||||
|
|
||||||
### Arguments for RAG
|
### Arguments for RAG
|
||||||
|
|
||||||
"Retrieval-augmented generation" or "RAG" LLMs can search a corpus of documents for information before responding
|
"Retrieval-augmented generation" or "RAG" LLMs can search a corpus of documents for information before responding
|
||||||
|
|
Loading…
Reference in New Issue