effect-io-ai

Package: @effect/ai
Module: Prompt

Prompt.merge

Merges a prompt with additional raw input by concatenating messages.

Creates a new prompt containing all messages from both the original prompt, and the provided raw input, maintaining the order of messages.

Example

import { Prompt } from "@effect/ai"

const systemPrompt = Prompt.make([{
  role: "system",
  content: "You are a helpful assistant."
}])

const merged = Prompt.merge(systemPrompt, "Hello, world!")

Signature

declare const merge: { (input: RawInput): (self: Prompt) => Prompt; (self: Prompt, input: RawInput): Prompt; }

Source

Since v1.0.0