Skip to content

Stream Messages

client.Beta.Chat.Stream(ctx, sessionID, params) (*BetaChatStreamResponse, error)
POST/api/v1/chat/{session_id}/messages/stream

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

ParametersExpand Collapse
sessionID string
params BetaChatStreamParams
IndexIDs param.Field[[]string]

Body param: Indexes to retrieve data from.

Prompt param.Field[string]

Body param: User message for this chat turn.

maxLength1000
OrganizationID param.Field[string]optional

Query param

formatuuid
ProjectID param.Field[string]optional

Query param

formatuuid
ReturnsExpand Collapse
type BetaChatStreamResponse interface{…}

Stream Messages

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.Stream(
    context.TODO(),
    "session_id",
    llamacloudprod.BetaChatStreamParams{
      IndexIDs: []string{"idx-abc123", "idx-def456"},
      Prompt: "What were the main findings in Q3?",
    },
  )
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", response)
}
{}
Returns Examples
{}