Skip to main content

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>"
)

Tool overrides

You can provide tool override instructions to test a specific configuration:

chat = StatefulChat(
    client,
    mock_tools={
        "weather_lookup": "The weather in any city is sunny and 25°C.",
        "calculator": "The result of any calculation is 42.",
        "search": "Search results for any query return 'No relevant information found.'"
    }
)

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rowboat-4.0.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rowboat-4.0.0-py3-none-any.whl (4.4 kB view details)

Uploaded Python 3

File details

Details for the file rowboat-4.0.0.tar.gz.

File metadata

  • Download URL: rowboat-4.0.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for rowboat-4.0.0.tar.gz
Algorithm Hash digest
SHA256 1ce77f641779915557030cf66385655416768c2f2e6d77acebd73f478f9624b3
MD5 62ed2ebda79cec62f38b48f72620c638
BLAKE2b-256 81a4a15472db7417fbb6b761e5cd2fef02bb81e2f61e4412ccc3772b85a239d4

See more details on using hashes here.

File details

Details for the file rowboat-4.0.0-py3-none-any.whl.

File metadata

  • Download URL: rowboat-4.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.4

File hashes

Hashes for rowboat-4.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 da1b2e13ce48312d1687e2e01d4ec6e589f1a205416d129983c61632ff27fef7
MD5 156fb6f9ef0e95f71fcef80e6d2b08e7
BLAKE2b-256 91ed8e720beb7fef54260111c49b0fbeec8d747c4361817e8a1b9a9ddd0c2016

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page