New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Output Parser Exception for Tagging UseCase #18906
Comments
Hi @yadavalok1 Which model are you using ? So, I recommend you to use a chat model instead of llm |
Hi @maximeperrindev , I am using AzureOpenAI, I will try using AzureChatOpenAI and confirm you here if it works for me. |
Still getting the same error with AzureChatOpenAI, is there any workaround for this because I am directly using the tagging usecase code from the langchain repo and it seems to be not working. My requirement is that , whenever a conversation starts I need to collect some required info from the user like personal details and once all required data are provided then only, I can help the user with it's query/questions. Also I need to store the collected also in some memory so the AI should know the context of it. So, it will be really helpful if you can suggest something or something like this is already. Thanks!! |
@yadavalok1, from langchain_openai import AzureChatOpenAI
from langchain.chains import create_tagging_chain
schema = {
"properties": {
"sentiment": {"type": "string"},
"aggressiveness": {"type": "integer"},
"language": {"type": "string"},
}
}
chain = create_tagging_chain(schema,AzureChatOpenAI(
azure_deployment="gpt-4-32k",
openai_api_version="2023-05-15",
))
test_string = "Hey there!! We are going to celerate john's birthday. Suggest some celebration idea."
res = chain.invoke(test_string)
print(res) |
Thanks @maximeperrindev . I tried this but no luck , still facing the same error. Tried in different machine as well but same error. I hope this is not related to the model as I am using gpt35. |
Checked other resources
Example Code
schema = {
"properties": {
"sentiment": {"type": "string"},
"aggressiveness": {"type": "integer"},
"language": {"type": "string"},
}
}
chain = create_tagging_chain(schema, model)
test_string = "Hey there!! We are going to celerate john's birthday. Suggest some celebration idea."
res = chain.invoke(test_string)
Error Message and Stack Trace (if applicable)
File "/python3.11/site-packages/langchain/chains/llm.py", line 104, in _call
return self.create_outputs(response)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python3.11/site-packages/langchain/chains/llm.py", line 258, in create_outputs
result = [
^
File "/python3.11/site-packages/langchain/chains/llm.py", line 261, in
self.output_key: self.output_parser.parse_result(generation),
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/python3.11/site-packages/langchain_core/output_parsers/openai_functions.py", line 102, in parse_result
raise OutputParserException(
langchain_core.exceptions.OutputParserException: Could not parse function call data: Expecting property name enclosed in double quotes: line 2 column 3 (char 4)
Description
System Info
System Information
Package Information
Packages not installed (Not Necessarily a Problem)
The following packages were not found:
The text was updated successfully, but these errors were encountered: