You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running the DocAnalysis object with the run method (Claude model), the response omits the 'stopReason' key, which explains why the generation stopped. In the invoke_model_json() function of the Invocations class, only the tokens ('usage') and the message (["content"][0]["text"]) are returned.
Update the invoke_model_json() function to include the 'stopReason' key in the response, making it clear why the generation process terminated.
Log additional metadata about the generation process outside the invoke_model_json() function.
Implement a debugging mechanism to track and report the stop reason.
Adding the 'stopReason' key is crucial for understanding issues like model constraints or input limits. This would simplify troubleshooting and enhance the DocAnalysis object's transparency and usability.
For example the complete response is {'id': 'msg_bdrk_01TENLiZQPoT8XpLTdkmwXjs', 'type': 'message', 'role': 'assistant', 'model': 'claude-3-sonnet-20240229', 'content': [{'type': 'text', 'text': '```json\n[\n {\n "page": 1,\n "detected_languages": ["Italian"],\n "content": "26/09/2024"\n }\n]\n```'}], 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 1991, 'output_tokens': 48}}
And the output of the function 'run' is: {'output': [{'page': 1, 'detected_languages': ['Italian'], 'content': '26/09/2024'}], 'token_usage': {'input_tokens': 1991, 'output_tokens': 48}}
The text was updated successfully, but these errors were encountered:
When running the DocAnalysis object with the run method (Claude model), the response omits the 'stopReason' key, which explains why the generation stopped. In the invoke_model_json() function of the Invocations class, only the tokens ('usage') and the message (["content"][0]["text"]) are returned.
Update the invoke_model_json() function to include the 'stopReason' key in the response, making it clear why the generation process terminated.
Log additional metadata about the generation process outside the invoke_model_json() function.
Implement a debugging mechanism to track and report the stop reason.
Adding the 'stopReason' key is crucial for understanding issues like model constraints or input limits. This would simplify troubleshooting and enhance the DocAnalysis object's transparency and usability.
For example the complete response is
{'id': 'msg_bdrk_01TENLiZQPoT8XpLTdkmwXjs', 'type': 'message', 'role': 'assistant', 'model': 'claude-3-sonnet-20240229', 'content': [{'type': 'text', 'text': '```json\n[\n {\n "page": 1,\n "detected_languages": ["Italian"],\n "content": "26/09/2024"\n }\n]\n```'}], 'stop_reason': 'end_turn', 'stop_sequence': None, 'usage': {'input_tokens': 1991, 'output_tokens': 48}}
And the output of the function 'run' is:
{'output': [{'page': 1, 'detected_languages': ['Italian'], 'content': '26/09/2024'}], 'token_usage': {'input_tokens': 1991, 'output_tokens': 48}}
The text was updated successfully, but these errors were encountered: