Conversations

Comprehensive guide to managing conversations and messages in the View Assistant platform, including conversation creation, message handling, and streaming support for real-time AI interactions.

Overview

Conversations enable interactive AI-powered chat sessions within the View Assistant platform. They provide structured communication channels for users to engage with AI models, send messages, receive streaming responses, and manage conversation history with full support for document attachments and metadata tracking.

Conversations are managed via the Assistant API at [http|https]://[hostname]:[port]/v1.0/tenants/[tenant-guid]/assistant/conversations and support comprehensive operations including conversation creation, message streaming, pagination, and lifecycle management for optimal AI interaction workflows.

Conversation Object Structure

Conversation objects contain comprehensive information about chat sessions and their associated metadata. Here's the complete structure:

{
  "conversation_id": "abc123-def456-ghi789",
  "tenant_guid": "00000000-0000-0000-0000-000000000000",
  "user_guid": "11111111-1111-1111-1111-111111111111",
  "session_id": "session-abc-123",
  "config_guid": "22222222-2222-2222-2222-222222222222",
  "title": "Project Planning Discussion",
  "message_count": 15,
  "last_message_at": "2025-01-15T10:30:00.000000Z",
  "created_at": "2025-01-15T09:00:00.000000Z",
  "updated_at": "2025-01-15T10:30:00.000000Z",
  "metadata": {
    "source": "web",
    "user_id": "user-123"
  }
}

Field Descriptions

  • conversation_id (string): Unique identifier for the conversation
  • tenant_guid (string): Globally unique identifier for the tenant
  • user_guid (string): Globally unique identifier for the user
  • session_id (any): Session identifier associated with the conversation
  • config_guid (string): GUID of the model configuration used for this conversation
  • title (string): Display title for the conversation
  • message_count (number): Total number of messages in the conversation
  • last_message_at (any): Timestamp of the last message in the conversation
  • created_at (string): Timestamp when the conversation was created
  • updated_at (string): Timestamp when the conversation was last updated
  • metadata (object): Additional metadata including source and user_id

API Endpoints

Conversations are managed via the Assistant server API at [http|https]://[hostname]:[port]/v1.0/tenants/[tenant-guid]/assistant/conversations

Supported HTTP Methods: GET, POST, PATCH, DELETE

Important: All conversation operations require appropriate authentication tokens.

Supported Operations

  • Create: Create new conversations with initial messages and streaming support
  • Read: Retrieve individual conversation details with or without messages
  • Read All: List all conversations with pagination support
  • Update: Modify conversation properties such as title and metadata
  • Delete: Remove conversations and their associated messages
  • Read Messages: Retrieve messages from a conversation with pagination
  • Add Messages: Send new messages to conversations with streaming support
  • Update Messages: Modify existing messages in conversations

Create Conversation

Creates a new conversation using POST /v1.0/tenants/[tenant-guid]/assistant/conversations. This endpoint supports streaming responses and creates a new conversation with an initial message.

Request Parameters

  • config_guid (string, Required): GUID of the model configuration to use
  • title (string, Required): Display title for the conversation
  • message (string, Required): Initial message to start the conversation
  • metadata (object, Optional): Additional metadata including source and user_id
  • documents (any, Optional): Documents to attach to the conversation

Request Body

{
  "config_guid": "22222222-2222-2222-2222-222222222222",
  "title": "New Conversation",
  "message": "Hello, I need help with my project.",
  "metadata": {
    "source": "web",
    "user_id": "user-123"
  },
  "documents": null
}
curl --location --request POST 'http://localhost:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/assistant/conversations' \
--header 'content-type: application/json' \
--header 'Authorization: ••••••' \
--data '{
    "config_guid": "22222222-2222-2222-2222-222222222222",
    "title": "New Conversation",
    "message": "Hello, I need help with my project.",
    "metadata": {
        "source": "web",
        "user_id": "user-123"
    }
}'
import { ViewAssistantSdk } from "view-sdk";

const api = new ViewAssistantSdk(
  "http://localhost:8000/", //endpoint
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default" //access key
);

const createConversation = async () => {
  try {
    const response = await api.Conversation.create({
      config_guid: "22222222-2222-2222-2222-222222222222",
      title: "New Conversation",
      message: "Hello, I need help with my project.",
      metadata: {
        source: "web",
        user_id: "user-123"
      }
    }, (token) => {
      // Handle streaming tokens
      console.log("Token:", token);
    });
    console.log(response, "Conversation created successfully");
  } catch (err) {
    console.log("Error creating conversation:", err);
  }
};

