mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-06-06 19:35:44 +02:00
fix readme
This commit is contained in:
parent
45e09a8f32
commit
7572c049a3
1 changed files with 11 additions and 10 deletions
21
README.md
21
README.md
|
|
@ -67,7 +67,8 @@ There are 2 ways to integrate with the agents you create in Rowboat
|
||||||
"role": "user",
|
"role": "user",
|
||||||
"content": "tell me the weather in london in metric units"
|
"content": "tell me the weather in london in metric units"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"state": null
|
||||||
}'
|
}'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -76,7 +77,7 @@ There are 2 ways to integrate with the agents you create in Rowboat
|
||||||
- You can use the included Python SDK to interact with the Agents
|
- You can use the included Python SDK to interact with the Agents
|
||||||
- See [SDK Docs](https://docs.rowboatlabs.com/using_the_sdk/) for details
|
- See [SDK Docs](https://docs.rowboatlabs.com/using_the_sdk/) for details
|
||||||
```python
|
```python
|
||||||
from rowboat import Client
|
from rowboat import Client, StatefulChat
|
||||||
from rowboat.schema import UserMessage, SystemMessage
|
from rowboat.schema import UserMessage, SystemMessage
|
||||||
|
|
||||||
# Initialize the client
|
# Initialize the client
|
||||||
|
|
@ -86,20 +87,20 @@ There are 2 ways to integrate with the agents you create in Rowboat
|
||||||
api_key="<API_KEY>"
|
api_key="<API_KEY>"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create messages
|
# Create a stateful chat session (recommended)
|
||||||
|
chat = StatefulChat(client)
|
||||||
|
response = chat.run("What's the weather in London?")
|
||||||
|
print(response)
|
||||||
|
|
||||||
|
# Or use the low-level client API
|
||||||
messages = [
|
messages = [
|
||||||
SystemMessage(role='system', content="You are a helpful assistant"),
|
SystemMessage(role='system', content="You are a helpful assistant"),
|
||||||
UserMessage(role='user', content="Hello, how are you?")
|
UserMessage(role='user', content="Hello, how are you?")
|
||||||
]
|
]
|
||||||
|
|
||||||
# Get response
|
# Get response
|
||||||
response_messages, state = client.chat(messages=messages)
|
response = client.chat(messages=messages)
|
||||||
print(response_messages[-1].content)
|
print(response.messages[-1].content)
|
||||||
|
|
||||||
# For subsequent messages, include previous messages and state
|
|
||||||
messages.extend(response_messages)
|
|
||||||
messages.append(UserMessage(role='user', content="What's your name?"))
|
|
||||||
response_messages, state = client.chat(messages=messages, state=state)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue