Skip to content

ChatAndSessions

Overview

Chat and session management endpoints

Available Operations

manage_session

Manage a chat session by creating it, deleting it, clearing its messages, or editing its name.

Example Usage

from fermisdk import Fermisdk
import os


with Fermisdk(
    bearer_auth=os.getenv("FERMISDK_BEARER_AUTH", ""),
) as f_client:

    res = f_client.chat_and_sessions.manage_session(action="create")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
action models.SessionActionRequestAction :heavy_check_mark: Action to perform
session_id Optional[str] :heavy_minus_sign: Session ID (required for delete/clear/edit, optional for create)
name Optional[str] :heavy_minus_sign: Session name (required for edit, optional for create)
conversation_type Optional[str] :heavy_minus_sign: Conversation type for create (defaults to 'chat')
retries Optional[utils.RetryConfig] :heavy_minus_sign: Configuration to override the default retry behavior of the client.

Response

models.SessionActionResponse

Errors

Error Type Status Code Content Type
errors.Error 400 application/json
errors.Error 500 application/json
errors.FermisdkDefaultError 4XX, 5XX */*

list_sessions

List chat sessions for the authenticated user.

Example Usage

from fermisdk import Fermisdk
import os


with Fermisdk(
    bearer_auth=os.getenv("FERMISDK_BEARER_AUTH", ""),
) as f_client:

    res = f_client.chat_and_sessions.list_sessions(conversation_type="chat", offset=0)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
conversation_type Optional[str] :heavy_minus_sign: Conversation type to list (e.g., 'chat', 'analytics', 'workflow')
limit Optional[int] :heavy_minus_sign: Maximum number of sessions to return. Omit to return all.
offset Optional[int] :heavy_minus_sign: Number of sessions to skip for pagination
retries Optional[utils.RetryConfig] :heavy_minus_sign: Configuration to override the default retry behavior of the client.

Response

models.SessionListResponse

Errors

Error Type Status Code Content Type
errors.Error 500 application/json
errors.FermisdkDefaultError 4XX, 5XX */*

get_session_info

Get information about a session including message count and metadata.

Example Usage

from fermisdk import Fermisdk
import os


with Fermisdk(
    bearer_auth=os.getenv("FERMISDK_BEARER_AUTH", ""),
) as f_client:

    res = f_client.chat_and_sessions.get_session_info(session_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
session_id str :heavy_check_mark: Session identifier
retries Optional[utils.RetryConfig] :heavy_minus_sign: Configuration to override the default retry behavior of the client.

Response

models.SessionInfo

Errors

Error Type Status Code Content Type
errors.Error 404 application/json
errors.Error 500 application/json
errors.FermisdkDefaultError 4XX, 5XX */*

send_chat_message

Send a chat message to the AI assistant. Supports various actions including analytics queries, relationship explanations, and general chat. Before sending chat messages, you need to create a session first.

Example Usage

from fermisdk import Fermisdk
import os


with Fermisdk(
    bearer_auth=os.getenv("FERMISDK_BEARER_AUTH", ""),
) as f_client:

    res = f_client.chat_and_sessions.send_chat_message(action="analytics", query="SalesOrders → Shipments: Shipments.order_id fulfills SalesOrders.order_id. Explain it in detail", session_id="default-68d3d439648e3a8ea63411d0")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
action models.ChatRequestAction :heavy_check_mark: Action type
query str :heavy_check_mark: The chat query or question to send to the assistant
session_id str :heavy_check_mark: Session ID to associate the message with
retries Optional[utils.RetryConfig] :heavy_minus_sign: Configuration to override the default retry behavior of the client.

Response

models.ChatResponse

Errors

Error Type Status Code Content Type
errors.Error 400, 401 application/json
errors.Error 500 application/json
errors.FermisdkDefaultError 4XX, 5XX */*