createConversation();
import view_sdk
from view_sdk import assistant
from view_sdk.sdk_configuration import Service

sdk = view_sdk.configure(
    access_key="default",
    base_url="localhost",
    tenant_guid="00000000-0000-0000-0000-000000000000",
    service_ports={Service.DEFAULT: 8000},
)

def createConversation():
    def on_token(token):
        # Handle streaming tokens
        print("Token:", token)
    
    conversation = assistant.Conversation.create(
        config_guid="22222222-2222-2222-2222-222222222222",
        title="New Conversation",
        message="Hello, I need help with my project.",
        metadata={
            "source": "web",
            "user_id": "user-123"
        },
        on_token=on_token
    )
    print("Created Conversation:")
    print(conversation)

createConversation()
using View.Sdk;
using View.Sdk.Assistant;

ViewAssistantSdk sdk = new ViewAssistantSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"), 
                                            "default", 
                                            "http://localhost:8000/");

ConversationRequest request = new ConversationRequest
{
    config_guid = "22222222-2222-2222-2222-222222222222",
    title = "New Conversation",
    message = "Hello, I need help with my project.",
    metadata = new Dictionary<string, string>
    {
        { "source", "web" },
        { "user_id", "user-123" }
    }
};

Conversation conversation = await sdk.Conversation.Create(request, (token) => {
    // Handle streaming tokens
    Console.WriteLine("Token: {0}", token);
});

Response

Returns the created conversation object with all details:

{
  "conversation_id": "abc123-def456-ghi789",
  "tenant_guid": "00000000-0000-0000-0000-000000000000",
  "user_guid": "11111111-1111-1111-1111-111111111111",
  "session_id": "session-abc-123",
  "config_guid": "22222222-2222-2222-2222-222222222222",
  "title": "New Conversation",
  "message_count": 1,
  "last_message_at": "2025-01-15T09:00:00.000000Z",
  "created_at": "2025-01-15T09:00:00.000000Z",
  "updated_at": "2025-01-15T09:00:00.000000Z",
  "metadata": {
    "source": "web",
    "user_id": "user-123"
  }
}

Note: This endpoint supports streaming responses. Tokens are delivered incrementally via the onToken callback function.

Read Conversation with Messages

Retrieves a specific conversation by ID along with its messages using GET /v1.0/tenants/[tenant-guid]/assistant/conversations/[conversation-id]. Returns the complete conversation with paginated messages.

Request Parameters

  • conversation-id (string, Path, Required): ID of the conversation to retrieve
  • message_limit (number, Query, Optional): Number of messages to retrieve (default: 100)
  • message_offset (number, Query, Optional): Offset for message pagination (default: 0)
curl --location 'http://localhost:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/assistant/conversations/abc123-def456-ghi789?message_limit=100&message_offset=0' \
--header 'Authorization: ••••••'
import { ViewAssistantSdk } from "view-sdk";

const api = new ViewAssistantSdk(
  "http://localhost:8000/", //endpoint
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default" //access key
);

const readConversation = async () => {
  try {
    const response = await api.Conversation.readWithMessages(
      "abc123-def456-ghi789",
      100, // message_limit
      0    // message_offset
    );
    console.log(response, "Conversation fetched successfully");
  } catch (err) {
    console.log("Error fetching conversation:", err);
  }
};

readConversation();
import view_sdk
from view_sdk import assistant
from view_sdk.sdk_configuration import Service

sdk = view_sdk.configure(
    access_key="default",
    base_url="localhost",
    tenant_guid="00000000-0000-0000-0000-000000000000",
    service_ports={Service.DEFAULT: 8000},
)

def readConversation():
    conversation = assistant.Conversation.read_with_messages(
        conversation_id="abc123-def456-ghi789",
        messages_limit=100,
        messages_offset=0
    )
    print("Retrieved Conversation:")
    print(conversation)

readConversation()
using View.Sdk;
using View.Sdk.Assistant;

ViewAssistantSdk sdk = new ViewAssistantSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"), 
                                            "default", 
                                            "http://localhost:8000/");

ConversationWithMessagesResponse response = await sdk.Conversation.ReadWithMessages(
    "abc123-def456-ghi789",
    messagesLimit: 100,
    messagesOffset: 0
);

Response

Returns the conversation with associated messages:

{
  "conversation": {
    "conversation_id": "abc123-def456-ghi789",
    "tenant_guid": "00000000-0000-0000-0000-000000000000",
    "user_guid": "11111111-1111-1111-1111-111111111111",
    "session_id": "session-abc-123",
    "config_guid": "22222222-2222-2222-2222-222222222222",
    "title": "Project Planning Discussion",
    "message_count": 15,
    "last_message_at": "2025-01-15T10:30:00.000000Z",
    "created_at": "2025-01-15T09:00:00.000000Z",
    "updated_at": "2025-01-15T10:30:00.000000Z",
    "metadata": {
      "source": "web",
      "user_id": "user-123"
    }
  },
  "messages": [
    {
      "message_id": "msg-001",
      "role": "user",
      "content": "Hello, I need help with my project.",
      "created_at": "2025-01-15T09:00:00.000000Z"
    },
    {
      "message_id": "msg-002",
      "role": "assistant",
      "content": "I'd be happy to help you with your project. What specific aspects would you like to discuss?",
      "created_at": "2025-01-15T09:00:15.000000Z"
    }
  ]
}

Read All Conversations

Retrieves all conversations for a tenant using GET /v1.0/tenants/[tenant-guid]/assistant/conversations. Returns a paginated list of conversations.

Request Parameters

  • limit (number, Query, Optional): Number of conversations to retrieve (default: 100)
  • offset (number, Query, Optional): Offset for pagination (default: 0)
curl --location 'http://localhost:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/assistant/conversations?limit=100&offset=0' \
--header 'Authorization: ••••••'
import { ViewAssistantSdk } from "view-sdk";

const api = new ViewAssistantSdk(
  "http://localhost:8000/", //endpoint
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default" //access key
);

const readAllConversations = async () => {
  try {
    const response = await api.Conversation.readAll(100, 0);
    console.log(response, "All conversations fetched successfully");
  } catch (err) {
    console.log("Error fetching conversations:", err);
  }
};

readAllConversations();
import view_sdk
from view_sdk import assistant
from view_sdk.sdk_configuration import Service

sdk = view_sdk.configure(
    access_key="default",
    base_url="localhost",
    tenant_guid="00000000-0000-0000-0000-000000000000",
    service_ports={Service.DEFAULT: 8000},
)

def readAllConversations():
    conversations = assistant.Conversation.read_all(
        limit=100,
        offset=0
    )
    print("All Conversations:")
    print(conversations)

readAllConversations()
using View.Sdk;
using View.Sdk.Assistant;

ViewAssistantSdk sdk = new ViewAssistantSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"), 
                                            "default", 
                                            "http://localhost:8000/");

ConversationListResponse response = await sdk.Conversation.ReadAll(
    limit: 100,
    offset: 0
);

Response

Returns a paginated list of conversations:

{
  "conversations": [
    {
      "conversation_id": "abc123-def456-ghi789",
      "tenant_guid": "00000000-0000-0000-0000-000000000000",
      "user_guid": "11111111-1111-1111-1111-111111111111",
      "session_id": "session-abc-123",
      "config_guid": "22222222-2222-2222-2222-222222222222",
      "title": "Project Planning Discussion",
      "message_count": 15,
      "last_message_at": "2025-01-15T10:30:00.000000Z",
      "created_at": "2025-01-15T09:00:00.000000Z",
      "updated_at": "2025-01-15T10:30:00.000000Z",
      "metadata": {
        "source": "web",
        "user_id": "user-123"
      }
    }
  ],
  "total": 25,
  "limit": 100,
  "offset": 0
}

Update Conversation

Updates an existing conversation using PATCH /v1.0/tenants/[tenant-guid]/assistant/conversations/[conversation-id]. Allows partial updates to conversation properties.

Request Parameters

  • conversation-id (string, Path, Required): ID of the conversation to update

Request Body

Only include the fields you want to update:

{
  "title": "Updated Conversation Title",
  "metadata": {
    "source": "mobile",
    "user_id": "user-456"
  }
}
curl --location --request PATCH 'http://localhost:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/assistant/conversations/abc123-def456-ghi789' \
--header 'content-type: application/json' \
--header 'Authorization: ••••••' \
--data '{
    "title": "Updated Conversation Title"
}'
import { ViewAssistantSdk } from "view-sdk";

const api = new ViewAssistantSdk(
  "http://localhost:8000/", //endpoint
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default" //access key
);

const updateConversation = async () => {
  try {
    const response = await api.Conversation.update({
      conversation_id: "abc123-def456-ghi789",
      title: "Updated Conversation Title"
    });
    console.log(response, "Conversation updated successfully");
  } catch (err) {
    console.log("Error updating conversation:", err);
  }
};

