Creates a persistent chat session with a CassidyAI assistant. Unlike
cassidy_chat(), which can be used for one-off interactions, a session
object maintains conversation state and makes it easy to have back-and-forth
conversations.
Usage
cassidy_session(
assistant_id = Sys.getenv("CASSIDY_ASSISTANT_ID"),
context = NULL,
api_key = Sys.getenv("CASSIDY_API_KEY")
)Arguments
- assistant_id
Character. The CassidyAI assistant ID. Defaults to the
CASSIDY_ASSISTANT_IDenvironment variable.- context
Optional context object from
cassidy_context_project(),cassidy_describe_df(), or similar. Context is sent with the first message for efficiency.- api_key
Character. Your CassidyAI API key. Defaults to the
CASSIDY_API_KEYenvironment variable.
Value
A cassidy_session S3 object containing:
- thread_id
The conversation thread identifier
- assistant_id
The assistant this session is connected to
- messages
List of messages in this session
- created_at
When the session was created
- context
Stored context (sent with first message)
See also
Other chat-functions:
cassidy_chat(),
cassidy_continue(),
cassidy_write_code(),
cassidy_write_file(),
chat(),
chat_text()
Examples
if (FALSE) { # \dontrun{
# Create a session with project context
ctx <- cassidy_context_project()
session <- cassidy_session(context = ctx)
# Use the session
chat(session, "What should I work on next?")
chat(session, "How do I implement that?")
# View session info
print(session)
} # }