Skip to content

Generate Session Title

client.Beta.Chat.SetTitle(ctx, sessionID, params) (*BetaChatSetTitleResponse, error)
POST/api/v1/chat/{session_id}/title

Generate a title for a session from its first user message.

ParametersExpand Collapse
sessionID string
params BetaChatSetTitleParams
FirstMessage param.Field[string]

Body param: First user message of the session, used to infer a short title.

OrganizationID param.Field[string]optional

Query param

formatuuid
ProjectID param.Field[string]optional

Query param

formatuuid
ReturnsExpand Collapse
type BetaChatSetTitleResponse struct{…}

Summary of a chat session, including its title and last run metadata.

LastUpdatedAt string

ISO-format timestamp showing when the session was last updated.

SessionID string

Unique session identifier.

GeneratedTitle stringoptional

Auto-generated title derived from the first user message.

IndexIDs []stringoptional

Indexes this session is bound to. Null on unbound sessions.

JobMetadata BetaChatSetTitleResponseJobMetadataoptional

Token usage and status from the most recent run. Null if the session has not been run yet.

DurationMs float64optional
Error stringoptional
ExportConfigIDs []stringoptional
IsError booloptional
TotalInputTokens int64optional
TotalOutputTokens int64optional
Turns int64optional

Generate Session Title

package main

import (
  "context"
  "fmt"

  "github.com/stainless-sdks/llamacloud-prod-go"
  "github.com/stainless-sdks/llamacloud-prod-go/option"
)

func main() {
  client := llamacloudprod.NewClient(
    option.WithAPIKey("My API Key"),
  )
  response, err := client.Beta.Chat.SetTitle(
    context.TODO(),
    "session_id",
    llamacloudprod.BetaChatSetTitleParams{
      FirstMessage: "What were the main findings in Q3?",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response.SessionID)
}
{
  "last_updated_at": "2026-04-22T12:34:41.342245",
  "session_id": "ses-abc123",
  "generated_title": "What were the main findings in Q3?...",
  "index_ids": [
    "idx-abc123",
    "idx-def456"
  ],
  "job_metadata": {
    "duration_ms": 0,
    "error": "error",
    "export_config_ids": [
      "string"
    ],
    "is_error": true,
    "total_input_tokens": 0,
    "total_output_tokens": 0,
    "turns": 0
  }
}
Returns Examples
{
  "last_updated_at": "2026-04-22T12:34:41.342245",
  "session_id": "ses-abc123",
  "generated_title": "What were the main findings in Q3?...",
  "index_ids": [
    "idx-abc123",
    "idx-def456"
  ],
  "job_metadata": {
    "duration_ms": 0,
    "error": "error",
    "export_config_ids": [
      "string"
    ],
    "is_error": true,
    "total_input_tokens": 0,
    "total_output_tokens": 0,
    "turns": 0
  }
}