跳到主要内容

NebulaAIFlow提示词组件

提示词是一种结构化的输入,用于指导语言模型如何处理用户输入和变量。

提示词组件创建带有自定义字段和动态变量的提示词模板,为您的模型提供结构化、可重复的提示。

提示词是自然语言和使用大括号创建的变量的组合。

在流程中使用提示词组件

快速入门中可以找到修改提示词的示例,其中基本的聊天机器人流程扩展为包含完整的向量RAG管道。

提示词组件中的默认提示是像GenAI专家一样回答用户,热情地帮助他们开始构建新的东西。

这个提示为您的LLM聊天交互创建了一个"个性",但它不包含在创建提示词模板时可能有用的变量。

To modify the prompt template, in the Prompt component, click the Template field. For example, the {context} variable gives the LLM model access to embedded vector data to return better answers.


_10
Given the context
_10
{context}
_10
Answer the question
_10
{user_question}

When variables are added to a prompt template, new fields are automatically created in the component. These fields can be connected to receive text input from other components to automate prompting, or to output instructions to other components. An example of prompts controlling agents behavior is available in the sequential tasks agent starter flow.

Inputs

NameDisplay NameInfo
templateTemplateCreate a prompt template with dynamic variables.

Outputs

NameDisplay NameInfo
promptPrompt MessageThe built prompt message returned by the build_prompt method.

Langchain Hub Prompt Template

This component fetches prompts from the Langchain Hub.

When a prompt is loaded, the component generates input fields for custom variables. For example, the default prompt "efriis/my-first-prompt" generates fields for profession and question.

Inputs

NameDisplay NameInfo
langchain_api_keyYour LangChain API KeyThe LangChain API Key to use.
langchain_hub_promptLangChain Hub PromptThe LangChain Hub prompt to use.

Outputs

NameDisplay NameInfo
promptBuild PromptThe built prompt message returned by the build_prompt method.