在我的项目中使用 groq 时,我收到此错误

问题描述 投票:0回答:0
def claim_agent(user_question):
    memory = ConversationBufferWindowMemory(ai_prefix="Insurance Agent", k=20)
    prompt_template = PromptTemplate(
        input_variables=['history', 'input'],
        template="""
            You are a Insurance agent bot, you have to talk with our customers and collect all the required details to fill the claim:
            "Policy_number":
            "Cause_of_accident":
            "Contacted_Police/Fire_department":
            "Report_Number":
            "Street_number":
            "Street_name":
            "City":
            "State_Province":
            "Zip_Code":
            "Country":
            "Loss_date":
            "time":
            Make sure to ask only one at a time and also make your responses align with the customer sentiment. Make sure collect all the above data,
            After collecting all the data provide the output in a json format which has all the above mentioned values and make sure to provide the time in 24hr format and also date in American format.
            and say thank you for providing all the details our we will assign an adjuster to process the claim!.
            conversation history:
            {history}
            human:{input}
            AI:
            """
    )
    conversation_chain = LLMChain(
        llm=Llama3_8b,
        prompt=prompt_template,
        memory=memory,
    )
    query=user_question
    verification="False"
    while True:
        response = conversation_chain.invoke(query)
        print("Agent: ", response['text'])
        if '{' in response['text']:
            break
        query = input("You: ")
    data = memory.load_memory_variables({})
    conversation = []
    for key, value in data.items():
        conversation.append([key + ':' + value])
    complete_data = list(conversation[0][0].split('\n'))
    conversation_data = ''
    for i in complete_data:
        conversation_data += " " + i
    return conversation_data
User_question=input("Please enter your query: ")
claim_agent(User_question)

对于此代码,我收到如下错误: 请输入您的查询: 您好 回溯(最近一次调用最后一次): 文件“D:\Project_tests\AI Chat Agent est.py”,第 65 行,位于 索赔代理(用户问题) 文件“D:\Project_tests\AI Chat Agent est.py”,第 50 行,位于 Claim_agent 中 响应=对话链.调用(查询) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 文件“D:\Project_tests.venv\Lib\site-packages\langchai

runtime-error langchain large-language-model llama groq
© www.soinside.com 2019 - 2024. All rights reserved.