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 API calls #11

Open
PhantHive opened this issue Nov 19, 2023 · 0 comments
Open

OpenAI API calls #11

PhantHive opened this issue Nov 19, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@PhantHive
Copy link
Contributor

PhantHive commented Nov 19, 2023

Describe the bug
Find a way to handle nicely the error thrown by openai calls.

To Reproduce
Steps to reproduce the behavior:
Run any generation: py main.py --first-generation --subject "maths"

Expected behavior
Either the error to not appear with some callbacks or whatever to be able to call openai until the work is done.
Or to handle any openai error response.

Screenshots
If applicable, add screenshots to help explain your problem.

Traceback (most recent call last):
  File "F:\DOSSIER ULTIME\PROG\02-PYTHON\Organizations\SCRYPT\data-forge\main.py", line 229, in <module>
    generator.pipeline(execution_list=args)
  File "F:\DOSSIER ULTIME\PROG\02-PYTHON\Organizations\SCRYPT\data-forge\main.py", line 167, in pipeline
    self.generate_dataset(identifier=1, subject=execution_list[
  File "F:\DOSSIER ULTIME\PROG\02-PYTHON\Organizations\SCRYPT\data-forge\main.py", line 98, in generate_dataset
    self.model(prompt_content=dyn_prompt)
  File "F:\DOSSIER ULTIME\PROG\02-PYTHON\Organizations\SCRYPT\data-forge\main.py", line 33, in model
    self.response = openai.ChatCompletion.create(
  File "F:\DOSSIER ULTIME\PROG\pyenv\data-forge\lib\site-packages\openai\api_resources\chat_completion.py", line 25, in create
    return super().create(*args, **kwargs)
  File "F:\DOSSIER ULTIME\PROG\pyenv\data-forge\lib\site-packages\openai\api_resources\abstract\engine_api_resource.py", line 155, in create
    response, _, api_key = requestor.request(
  File "F:\DOSSIER ULTIME\PROG\pyenv\data-forge\lib\site-packages\openai\api_requestor.py", line 289, in request
    result = self.request_raw(
  File "F:\DOSSIER ULTIME\PROG\pyenv\data-forge\lib\site-packages\openai\api_requestor.py", line 617, in request_raw
    raise error.Timeout("Request timed out: {}".format(e)) from e
openai.error.Timeout: Request timed out: HTTPSConnectionPool(host='api.openai.com', port=443): Read timed out. (read timeout=600)
@PhantHive PhantHive added the bug Something isn't working label Nov 19, 2023
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