| create_session | R Documentation |
Creates a session using either the new SharedSession or legacy ChatSession based on feature flags. This provides a migration path for existing code.
create_session(
model = NULL,
system_prompt = NULL,
tools = NULL,
hooks = NULL,
max_steps = 10,
...
)
model |
A LanguageModelV1 object or model string ID. |
system_prompt |
Optional system prompt. |
tools |
Optional list of Tool objects. |
hooks |
Optional HookHandler object. |
max_steps |
Maximum tool execution steps. Default 10. |
... |
Additional arguments passed to session constructor. |
A SharedSession or ChatSession object.
if (interactive()) {
# Automatically uses SharedSession if feature enabled
session <- create_session(model = "openai:gpt-4o")
# Force legacy session
sdk_set_feature("use_shared_session", FALSE)
session <- create_session(model = "openai:gpt-4o")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.