系統 - OpenAI - 解決JSON Validation Error: 'thoughts' is a required property問題



參考資訊:
https://github.com/Significant-Gravitas/AutoGPT/issues/4752

問題:

Error parsing JSON response with literal_eval malformed node or string on line 35:   
JSON Validation Error: 'thoughts' is a required property

Failed validating 'required' in schema:
    {'$schema': 'http://json-schema.org/draft-07/schema#',
     'additionalProperties': False,
     'properties': {'command': {'additionalProperties': False,
                                'properties': {'args': {'type': 'object'},
                                               'name': {'type': 'string'}},
                                'required': ['name', 'args'],
                                'type': 'object'},
                    'thoughts': {'additionalProperties': False,
                                 'properties': {'criticism': {'description': 'constructive '
                                                                             'self-criticism',
                                                              'type': 'string'},
                                                'plan': {'description': '- '
                                                                        'short '
                                                                        'bulleted\n'
                                                                        '- '
                                                                        'list '
                                                                        'that '
                                                                        'conveys\n'
                                                                        '- '
                                                                        'long-term '
                                                                        'plan',
                                                         'type': 'string'},
                                                'reasoning': {'type': 'string'},
                                                'speak': {'description': 'thoughts '
                                                                         'summary '
                                                                         'to '
                                                                         'say '
                                                                         'to '
                                                                         'user',
                                                          'type': 'string'},
                                                'text': {'description': 'thoughts',
                                                         'type': 'string'}},
                                 'required': ['text',
                                              'reasoning',
                                              'plan',
                                              'criticism',
                                              'speak'],
                                 'type': 'object'}},
     'required': ['thoughts', 'command'],
     'type': 'object'}

On instance:
    {}  
JSON Validation Error: 'command' is a required property

Failed validating 'required' in schema:
    {'$schema': 'http://json-schema.org/draft-07/schema#',
     'additionalProperties': False,
     'properties': {'command': {'additionalProperties': False,
                                'properties': {'args': {'type': 'object'},
                                               'name': {'type': 'string'}},
                                'required': ['name', 'args'],
                                'type': 'object'},
                    'thoughts': {'additionalProperties': False,
                                 'properties': {'criticism': {'description': 'constructive '
                                                                             'self-criticism',
                                                              'type': 'string'},
                                                'plan': {'description': '- '
                                                                        'short '
                                                                        'bulleted\n'
                                                                        '- '
                                                                        'list '
                                                                        'that '
                                                                        'conveys\n'
                                                                        '- '
                                                                        'long-term '
                                                                        'plan',
                                                         'type': 'string'},
                                                'reasoning': {'type': 'string'},
                                                'speak': {'description': 'thoughts '
                                                                         'summary '
                                                                         'to '
                                                                         'say '
                                                                         'to '
                                                                         'user',
                                                          'type': 'string'},
                                                'text': {'description': 'thoughts',
                                                         'type': 'string'}},
                                 'required': ['text',
                                              'reasoning',
                                              'plan',
                                              'criticism',
                                              'speak'],
                                 'type': 'object'}},
     'required': ['thoughts', 'command'],
     'type': 'object'}

On instance:
    {} 

解法:問題存在於v0.4.1,如果要做CVE測試建議更換成v0.4.0