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

openai.ContentFilterFinishReasonError #722

Open
matheus-rossi opened this issue Oct 4, 2024 · 1 comment
Open

openai.ContentFilterFinishReasonError #722

matheus-rossi opened this issue Oct 4, 2024 · 1 comment

Comments

@matheus-rossi
Copy link

Describe the bug
When scraping pages, randomly get this error:

Could not parse response content as the request was rejected by the content filter

response = self.root_client.beta.chat.completions.parse(**payload)
│ │ │ │ │ │ └ {'messages': [{'content': '\nYou are a website scraper and you have just scraped the\nfollowing content from a website conver...
│ │ │ │ │ └ <function Completions.parse at 0x7f075673b640>
│ │ │ │ └ <openai.resources.beta.chat.completions.Completions object at 0x7f0731467310>
│ │ │ └ <openai.resources.beta.chat.chat.Chat object at 0x7f0731466fe0>
│ │ └ <openai.resources.beta.beta.Beta object at 0x7f0731466d40>
│ └ <openai.OpenAI object at 0x7f073110f010>
└ ChatOpenAI(client=<openai.resources.chat.completions.Completions object at 0x7f07314658a0>, async_client=<openai.resources.ch...
File "/root/.cache/pypoetry/virtualenvs/platform-backend-data-tq7C0_9c-py3.10/lib/python3.10/site-packages/openai/resources/beta/chat/completions.py", line 140, in parse
return _parse_chat_completion(
└ <function parse_chat_completion at 0x7f0756700d30>
File "/root/.cache/pypoetry/virtualenvs/platform-backend-data-tq7C0_9c-py3.10/lib/python3.10/site-packages/openai/lib/_parsing/_completions.py", line 75, in parse_chat_completion
raise ContentFilterFinishReasonError()
└ <class 'openai.ContentFilterFinishReasonError'>

openai.ContentFilterFinishReasonError: Could not parse response content as the request was rejected by the content filter

To Reproduce
Try to scrape this page:

https://news.bms.com/news/details/2016/First-Presentation-of-Two-Year-Overall-Survival-Data-for-Opdivo-nivolumab-in-Combination-with-Yervoy-ipilimumab-Showed-Superior-Efficacy-Versus-Yervoy-Alone-in-Advanced-Melanoma/default.aspx

Expected behavior
Extracted Content

Additional context
Add any other context about the problem here.

@VinciGit00
Copy link
Collaborator

can you share the code please?

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

2 participants