Issue: Getting error while using ChatPromptTemplate
Labels: name: auto:bug, name: area: models

### Issue you'd like to raise.

`def generate_custom_prompt(new_project_qa,query,name,not_uuid):  
    check = query.lower() 
    result = new_project_qa(query)
    relevant_document = result['source_documents']
    context_text="\n\n---\n\n".join([doc.page_content for doc in relevant_document])
    user_experience_inst = UserExperience.objects.get(not_uuid=not_uuid)
    greetings = ['hi', 'hello', 'hey', 'hui', 'hiiii', 'hii', 'hiii', 'heyyy']
    if check in greetings:
        custom_prompt_template = f"""
        Just simply reply with "Hello {name}! How can I assist you today?"
        """
    elif check not in greetings and user_experience_inst.custom_prompt:
        custom_prompt_template = f"""You are a chatbot designed to provide answers to User's Questions, delimited by triple backticks.
        Generate your answer to match the user's requirements: {user_experience_inst.custom_prompt}

        If you encounter a question for which you don't know the answer, please respond with 'I don't know' and refrain from making up an answer.
        - Before saying 'I don't know,' please re-verify your vector store to ensure the answer is not present in the database.

        Remember, your goal is to assist the user in the best way possible. If the question is unclear or ambiguous, feel free to ask for clarification.

        User's Question: ```{check}```
        AI Answer:"""
    else:
        # Create the custom prompt template
        custom_prompt_template = f"""Answer the question based only on following context: ```{context_text} ```
        You are a chatbot designed to provide answers in details to User's Question: ```{check} ``` which is delimited by triple backticks.
        Generate your answer in points in the following format:

        1. Point no 1
            1.1 Its subpoint in details
            1.2 More information if needed.
        2. Point no 2
            2.1 Its subpoint in details
            2.2 More information if needed.
        …
        N. Another main point.

        If you encounter a question for which you don't know the answer based on the predefined points, please respond with 'I don't know' and refrain from making up an answer.
        However, if the answer is not present in the predefined points,then Provide comprehensive information related to the user's query.
        Remember, your goal is to assist the user in the best way possible. If the question is unclear or ambiguous, you can ask for clarification.

        User's Question: ```{check} ```  
        AI Answer:"""

    # Create the PromptTemplate
    custom_prompt = ChatPromptTemplate(
        template=custom_prompt_template, input_variables=["check","context_text"]
    )
    formatted_prompt = custom_prompt.format()
    return formatted_prompt
`
#below is the error I am getting
Traceback (most recent call last):
  File "/home/hs/env/lib/python3.8/site-packages/django/core/handlers/exception.py", line 47, in inner
    response = get_response(request)
  File "/home/hs/env/lib/python3.8/site-packages/django/core/handlers/base.py", line 181, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/hs/CustomBot/chatbot/views.py", line 366, in GetChatResponse
    custom_message=generate_custom_prompt(chat_qa,query,name,not_uuid)
  File "/home/hs/CustomBot/accounts/common_langcain_qa.py", line 70, in generate_custom_prompt
    custom_prompt = ChatPromptTemplate(
  File "/home/hs/env/lib/python3.8/site-packages/langchain_core/load/serializable.py", line 97, in __init__
    super().__init__(**kwargs)
  File "pydantic/main.py", line 339, in pydantic.main.BaseModel.__init__
  File "pydantic/main.py", line 1050, in pydantic.main.validate_model
  File "/home/hs/env/lib/python3.8/site-packages/langchain_core/prompts/chat.py", line 449, in validate_input_variables
    messages = values["messages"]
KeyError: 'messages'

### Suggestion:

_No response_