ValueError: Cannot use apply_chat_template() because tokenizer.chat_template is not set and no template argument was passed! For information about writing templates and setting the tokenizer.chat_template attribute, please see the documentation
Author: suvraadeep
Pull request: no
Labels: name: bug

### System Info

```
from langchain.schema import (
    HumanMessage,
    SystemMessage,
)
from langchain_community.chat_models.huggingface import ChatHuggingFace

messages = [
    SystemMessage(content="You're a helpful assistant"),
    HumanMessage(
        content="What happens when an unstoppable force meets an immovable object?"
    ),
]

chat_model = ChatHuggingFace(llm=llm_huggingface)

res = chat_model.invoke(messages)
print(res.content)
```

I am getting an output as
```
ValueError                                Traceback (most recent call last)
[<ipython-input-73-8a22262fa8e3>](https://localhost:8080/#) in <cell line: 1>()
----> 1 res = chat_model.invoke(messages)
      2 print(res.content)

8 frames
[/usr/local/lib/python3.10/dist-packages/transformers/tokenization_utils_base.py](https://localhost:8080/#) in get_chat_template(self, chat_template, tools)
   2023 
   2024             else:
-> 2025                 raise ValueError(
   2026                     "Cannot use apply_chat_template() because tokenizer.chat_template is not set and no template "
   2027                     "argument was passed! For information about writing templates and setting the "

ValueError: Cannot use apply_chat_template() because tokenizer.chat_template is not set and no template argument was passed! For information about writing templates and setting the tokenizer.chat_template attribute, please see the documentation at https://huggingface.co/docs/transformers/main/en/chat_templating

```


Expected reply: A code template to fix this issue

### Who can help?

 @ArthurZucker
 @Rocketknight1

### Information

- [X] The official example scripts
- [ ] My own modified scripts

### Tasks

- [ ] An officially supported task in the `examples` folder (such as GLUE/SQuAD, ...)
- [X] My own task or dataset (give details below)

### Reproduction

ValueError                                Traceback (most recent call last)
[<ipython-input-73-8a22262fa8e3>](https://localhost:8080/#) in <cell line: 1>()
----> 1 res = chat_model.invoke(messages)
      2 print(res.content)

8 frames
[/usr/local/lib/python3.10/dist-packages/transformers/tokenization_utils_base.py](https://localhost:8080/#) in get_chat_template(self, chat_template, tools)
   2023 
   2024             else:
-> 2025                 raise ValueError(
   2026                     "Cannot use apply_chat_template() because tokenizer.chat_template is not set and no template "
   2027                     "argument was passed! For information about writing templates and setting the "

ValueError: Cannot use apply_chat_template() because tokenizer.chat_template is not set and no template argument was passed! For information about writing templates and setting the tokenizer.chat_template attribute, please see the documentation at https://huggingface.co/docs/transformers/main/en/chat_templating

### Expected behavior

A code template to fix this issue

Comments:
Hi, I'm sorry, but this looks like a Langchain issue rather than a Transformers one! I can't even really tell what model they're using from this traceback. Maybe open the issue on [Langchain's Github](https://github.com/langchain-ai/langchain) instead?