Documentation Index
Fetch the complete documentation index at: https://www.getmaxim.ai/docs/llms.txt
Use this file to discover all available pages before exploring further.
View module source on GitHub
@deprecated(
"This class will be removed in a future version. Use {} which is TypedDict."
)
@dataclass
class SessionConfig()
Session config.
This class represents a session config.
class SessionConfigDict(TypedDict)
Session config dict.
This class represents a session config dictionary.
get_session_config_dict
def get_session_config_dict(
config: Union[SessionConfig, SessionConfigDict]) -> dict[str, Any]
Convert a session config to a session config dict else return the config.
Arguments:
| Name | Description |
|---|
config | The config to convert. |
Returns:
dict[str, Any]: The session config dict.
class Session(EventEmittingBaseContainer)
A session is a collection of traces.
A session is created when a new session is started.
A session is ended when the session is stopped.
__init__
def __init__(config: Union[SessionConfig, SessionConfigDict],
writer: LogWriter)
Create a new session.
Arguments:
| Name | Description |
|---|
config | The configuration for the session. |
trace
def trace(config: Union[TraceConfig, TraceConfigDict]) -> Trace
Create a new trace for this session.
Arguments:
| Name | Description |
|---|
config | The configuration for the trace. |
Returns:
A new Trace instance.
trace_
@staticmethod
def trace_(writer: LogWriter, session_id: str,
config: Union[TraceConfig, TraceConfigDict]) -> Trace
Create a new trace for this session.
Arguments:
| Name | Description |
|---|
writer | The LogWriter instance to use. |
session_id | The ID of the session to create the trace for. |
config | The configuration for the trace. |
Returns:
A new Trace instance.
feedback
def feedback(feedback: Union[Feedback, FeedbackDict])
Add feedback to this session.
Arguments:
| Name | Description |
|---|
feedback | The feedback to add. |
add_attachment
def add_attachment(attachment: Union[FileAttachment, FileDataAttachment,
UrlAttachment])
Add an attachment to this session.
Arguments:
| Name | Description |
|---|
attachment | The attachment to add. |
add_attachment_
@staticmethod
def add_attachment_(writer: LogWriter, session_id: str,
attachment: Union[FileAttachment, FileDataAttachment,
UrlAttachment])
Add an attachment to this session.
Arguments:
| Name | Description |
|---|
writer | The LogWriter instance to use. |
session_id | The ID of the session to add the attachment to. |
attachment | The attachment to add. |
add_tag_
@staticmethod
def add_tag_(writer: LogWriter, session_id: str, key: str, value: str)
Add a tag to this session.
Arguments:
| Name | Description |
|---|
writer | The LogWriter instance to use. |
session_id | The ID of the session to add the tag to. |
key | The tag key. |
value | The tag value. |
end_
@staticmethod
def end_(writer: LogWriter,
session_id: str,
data: Optional[Dict[str, Any]] = None)
End this session.
Arguments:
| Name | Description |
|---|
writer | The LogWriter instance to use. |
session_id | The ID of the session to end. |
data | Optional data to add to the session. |
event_
@staticmethod
def event_(writer: LogWriter, session_id: str, id: str, event: str,
data: Dict[str, str])
Add an event to this session.
Arguments:
| Name | Description |
|---|
writer | The LogWriter instance to use. |
session_id | The ID of the session to add the event to. |
id | The ID of the event. |
event | The event. |
data | Optional data to add to the event. |