Docs /Templates/ sinapsis-chatbots-base

TextToLLMConversation

sinapsis-chatbots-basecommunitytexttext_completion

Python template · sinapsis_chatbots_base.templates.text_to_llm_conversation

Overview

Convert TextPackets into LLMConversationPackets.

This template is useful when upstream templates generate TextPackets and downstream LLM templates expect LLMConversationPackets.

Depending on the configured mode, the template can either merge all text packets into a single conversation prompt or create one conversation packet per text packet.

Capabilities

Capabilities: not set

Installation

Install the published package using pip or uv.

Terminalbash
pip install sinapsis-chatbots-base==1.0.0
uv pip install sinapsis-chatbots-base==1.0.0
uv add sinapsis-chatbots-base==1.0.0

Configuration

Effective fields from the inspector schema, including nested Pydantic model fields.

mode

Conversion strategy. Use ``single`` to merge all text packets into one conversation prompt or ``per_text_packet`` to create one conversation per text packet.

typing.Literal['single', 'per_text_packet']
Optional
Default: "single"
prompt
str | pathlib._local.Path
Optional
Default: ""
run_id
str | None
Optional
Default: null
user_id
str | None
Optional
Default: null
agent_id
str | None
Optional
Default: null
metadata
sinapsis_core.template_base.base_models.TemplateMetadata | None
Optional
Default: null
separator

String used to join text packet contents when ``mode="single"``.

str
Optional
Default: "\n\n--- PAGE ---\n\n"
session_id
str | None
Optional
Default: null
prompt_prefix

Optional text prepended to the generated prompt.

str
Optional
Default: ""
prompt_suffix

Optional text appended to the generated prompt.

str
Optional
Default: ""
system_prompt
str | pathlib._local.Path | None
Optional
Default: null

Configuration example

Example from the Python docstring:

yaml
agent:
  name: my_test_agent
templates
- template_name: InputTemplate
  class_name: InputTemplate
  attributes: {}
- template_name: TextToLLMConversation
  class_name: TextToLLMConversation
  template_input: InputTemplate
  attributes:
    mode: single
    prompt_prefix: 'text prepended to the generated prompt'
    prompt_suffix: 'text appended to the generated prompt'
Show schema-based configuration skeleton
yaml
templates:
  - template_name: "TextToLLMConversation"
    class_name: "TextToLLMConversation"
    attributes:
      mode: "single"
      prompt: ""
      run_id: null
      user_id: null
      agent_id: null
      separator: "\n\n--- PAGE ---\n\n"
      session_id: null
      prompt_prefix: ""
      prompt_suffix: ""
      system_prompt: null

Inheritance

Immediate parent: sinapsis_chatbots_base.templates.llm_conversation_input.LLMConversationInput

Environment variables

Environment definitions belong to their canonical Python modules.

No directly related environment variables listed.