update_ai_project_thread

ArtificialIntelligenceApi.update_ai_project_thread(project_id, thread_id, role_id, action, update_chat_request, content_type=None, _request_timeout=None, _request_auth=None, _content_type=None, _headers=None, _host_index=0)

Update a project thread

Edits a thread or asks for a summary of it, depending on action. You need at least read-only access to the project and the ai.view permission. With action=update, send any of Title, Keywords and Visibility. Omitted fields are left alone, Keywords replaces the existing list rather than adding to it, and Visibility can only go from private to public — sharing a thread cannot be undone. A body that changes nothing still succeeds. With action=summarize, the thread needs at least two messages and the request body is ignored; send an empty object. The response returns straight away and the thread’s SummaryGenerationStatus becomes triggered. Poll the thread detail endpoint for Summary and SummaryGenerationStatus.

Parameters:
  • project_id (str) – Identifier of the project the thread belongs to. You must have atleast read-only access to it. (required)

  • thread_id (str) – Identifier of the thread to update. (required)

  • role_id (str) – Amorphic role used to authorize this request. (required)

  • action (str) – What to do with the thread. update applies the fields in the request body; summarize requests a generated summary of the conversation and ignores the body. (required)

  • update_chat_request (UpdateChatRequest) – (required)

  • content_type (str) – Media type of the request body. Must be application/json.

  • _request_timeout (int, tuple(int, int), optional) – timeout setting for this request. If one number provided, it will be total request timeout. It can also be a pair (tuple) of (connection, read) timeouts.

  • _request_auth (dict, optional) – set to override the auth_settings for an a single request; this effectively ignores the authentication in the spec for a single request.

  • _content_type (str, Optional) – force content-type for the request.

  • _headers (dict, optional) – set to override the headers for a single request; this effectively ignores the headers in the spec for a single request.

  • _host_index (int, optional) – set to override the host_index for a single request; this effectively ignores the host_index in the spec for a single request.

Return type:

UpdateAiProjectThreadResponse

Returns:

Returns the result object.

Request and Response Examples

HTTP: PUT /ai/projects/{project_id}/threads/{thread_id}

Request

Rename a thread

{
  "Title": "Q3 revenue analysis"
}

Replace the keyword list

{
  "Keywords": [
    "revenue",
    "forecast",
    "emea"
  ]
}

Share the thread with the project

{
  "Visibility": "public"
}

Rename and retag in one call

{
  "Title": "Q3 revenue analysis",
  "Keywords": [
    "revenue",
    "forecast"
  ]
}

Empty body for action=summarize

{}

Success (HTTP 200)

The request was accepted. The same message is returned whether the thread changed, nothing changed, or a summary was requested, so read the thread back if you need to confirm the new state.

Thread updated

{
  "Message": "Thread updated successfully"
}

Errors

Documented error codes: IPV-1041, AI-1008, IPV-1002, AUTH-1012, AUTH-1001, GE-1008, DB-1002.

HTTP 400

The request was invalid or you do not have permission. The body is {“Message”: “<CODE> - <text>”}. Common cases include an `action` other than update or summarize (IPV-1041), setting `Visibility` to anything but public or trying to make a public thread private again (IPV-1041), asking to summarize a thread with fewer than two messages (AI-1008), an unknown project or thread (IPV-1002), no access to the project (AUTH-1012), a missing role_id header (AUTH-1001). A body that is not valid JSON returns a plain “Invalid input” message with no code. Permission failures return 400, not 403.

Unsupported action

{
  "Message": "IPV-1041 - Invalid parameter - action, allowed values/keys are update, summarize"
}

A public thread cannot be made private

{
  "Message": "IPV-1041 - Invalid parameter - visibility, allowed values/keys are cannot be changed from public to private"
}

Not enough messages to summarize

{
  "Message": "AI-1008 - Cannot perform summarization as chat has less than 2 messages"
}

Thread does not exist

{
  "Message": "IPV-1002 - Invalid ChatId - e2a91c5b-7d64-4f38-91ac-3b5e0d7f2c18, resource not found."
}

HTTP 500

An unexpected server error. The body is {“Message”: “GE-1008 - Could not complete the request. Please try again.”}. A failed write to the thread record surfaces as DB-1002.

Request could not be completed

{
  "Message": "GE-1008 - Could not complete the request. Please try again."
}