Skip to content

Latest commit

 

History

History
60 lines (40 loc) · 1011 Bytes

README.md

File metadata and controls

60 lines (40 loc) · 1011 Bytes

respool

resource pool like ip_proxy openai_keys and etc...

short installation

git clone [address.git]
pip install -e .

example

openaiKeyPool:

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]

yaml example

keys.yaml

- key:  sk-1xxxxxxx
- key:  sk-2xxxxxxx
  freq: 123

resource supporting

  • ipProxyPool: IP proxy
  • openaiKeyPool: openai api key for openai sdk or langchain using.

more feature

  1. validation: sync or async(still developing...)
  2. iterator generating: providing resource under some principle: cycling, randomly
  3. base class for fast developing