Skip to content
Framework Docs

Stream Messages

JsonValue beta().chat().stream(ChatStreamParamsparams, RequestOptionsrequestOptions = RequestOptions.none())
POST/api/v1/chat/{session_id}/messages/stream

Stream agent events for a chat turn as Server-Sent Events.

ParametersExpand Collapse
ChatStreamParams params
Optional<String> sessionId
Optional<String> organizationId
Optional<String> projectId
List<String> indexIds

Indexes to retrieve data from.

String prompt

User message for this chat turn.

maxLength1000
ReturnsExpand Collapse
class ChatStreamResponse:

Stream Messages

package com.llamacloud_prod.api.example;

import com.llamacloud_prod.api.client.LlamaCloudClient;
import com.llamacloud_prod.api.client.okhttp.LlamaCloudOkHttpClient;
import com.llamacloud_prod.api.models.beta.chat.ChatStreamParams;
import com.llamacloud_prod.api.models.beta.chat.ChatStreamResponse;

public final class Main {
    private Main() {}

    public static void main(String[] args) {
        LlamaCloudClient client = LlamaCloudOkHttpClient.fromEnv();

        ChatStreamParams params = ChatStreamParams.builder()
            .sessionId("session_id")
            .addIndexId("idx-abc123")
            .addIndexId("idx-def456")
            .prompt("What were the main findings in Q3?")
            .build();
        ChatStreamResponse response = client.beta().chat().stream(params);
    }
}
{}
Returns Examples
{}