Skip to content

Commit

Permalink
Improve conversation example for HfEngine
Browse files Browse the repository at this point in the history
  • Loading branch information
aymeric-roucher committed May 6, 2024
1 parent e0d9066 commit d75d85a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/source/en/main_classes/agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,20 @@ These engines have the following specification:
### HfEngine

For convenience, we have added a `HfEngine` that implements this and uses an inference endpoint for the execution of the LLM.
It accepts an argument `stop_sequences` to stop it in its generation, which will be helpful for controlling our LLM engine's output.

```python
>>> from transformers import HfEngine

>>> messages = [
... {"role": "user", "content": "Hello, how are you?"},
... {"role": "assistant", "content": "I'm doing great. How can I help you today?"},
... {"role": "user", "content": "I'd like to show off how chat templating works!"},
... {"role": "user", "content": "No need to help, take it easy."},
... ]

>>> HfEngine()(messages)
>>> HfEngine()(messages, stop_sequences=["conversation"])

"That sounds like a lot of fun! I'd be happy to help you demonstrate chat templating. Please go ahead and show me how it works."
"That's very kind of you to say! It's always nice to have a relaxed "
```

[[autodoc]] HfEngine
Expand Down

0 comments on commit d75d85a

Please sign in to comment.