原文
from rowboat import Client, StatefulChat from rowboat.schema import UserMessage, SystemMessage # Initialize the client client = Client( host="http://localhost:3000", project_id="<PROJECT_ID>", api_key="<API_KEY>" ) # 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 = [ SystemMessage(role='system', content="You are a helpful assistant"), UserMessage(role='user', content="Hello, how are you?") ] # Get response response = client.chat(messages=messages) print(response.messages[-1].content)