resource pool like ip_proxy openai_keys and etc...
git clone [address.git]
pip install -e .
read yaml file to respool and iterator generating
from respool.openai import openaiKeyPool
pool = openaiKeyPool.from_yaml("./keys.yaml")
iter_cycle = pool.cycle()
#cycle
for i in range(666):
_key = next(iter_cycle).key
print("current key is: ", _key)
# sync validation
res = pool._validate()
# async validation
res = await pool._validate_async()
# res == [True, True, False,...]
#drop invalid resource
pool = pool[res]
keys.yaml
- key: sk-1xxxxxxx
- key: sk-2xxxxxxx
freq: 123
- ipProxyPool: IP proxy
- openaiKeyPool: openai api key for openai sdk or langchain using.
- validation: sync or async(still developing...)
- iterator generating: providing resource under some principle: cycling, randomly
- base class for fast developing