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

Claude sometimes returns no JSON #24

Closed
timpaul opened this issue May 1, 2024 · 3 comments
Closed

Claude sometimes returns no JSON #24

timpaul opened this issue May 1, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@timpaul
Copy link
Owner

timpaul commented May 1, 2024

This happens with images that it's previously had no problem parsing.

When you inspect the returned message, instead of the JSON specified by the tool, you get something like this

"image": "https://s3.amazonaws.com/openai-assets/d9c2c3e4f0fb1c15f05d982f30622844"

Following that URL sends you to the following XML error:

<Error>
<script/>
<Code>PermanentRedirect</Code>
<Message>The bucket you are attempting to access must be addressed using the specified endpoint. Please send all future requests to this endpoint.</Message>
<Endpoint>openai-assets.s3.amazonaws.com</Endpoint>
<Bucket>openai-assets</Bucket>
<RequestId>8TASA3S5ZA1PC3KS</RequestId>
<HostId>VZ6EIZdw1rAtMEIwnW5ZcqVRdmtyoIzaXLcKblm/6yXVqvR9tXBC/5vWVrdXiNUsYb2RwSuenfo=</HostId>
</Error>
@timpaul timpaul added the bug Something isn't working label May 1, 2024
@timpaul
Copy link
Owner Author

timpaul commented May 2, 2024

Update - I sometimes also just get some empty JSON. I'm pretty sure it's unrelated to any changes I've made, or the images I'm using. So perhaps it's the Claude API being flaky?

@timpaul
Copy link
Owner Author

timpaul commented May 2, 2024

image

You can see here that it's processing the image enough to recognise that it's a form and it should use the tool - it's specifically the tool use that seems to be failing (that empty 'input' key). More often than not right now.

@timpaul timpaul self-assigned this May 5, 2024
@timpaul
Copy link
Owner Author

timpaul commented May 5, 2024

I think I might have fixed this.

As the tool was returning empty JSON, I added some required elements to the schema, eg:

"required": ["id", "question_text", "answer_type"]

This seems to have sorted it.

It seemed to work fine before, so perhaps Anthropic updated tool use to be more fussy.

@timpaul timpaul closed this as completed May 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant