Table of Contents

Streaming chat completion

This action defines an Anthropic streaming chat completion model that processes a prompt and delivers the response in small pieces as it is generated. Using a streaming chat completion improves responsiveness and gives the user real-time insight into the model’s output as it forms.

It's typically used when building backends for interactive chat clients, assistant-like experiences, or any UI that needs incremental model output.
Unlike the standard chat completion, this action returns the response incrementally as it is generated.

Anthropic Streaming Chat Completion

Example Example
The Flow above shows how to provide real-time completions to a chat client. External data sources may be added — for example vector search for RAG or a chat history store — to give the model additional context and support follow-up questions.


Properties

Name Required Description
Title No The title of the action.
Connection Yes Defines the connection to Anthropic. The connection provides the API key needed to access Anthropic models.
Model Id Yes The Anthropic model ID you want to use (e.g., claude-3-5-sonnet-latest).
System Prompt No High-level instructions that define the model’s behavior, tone, and response rules.
User Prompt Yes The user message that the model responds to.
History No Previous messages in the conversation. Helps the model maintain context and continuity.
Context No Additional information injected into the prompt, often used with RAG to improve accuracy. Supports plain text or vector search results.
Prompt Template No Defines the final prompt structure. The placeholders @@context and @@userPrompt are automatically replaced with their values.
Temperature No Controls the randomness of the output. Lower values produce more deterministic responses, while higher values generate more varied results.
Max Completion Tokens Yes Maximum number of tokens the model can generate in its response.
Stream Variable Name No The variable that receives each streamed message chunk during generation. Default: message.
Result Variable Name No Stores the final combined response after streaming completes. Default: response.
Enable Grounding No Enables web search to improve factual accuracy using external or structured context.
Enable Web Fetch No Allows the model to retrieve information from the web when generating responses.
Disabled No If enabled, the action is skipped during flow execution.
Description No Additional notes or explanation for the action.

Returns

An AIChatCompletionResponse (Profitbase.Flow.Extensions.AI.AIChatCompletionResponse).


Prompt template

The Prompt Template defines how the message sent to Anthropic should be structured.
It is useful when you want strict formatting or when combining user input with retrieved context.

The following placeholders are available:

  • @@context — replaced with the Context value
  • @@userPrompt — replaced with the User Prompt value

Before submitting the request, the system merges all template elements into a single final prompt.