📖Advanced Usage
Template Customization: The system allows seamless modification of prompt templates tailored for distinct use cases. The templates are of the type PromptTemplate
which can be imported from the langchain
module.
Simple Chat Prompt Template (
simple_chat_prompt_template
): Template for straightforward conversational prompts. The simple_chat_prompt_template should have a single {query} and {history} placeholders.Contextual Chat Prompt Template (
contextual_chat_prompt_template
): Template catering to prompts within a specific context. The contextual_chat_prompt_template should have a single {query}, {history}, and {context} placeholders.Contextual QA Prompt Template (
contextual_qa_prompt_template
): Templates designed for prompts related to contextual questions and answers. The contextual_qa_prompt_template should have a single {query} and {context} placeholders.Validation Prompt Template (
validation_prompt_template
): Templates utilized to validate prompts. The validation_prompt_template should have a single {text} and {format_instructions} placeholder.
Example:
Validation Control: The "should_validate" parameter can be adjusted based on the requirement.
If set to 'true', the user query undergoes validation to ensure safety, and the template is returned.
If set to 'false', the user query bypasses the validation process, and a value error is thrown.
Example:
API References:
validate_prompt()
validate_prompt()
Input:
text
: String
Output:
get_prompt_template()
get_prompt_template()
Input:
promptType
: PromptTypeEnumQuery
: String
Output:
PromptTemplate
Last updated