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

Don't choke on Azure OpenAI content filtering metadata #429

Closed
laszlovandenhoek opened this issue Dec 28, 2023 · 0 comments
Closed

Don't choke on Azure OpenAI content filtering metadata #429

laszlovandenhoek opened this issue Dec 28, 2023 · 0 comments

Comments

@laszlovandenhoek
Copy link
Contributor

On Azure OpenAI, when streaming responses, the first chat completion chunk may contain an empty choices[] array, and instead only contains information about filtered categories:

{"id":"","choices":[],"created":0,"model":"","object":"","system_fingerprint":null,"prompt_filter_results":[{"prompt_index":0,"content_filter_results":{"hate":{"filtered":false,"severity":"safe"},"self_harm":{"filtered":false,"severity":"safe"},"sexual":{"filtered":false,"severity":"safe"},"violence":{"filtered":false,"severity":"safe"}}}]}

This is the same issue as microsoft/semantic-kernel#3650.

Directly indexing into chunk.choices[0], as the Mentat code currently does, naturally causes an IndexError: list index out of range.

I'll submit a PR to rectify this shortly.

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