langgenius / dify

Dify is an open-source LLM app development platform. Dify's intuitive interface combines AI workflow, RAG pipeline, agent capabilities, model management, observability features and more, letting you quickly go from prototype to production.
https://dify.ai
Other
52.6k stars 7.69k forks source link

Parameter extractor reported an error #10934

Closed cuihaojie24 closed 4 days ago

cuihaojie24 commented 4 days ago

Self Checks

Provide a description of requested docs changes

I refer to the documentation, but the result is different from the documentation, the error message is as follows: Error: 3 validation errors for AssistantPromptMessage content.str Input should be a valid string [type=string_type, input_value=[{'text': '{"query": "2405.10739"}'}], input_type=list] For further information visit https://errors.pydantic.dev/2.9/v/string_type content.list[PromptMessageContent].0.type Field required [type=missing, input_value={'text': '{"query": "2405.10739"}'}, input_type=dict] For further information visit https://errors.pydantic.dev/2.9/v/missing content.list[PromptMessageContent].0.data Field required [type=missing, input_value={'text': '{"query": "2405.10739"}'}, input_type=dict] For further information visit https://errors.pydantic.dev/2.9/v/missing

dosubot[bot] commented 4 days ago

@cuihaojie24 Hello there! I'm here to help you with bugs, answer questions, and guide you on becoming a contributor. Let's work together to resolve the issue you're facing.

The error you're encountering with the AssistantPromptMessage suggests that there are issues with the structure and data types of the input being validated by Pydantic. Here are the key points to address:

  1. String Type Error: The error indicates that the content.str field expects a valid string, but it received a list instead. Ensure that the content field is a string, not a list or any other data type.

  2. Missing Fields: The errors for content.list[PromptMessageContent].0.type and content.list[PromptMessageContent].0.data indicate that these fields are required but missing. Make sure that each PromptMessageContent object includes the type and data fields with appropriate values.

To resolve these issues, review the structure of your AssistantPromptMessage input and ensure it aligns with the expected format. Each PromptMessageContent should be a dictionary containing the necessary fields, and the content should be a string if that's what the validation expects. Adjust your input data accordingly to meet these requirements.

To continue talking to Dosu, mention @dosu.

crazywoola commented 4 days ago

Please open this as a bug report. Also we need to check the version you are using.