Search code examples
pythonchatbotlangchainollama

No Attribute called verbose


Here is my code:

from langchain_core.prompts import ChatPromptTemplate
from langchain_ollama import ChatOllama

llm = ChatOllama(
    model = 'llama3.2',
    temperature = 0
)

chat_template = ChatPromptTemplate.from_messages(
    [
        ('system', "you have to give two line definition of the word given by user"),
        ('human', 'the word is {user_input}')
    ]
)

message = chat_template.format_messages(user_input = 'backlog')
print(message)

response = llm.invoke(message)
print(message)

And it is showing Attribute error:

AttributeError: partially initialized module 'langchain' has no attribute 'verbose' (most likely due to a circular import)

How can I fix this? I was trying to create basic word meaning chatbot using langchain.


Solution

  • You are getting this error because you have a file named langchain.py

    Please change your file name to some other name.

    Also, please refrain from naming your file names to module names, keywords, etc.

    https://github.com/langchain-ai/langchain/discussions/23071