Find answers from the community

Updated last year

Templates

Hi I am migrating my code to newest llama index version and getting an error ValueError: Invalid message type: <class 'langchain.schema.messages.SystemMessage'>

I believe this is due to the query_engine = index.as_query_engine(text_qa_template=CHAT_QA_PROMPT, refine_template=CHAT_REFINE_PROMPT I assume this is outdated code. What would be the newer way of doing this? (see screenshot) thank you! πŸ‘ @Logan M
Attachment
Snimek_obrazovky_2023-07-05_210018.png
L
M
10 comments
I think I have an idea of the issue, but can you share the full error/traceback? Just want to confirm
Yes, here is the full log. When I remove text_qa_template=CHAT_QA_PROMPT I don't get the error and the code works.
Attachment
Snimek_obrazovky_2023-07-05_210428.png
and this is the code
Attachment
Snimek_obrazovky_2023-07-05_210654.png
Ah, this is a bug on our end. You can see the function here does not consider the system prompt type

https://github.com/jerryjliu/llama_index/blob/bbe6cfb899bb78359c6b2f3edc023fb99a042da9/llama_index/llms/langchain_utils.py#L86

I think I know a work around though, will test in about 10 minutes once I'm back at my computer lol
oh i see interesting πŸ‘€ sure no problem, take your time no rush!
hmm, nah I don't see an easy workaround. BUT I can make a PR. Should get merged pretty quickly, and then you can install from source to get the fix before it hits pypi πŸ™
okayy thank you!πŸ™
PR is merged!
oh wow that was fast, thank you! πŸ™‚
Add a reply
Sign up and join the conversation on Discord