Closed lavrenalex closed 3 months ago
Using gpt-3.5-turbo
it gives no such error. Since you are using a mistral model, have you tried using a ChatMistralAI
chat model instead of ChatOpenAI
? An example notebook is provided here
I tried it as well:
chat = ChatMistralAI(mistral_api_key=token, endpoint=url)
messages = [HumanMessage(content="knock knock")]
results = chat.invoke(messages)
Response:
Status code: 422, Response: {"error":"Template error: template not found","error_type":"template_error"}
In addition to that, I've tried the vLLM as well:
chat = ChatOpenAI(
model=model,
openai_api_key="EMPTY",
openai_api_base=url,
max_tokens=5,
temperature=0,
)
messages = [
SystemMessage(
content="You are a helpful assistant that translates English to Italian."
),
HumanMessage(
content="Translate the following sentence from English to Italian: I love programming."
),
]
results = chat(messages)
Same error:
{'error': 'Template error: template not found', 'error_type': 'template_error'}
Okay, I've resolved this issue. If you're encountering the same problem, for your information, the issue lies with the Mistral Model. I've identified that the TGI version was causing the issues. Simply download a new one from the Mistral website.
Checked other resources
Example Code
Error Message and Stack Trace (if applicable)
Description
I'm encountering an issue with LangChain's OpenAI Chat integration, specifically when trying to use custom templates for dynamic chat prompts. The expected behavior is to seamlessly generate chat prompts using the specified system and human message templates, and then perform a chat session using these prompts. However, the current behavior results in an openai.UnprocessableEntityError with a template error indicating that the template was not found.
This issue arises despite following the documented approach for creating and using ChatPromptTemplate, SystemMessagePromptTemplate, and HumanMessagePromptTemplate within LangChain's framework. The error suggests there's either a problem with the template processing/handling in LangChain or a misconfiguration in the OpenAI chat integration setup.
Even when using a cURL command to interact with the model, it's still resulting in an error about a missing template.
cURL Testing
System Info
System Information
Package Information