Python sdk for the Rowboat API
Project description
Rowboat Python SDK
A Python SDK for interacting with the Rowboat API.
Installation
You can install the package using pip:
pip install rowboat
Usage
Basic Usage with StatefulChat
The easiest way to interact with Rowboat is using the StatefulChat class, which maintains conversation state automatically:
from rowboat import Client, StatefulChat
# Initialize the client
client = Client(
host="<HOST>",
project_id="<PROJECT_ID>",
api_key="<API_KEY>"
)
# Create a stateful chat session
chat = StatefulChat(client)
# Have a conversation
response = chat.run("What is the capital of France?")
print(response)
# The capital of France is Paris.
# Continue the conversation - the context is maintained automatically
response = chat.run("What other major cities are in that country?")
print(response)
# Other major cities in France include Lyon, Marseille, Toulouse, and Nice.
response = chat.run("What's the population of the first city you mentioned?")
print(response)
# Lyon has a population of approximately 513,000 in the city proper.
Advanced Usage
Using a specific workflow
You can specify a workflow ID to use a particular conversation configuration:
chat = StatefulChat(
client,
workflow_id="<WORKFLOW_ID>"
)
Using a test profile
You can specify a test profile ID to use a specific test configuration:
chat = StatefulChat(
client,
test_profile_id="<TEST_PROFILE_ID>"
)
Low-Level Usage
For more control over the conversation, you can use the Client class directly:
from rowboat.schema import UserMessage
# Initialize the client
client = Client(
host="<HOST>",
project_id="<PROJECT_ID>",
api_key="<API_KEY>"
)
# Create messages
messages = [
UserMessage(role='user', content="Hello, how are you?")
]
# Get response
response = client.chat(messages=messages)
print(response.messages[-1].content)
# For subsequent messages, you need to manage the message history and state manually
messages.extend(response.messages)
messages.append(UserMessage(role='user', content="What's your name?"))
response = client.chat(messages=messages, state=response.state)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file rowboat-3.1.0.tar.gz.
File metadata
- Download URL: rowboat-3.1.0.tar.gz
- Upload date:
- Size: 3.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6dc7e9fb646cf8e56a08972ad1064982a65fef0eeb86cc46173ed8c6b8654e0
|
|
| MD5 |
927ff1b1b7a9aee65db25e32905906cd
|
|
| BLAKE2b-256 |
df364ca68a63cc7af6eaece4b14bb899f3445f5458a0a883bbc593316f1e1a60
|
File details
Details for the file rowboat-3.1.0-py3-none-any.whl.
File metadata
- Download URL: rowboat-3.1.0-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
740081486a891713a6c4c1c30e112877619fe999d2cc9eb5993483c27465689f
|
|
| MD5 |
f48a5e1d364c32f45a1dc6b2965ebc62
|
|
| BLAKE2b-256 |
6feba17eb738eaddaef401fb4a9960361630ff3b458d4ea2f607ad75a907bf04
|