WelcomeTextGenerator
Generate an uppercase welcome message from a name stringโa minimal example component that demonstrates how to build a custom Haystack component.
Key Featuresโ
- Accepts a
namestring and returns a personalized, uppercase greeting. - Returns a second output (
note) confirming the message is ready. - Requires no credentials or external services.
- Demonstrates the
@componentdecorator and@component.output_typespattern. - Can be used in any pipeline that needs a simple text transformation step.
Configurationโ
No credentials or environment variables are required for this component.
- Drag the
WelcomeTextGeneratorcomponent onto the canvas from the Component Library. - Click on the component to open the configuration panel.
- No additional settings are required.
Connectionsโ
WelcomeTextGenerator receives a name string. It outputs a welcome_text string (the greeting in uppercase) and a note string confirming the message is ready. Connect the welcome_text output to a prompt builder or any component that expects a text string.
Source Codeโ
To check this component's source code, open context_prompt.py in the Haystack Core Integrations repository.
Usage Examplesโ
Basic Configurationโ
WelcomeTextGenerator:
type: haystack_integrations.prompts.github.context_prompt.WelcomeTextGenerator
init_parameters: {}
Using the Component in a Pipelineโ
This example shows a pipeline that accepts a name from the input and returns a welcome message.
# haystack-pipeline
components:
welcome_generator:
type: haystack_integrations.prompts.github.context_prompt.WelcomeTextGenerator
init_parameters: {}
connections: []
inputs:
query:
- welcome_generator.name
outputs:
welcome_text: welcome_generator.welcome_text
max_runs_per_component: 100
metadata: {}
Parametersโ
Inputsโ
| Parameter | Type | Description |
|---|---|---|
name | str | The name to include in the welcome message. |
Outputsโ
| Parameter | Type | Description |
|---|---|---|
welcome_text | str | Personalized greeting in uppercase (for example, HELLO ALICE, WELCOME TO HAYSTACK!). |
note | str | A confirmation string: welcome message is ready. |
Init Parametersโ
This component has no init parameters.
Related Informationโ
Was this page helpful?