updateConversation();
import view_sdk
from view_sdk import assistant
from view_sdk.sdk_configuration import Service

sdk = view_sdk.configure(
    access_key="default",
    base_url="localhost",
    tenant_guid="00000000-0000-0000-0000-000000000000",
    service_ports={Service.DEFAULT: 8000},
)

def updateConversation():
    conversation = assistant.Conversation.update(
        conversation_id="abc123-def456-ghi789",
        title="Updated Conversation Title"
    )
    print("Updated Conversation:")
    print(conversation)

updateConversation()
using View.Sdk;
using View.Sdk.Assistant;

ViewAssistantSdk sdk = new ViewAssistantSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"), 
                                            "default", 
                                            "http://localhost:8000/");

Conversation conversation = new Conversation
{
    conversation_id = "abc123-def456-ghi789",
    title = "Updated Conversation Title"
};

Conversation updatedConversation = await sdk.Conversation.Update(conversation);

Response

Returns the updated conversation object:

{
  "conversation_id": "abc123-def456-ghi789",
  "tenant_guid": "00000000-0000-0000-0000-000000000000",
  "user_guid": "11111111-1111-1111-1111-111111111111",
  "session_id": "session-abc-123",
  "config_guid": "22222222-2222-2222-2222-222222222222",
  "title": "Updated Conversation Title",
  "message_count": 15,
  "last_message_at": "2025-01-15T10:30:00.000000Z",
  "created_at": "2025-01-15T09:00:00.000000Z",
  "updated_at": "2025-01-15T11:00:00.000000Z",
  "metadata": {
    "source": "web",
    "user_id": "user-123"
  }
}

Delete Conversation

Deletes a conversation by ID using DELETE /v1.0/tenants/[tenant-guid]/assistant/conversations/[conversation-id]. This permanently removes the conversation and all associated messages.

Request Parameters

  • conversation-id (string, Path, Required): ID of the conversation to delete

Note: Deleting a conversation removes it permanently. This action cannot be undone.

curl --location --request DELETE 'http://localhost:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/assistant/conversations/abc123-def456-ghi789' \
--header 'Authorization: ••••••'
import { ViewAssistantSdk } from "view-sdk";

const api = new ViewAssistantSdk(
  "http://localhost:8000/", //endpoint
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default" //access key
);

const deleteConversation = async () => {
  try {
    const response = await api.Conversation.delete("abc123-def456-ghi789");
    console.log(response, "Conversation deleted successfully");
  } catch (err) {
    console.log("Error deleting conversation:", err);
  }
};

deleteConversation();
import view_sdk
from view_sdk import assistant
from view_sdk.sdk_configuration import Service

sdk = view_sdk.configure(
    access_key="default",
    base_url="localhost",
    tenant_guid="00000000-0000-0000-0000-000000000000",
    service_ports={Service.DEFAULT: 8000},
)

def deleteConversation():
    result = assistant.Conversation.delete("abc123-def456-ghi789")
    print("Deleted Conversation:", result)

deleteConversation()
using View.Sdk;
using View.Sdk.Assistant;

ViewAssistantSdk sdk = new ViewAssistantSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"), 
                                            "default", 
                                            "http://localhost:8000/");

bool deleted = await sdk.Conversation.Delete("abc123-def456-ghi789");

Response

Returns true on successful deletion, or a 404 Not Found error if the conversation doesn't exist.

Read Messages

Retrieves messages from a conversation using GET /v1.0/tenants/[tenant-guid]/assistant/conversations/[conversation-id]/messages. Returns paginated messages with optional superseded message filtering.

Request Parameters

  • conversation-id (string, Path, Required): ID of the conversation to retrieve messages from
  • limit (number, Query, Optional): Number of messages to retrieve (default: 100)
  • offset (number, Query, Optional): Offset for message pagination (default: 0)
  • include_superseded (boolean, Query, Optional): Whether to include superseded messages (default: false)
curl --location 'http://localhost:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/assistant/conversations/abc123-def456-ghi789/messages?limit=100&offset=0&include_superseded=false' \
--header 'Authorization: ••••••'
import { ViewAssistantSdk } from "view-sdk";

const api = new ViewAssistantSdk(
  "http://localhost:8000/", //endpoint
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default" //access key
);

const readMessages = async () => {
  try {
    const response = await api.Conversation.readMessages(
      "abc123-def456-ghi789",
      100, // messagesLimit
      0,   // messagesOffset
      false // includeSuperseded
    );
    console.log(response, "Messages fetched successfully");
  } catch (err) {
    console.log("Error fetching messages:", err);
  }
};

readMessages();
import view_sdk
from view_sdk import assistant
from view_sdk.sdk_configuration import Service

sdk = view_sdk.configure(
    access_key="default",
    base_url="localhost",
    tenant_guid="00000000-0000-0000-0000-000000000000",
    service_ports={Service.DEFAULT: 8000},
)

def readMessages():
    messages = assistant.Conversation.read_messages(
        conversation_id="abc123-def456-ghi789",
        messages_limit=100,
        messages_offset=0,
        include_superseded=False
    )
    print("Messages:")
    print(messages)

readMessages()
using View.Sdk;
using View.Sdk.Assistant;

ViewAssistantSdk sdk = new ViewAssistantSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"), 
                                            "default", 
                                            "http://localhost:8000/");

ReadMessagesResponse[] response = await sdk.Conversation.ReadMessages(
    "abc123-def456-ghi789",
    messagesLimit: 100,
    messagesOffset: 0,
    includeSuperseded: false
);

Response

Returns paginated messages from the conversation:

{
  "messages": [
    {
      "message_id": "msg-001",
      "role": "user",
      "content": "Hello, I need help with my project.",
      "created_at": "2025-01-15T09:00:00.000000Z"
    },
    {
      "message_id": "msg-002",
      "role": "assistant",
      "content": "I'd be happy to help you with your project. What specific aspects would you like to discuss?",
      "created_at": "2025-01-15T09:00:15.000000Z"
    }
  ],
  "total": 15,
  "limit": 100,
  "offset": 0
}

Add Messages

Adds a new message to a conversation using POST /v1.0/tenants/[tenant-guid]/assistant/conversations/[conversation-id]/messages. This endpoint supports streaming responses for real-time AI interactions.

Request Parameters

  • conversation-id (string, Path, Required): ID of the conversation to add the message to
  • message (string, Required): The message content to send
  • documents (any, Optional): Documents to attach to the message

Request Body

{
  "message": "Can you help me understand the requirements?",
  "documents": null
}
curl --location --request POST 'http://localhost:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/assistant/conversations/abc123-def456-ghi789/messages' \
--header 'content-type: application/json' \
--header 'Authorization: ••••••' \
--data '{
    "message": "Can you help me understand the requirements?",
    "documents": null
}'
import { ViewAssistantSdk } from "view-sdk";

const api = new ViewAssistantSdk(
  "http://localhost:8000/", //endpoint
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default" //access key
);

const addMessage = async () => {
  try {
    const response = await api.Conversation.addMessages(
      "abc123-def456-ghi789",
      {
        message: "Can you help me understand the requirements?",
        documents: null
      },
      (token) => {
        // Handle streaming tokens
        console.log("Token:", token);
      }
    );
    console.log(response, "Message added successfully");
  } catch (err) {
    console.log("Error adding message:", err);
  }
};

addMessage();
import view_sdk
from view_sdk import assistant
from view_sdk.sdk_configuration import Service

sdk = view_sdk.configure(
    access_key="default",
    base_url="localhost",
    tenant_guid="00000000-0000-0000-0000-000000000000",
    service_ports={Service.DEFAULT: 8000},
)

def addMessage():
    def on_token(token):
        # Handle streaming tokens
        print("Token:", token)
    
    message = assistant.Conversation.add_messages(
        conversation_id="abc123-def456-ghi789",
        message="Can you help me understand the requirements?",
        documents=None,
        on_token=on_token
    )
    print("Added Message:")
    print(message)

addMessage()
using View.Sdk;
using View.Sdk.Assistant;

ViewAssistantSdk sdk = new ViewAssistantSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"), 
                                            "default", 
                                            "http://localhost:8000/");

AddMessagesRequest request = new AddMessagesRequest
{
    message = "Can you help me understand the requirements?",
    documents = null
};

ConversationMessage message = await sdk.Conversation.AddMessages(
    "abc123-def456-ghi789",
    request,
    (token) => {
        // Handle streaming tokens
        Console.WriteLine("Token: {0}", token);
    }
);

Response

Returns the added message with streaming support:

{
  "message_id": "msg-003",
  "role": "user",
  "content": "Can you help me understand the requirements?",
  "created_at": "2025-01-15T10:45:00.000000Z"
}

Note: This endpoint supports streaming responses. Tokens are delivered incrementally via the onToken callback function.

Update Messages

Updates an existing message in a conversation using PATCH /v1.0/tenants/[tenant-guid]/assistant/conversations/[conversation-id]/messages/[message-id]. This endpoint supports streaming responses for updated AI interactions.

Request Parameters

  • conversation-id (string, Path, Required): ID of the conversation containing the message
  • message-id (string, Path, Required): ID of the message to update
  • message (string, Required): Updated message content
  • documents (any, Optional): Updated documents to attach

Request Body

{
  "message": "Updated message content",
  "documents": null
}
curl --location --request PATCH 'http://localhost:8000/v1.0/tenants/00000000-0000-0000-0000-000000000000/assistant/conversations/abc123-def456-ghi789/messages/msg-003' \
--header 'content-type: application/json' \
--header 'Authorization: ••••••' \
--data '{
    "message": "Updated message content",
    "documents": null
}'
import { ViewAssistantSdk } from "view-sdk";

const api = new ViewAssistantSdk(
  "http://localhost:8000/", //endpoint
  "00000000-0000-0000-0000-000000000000", //tenant Id
  "default" //access key
);

const updateMessage = async () => {
  try {
    const response = await api.Conversation.updateMessages(
      "abc123-def456-ghi789",
      "msg-003",
      {
        message: "Updated message content",
        documents: null
      },
      (token) => {
        // Handle streaming tokens
        console.log("Token:", token);
      }
    );
    console.log(response, "Message updated successfully");
  } catch (err) {
    console.log("Error updating message:", err);
  }
};

updateMessage();
import view_sdk
from view_sdk import assistant
from view_sdk.sdk_configuration import Service

sdk = view_sdk.configure(
    access_key="default",
    base_url="localhost",
    tenant_guid="00000000-0000-0000-0000-000000000000",
    service_ports={Service.DEFAULT: 8000},
)

def updateMessage():
    def on_token(token):
        # Handle streaming tokens
        print("Token:", token)
    
    message = assistant.Conversation.update_messages(
        conversation_id="abc123-def456-ghi789",
        message_id="msg-003",
        message="Updated message content",
        documents=None,
        on_token=on_token
    )
    print("Updated Message:")
    print(message)

updateMessage()
using View.Sdk;
using View.Sdk.Assistant;

ViewAssistantSdk sdk = new ViewAssistantSdk(Guid.Parse("00000000-0000-0000-0000-000000000000"), 
                                            "default", 
                                            "http://localhost:8000/");

AddMessagesRequest request = new AddMessagesRequest
{
    message = "Updated message content",
    documents = null
};

ConversationMessage message = await sdk.Conversation.UpdateMessages(
    "abc123-def456-ghi789",
    "msg-003",
    request,
    (token) => {
        // Handle streaming tokens
        Console.WriteLine("Token: {0}", token);
    }
);

Response

Returns the updated message with streaming support:

{
  "message_id": "msg-003",
  "role": "user",
  "content": "Updated message content",
  "updated_at": "2025-01-15T10:50:00.000000Z",
  "created_at": "2025-01-15T10:45:00.000000Z"
}

Note: This endpoint supports streaming responses. Tokens are delivered incrementally via the onToken callback function.

Best Practices

When managing conversations and messages in the View Assistant platform, consider the following recommendations for optimal AI interaction and conversation management:

  • Conversation Organization: Use descriptive titles to clearly identify the purpose and context of each conversation
  • Pagination: Utilize limit and offset parameters effectively to manage large conversation and message lists
  • Streaming: Implement proper token handling for real-time user experiences when using streaming endpoints
  • Metadata Management: Use metadata fields to track conversation sources, user context, and application-specific information
  • Message Lifecycle: Understand superseded messages and use include_superseded parameter appropriately when needed
  • Error Handling: Implement robust error handling for network issues, authentication failures, and API rate limits
  • Performance: Monitor conversation message counts and consider archiving or cleanup strategies for long-running conversations
  • Document Attachments: Properly manage document attachments to optimize conversation context and AI responses

Next Steps

After successfully managing conversations and messages, you can:

  • AI Integration: Leverage conversations for integrated AI assistant features in your applications
  • Conversation Analytics: Analyze conversation patterns and message interactions for insights
  • User Experience: Build real-time chat interfaces using streaming message responses
  • Document Management: Integrate document attachments for enhanced AI context and responses
  • Multi-Conversation Management: Organize and manage multiple concurrent conversations per user
  • Platform Integration: Integrate conversations with other View platform services for comprehensive AI workflows