-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Closed as not planned
Description
Confirm this is an issue with the Python library and not an underlying OpenAI API
- This is an issue with the Python library
Describe the bug
I am developing a program that employs multiprocessing to enhance efficiency through parallel execution. Python relies on the pickle
module for object serialization and inter-process communication. It would be nice if we let all classes in the openai
package be pickle-able。
To Reproduce
- Create an
OpenAI
orAsyncOpenAI
client. - Serialize the client using the
pickle
module.
Code snippets
import pickle
from openai import OpenAI, AsyncOpenAI
client = OpenAI(api_key='sk-...')
async_client = AsyncOpenAI(api_key='sk-...')
pickle.dumps(client) # TypeError: cannot pickle '_thread.RLock' object
pickle.dumps(async_client) # TypeError: cannot pickle '_thread.RLock' object
OS
macOS
Python version
Python 3.11.6
Library version
openai v1.3.0
Metadata
Metadata
Assignees
Labels
No labels