Skip to content

Commit

Permalink
Add 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 0b32b80 commit e0d9066
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
14 changes: 14 additions & 0 deletions docs/source/en/main_classes/agent.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,20 @@ These engines have the following specification:

For convenience, we have added a `HfEngine` that implements this and uses an inference endpoint for the execution of the LLM.

```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!"},
... ]

>>> HfEngine()(messages)

"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."
```

[[autodoc]] HfEngine


Expand Down
1 change: 1 addition & 0 deletions src/transformers/agents/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ def from_langchain(langchain_tool):
"""
Creates a [`Tool`] from a langchain tool.
"""

class LangChainToolWrapper(Tool):
def __init__(self, _langchain_tool):
super().__init__()
Expand Down

0 comments on commit e0d9066

Please sign in to comment.