docs: document dict-based message format and multi-message role shorthand in README

This commit is contained in:
retoor 2025-01-20 05:50:48 +00:00
parent dc6b102e15
commit 333c35aa7b

View File

@ -112,6 +112,28 @@ messages = [
last_response =agent.communicate(messages)
```
Messages are also allowed in this format:
```python
messages = [
dict(role="user",content="What is your name?"),
dict(role="assistant",content="My name is Hans."),
]
agent.communicate(messages)
```
You can add many messages of the same role with giving role as parameter.
```python
messages = [
"I am Hans,",
"I have many apples.",
"I do not have many oranges.",
"Wizards are cool.",
]
agent.communicate(messages,role="assistant")
```
## Add embeddings / documents / RAG to your agent
You can add context to your agent by adding documents to the vector store.