Skip to content
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

Missing 'stopReason' in the response #17

Open
rzaupa opened this issue Jan 10, 2025 · 0 comments
Open

Missing 'stopReason' in the response #17

rzaupa opened this issue Jan 10, 2025 · 0 comments

Comments

@rzaupa
Copy link

rzaupa commented Jan 10, 2025

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}}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant