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

Client.init() got an unexpected keyword argument 'proxies' #240

Open
stefanches7 opened this issue Dec 12, 2024 · 1 comment
Open

Client.init() got an unexpected keyword argument 'proxies' #240

stefanches7 opened this issue Dec 12, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@stefanches7
Copy link

Describe the bug
Client.init() got an unexpected keyword argument 'proxies'

To Reproduce
pytest benchmark/test_biocypher_query_generation

Stack trace

_ ERROR at setup of test_end_to_end_query_generation[gpt-4o-2024-08-06-test_data_biocypher_query_generation5] _

request = <SubRequest 'conversation' for <Function test_end_to_end_query_generation[gpt-4o-2024-08-06-test_data_biocypher_query_generation5]>>
model_name = 'gpt-4o-2024-08-06', client = None

    @pytest.fixture()
    def conversation(request, model_name, client):
        """Decides whether to run the test or skip due to the test having been run
        before. If not skipped, will create a conversation object for interfacing
        with the model.
        """
        test_name = request.node.originalname.replace("test_", "")
        subtask = "?"  # TODO can we get the subtask here?
        if benchmark_already_executed(model_name, test_name, subtask):
            pass
            # pytest.skip(
            #     f"benchmark {test_name}: {subtask} with {model_name} already executed"
            # )
    
        if model_name in OPENAI_MODEL_NAMES:
            conversation = GptConversation(
                model_name=model_name,
                prompts={},
                correct=False,
            )
>           conversation.set_api_key(
                os.getenv("OPENAI_API_KEY"),
                user="benchmark_user",
            )

benchmark/conftest.py:371: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
biochatter/llm_connect.py:1360: in set_api_key
    self.chat = ChatOpenAI(
../../miniforge3/envs/biochatter/lib/python3.11/site-packages/langchain_core/load/serializable.py:113: in __init__
    super().__init__(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

__pydantic_self__ = ChatOpenAI()
data = {'base_url': None, 'model_kwargs': {}, 'model_name': 'gpt-4o-2024-08-06', 'openai_api_key': 'sk-proj-oPuzf3pL0YAPb8V79...OVoZvR-P4k4Ij5QaFiClF0EXpZ8V8hT3BlbkFJZnmFkTqDQk8k7e-OPQQud9It1mmTSaH_t8fkEyyrScA77fg1QM3t9MOwdxiaGF4EzHR0RH8KcA', ...}
values = {'async_client': None, 'cache': None, 'callback_manager': None, 'callbacks': None, ...}
fields_set = {'model_kwargs', 'model_name', 'openai_api_base', 'openai_api_key', 'temperature'}
validation_error = ValidationError(model='ChatOpenAI', errors=[{'loc': ('__root__',), 'msg': "Client.__init__() got an unexpected keyword argument 'proxies'", 'type': 'type_error'}])

    def __init__(__pydantic_self__, **data: Any) -> None:
        """
        Create a new model by parsing and validating input data from keyword arguments.
    
        Raises ValidationError if the input data cannot be parsed to form a valid model.
        """
        # Uses something other than `self` the first arg to allow "self" as a settable attribute
        values, fields_set, validation_error = validate_model(__pydantic_self__.__class__, data)
        if validation_error:
>           raise validation_error
E           pydantic.v1.error_wrappers.ValidationError: 1 validation error for ChatOpenAI
E           __root__
E             Client.__init__() got an unexpected keyword argument 'proxies' (type=type_error)

../../miniforge3/envs/biochatter/lib/python3.11/site-packages/pydantic/v1/main.py:341: ValidationError

Expected behavior
Set the OpenAI client running

Desktop (please complete the following information):

  • Operating system: Linux stefan-dev 6.8.0-45-generic #45-Ubuntu SMP PREEMPT_DYNAMIC Fri Aug 30 12:02:04 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
  • Relevant package versions
_libgcc_mutex             0.1                 conda_forge    conda-forge
_openmp_mutex             4.5                       2_gnu    conda-forge
absl-py                   2.1.0                    pypi_0    pypi
accelerate                1.2.0                    pypi_0    pypi
aiofiles                  23.2.1                   pypi_0    pypi
aiohappyeyeballs          2.4.4                    pypi_0    pypi
aiohttp                   3.11.9                   pypi_0    pypi
aioprometheus             23.12.0                  pypi_0    pypi
aiosignal                 1.3.1                    pypi_0    pypi
altair                    5.5.0                    pypi_0    pypi
annotated-types           0.7.0                    pypi_0    pypi
anthropic                 0.33.1                   pypi_0    pypi
anyio                     4.6.2.post1              pypi_0    pypi
async-timeout             5.0.1                    pypi_0    pypi
attrs                     24.2.0                   pypi_0    pypi
babel                     2.16.0                   pypi_0    pypi
bcrypt                    4.2.1                    pypi_0    pypi
biochatter                0.7.10                   pypi_0    pypi
brotli-python             1.1.0           py311hfdbb021_2    conda-forge
bump2version              1.0.1                    pypi_0    pypi
bzip2                     1.0.8                h4bc722e_7    conda-forge
ca-certificates           2024.8.30            hbcca054_0    conda-forge
cachecontrol              0.14.1             pyha770c72_1    conda-forge
cachecontrol-with-filecache 0.14.1             pyhd8ed1ab_1    conda-forge
cairocffi                 1.7.1                    pypi_0    pypi
cairosvg                  2.7.1                    pypi_0    pypi
certifi                   2024.8.30          pyhd8ed1ab_0    conda-forge
cffi                      1.17.1          py311hf29c0ef_0    conda-forge
cfgv                      3.4.0                    pypi_0    pypi
charset-normalizer        3.4.0              pyhd8ed1ab_1    conda-forge
cleo                      2.2.1              pyhd8ed1ab_0    conda-forge
click                     8.1.7                    pypi_0    pypi
cloudpickle               3.1.0                    pypi_0    pypi
colorama                  0.4.6              pyhd8ed1ab_1    conda-forge
colorcet                  3.1.0                    pypi_0    pypi
colorlog                  6.9.0                    pypi_0    pypi
contourpy                 1.3.1                    pypi_0    pypi
coverage                  7.6.8                    pypi_0    pypi
coverage-badge            1.1.2                    pypi_0    pypi
cpython                   3.11.11         py311hd8ed1ab_1    conda-forge
crashtest                 0.4.1              pyhd8ed1ab_1    conda-forge
cryptography              41.0.7                   pypi_0    pypi
cssselect2                0.7.0                    pypi_0    pypi
cycler                    0.12.1                   pypi_0    pypi
dataclasses-json          0.6.7                    pypi_0    pypi
datasets                  2.14.4                   pypi_0    pypi
dbus                      1.13.6               h5008d03_3    conda-forge
decorator                 5.1.1                    pypi_0    pypi
defusedxml                0.7.1                    pypi_0    pypi
dill                      0.3.7                    pypi_0    pypi
distlib                   0.3.9              pyhd8ed1ab_1    conda-forge
distro                    1.9.0                    pypi_0    pypi
dulwich                   0.21.7          py311h9ecbd09_1    conda-forge
ecdsa                     0.19.0                   pypi_0    pypi
environs                  9.5.0                    pypi_0    pypi
evaluate                  0.4.3                    pypi_0    pypi
expat                     2.6.4                h5888daf_0    conda-forge
fastapi                   0.110.3                  pypi_0    pypi
ffmpy                     0.4.0                    pypi_0    pypi
filelock                  3.16.1             pyhd8ed1ab_1    conda-forge
fonttools                 4.55.1                   pypi_0    pypi
frozenlist                1.5.0                    pypi_0    pypi
fsspec                    2024.10.0                pypi_0    pypi
ghp-import                2.1.0                    pypi_0    pypi
gradio                    4.26.0                   pypi_0    pypi
gradio-client             0.15.1                   pypi_0    pypi
grandalf                  0.8                      pypi_0    pypi
greenlet                  3.1.1                    pypi_0    pypi
griffe                    1.5.1                    pypi_0    pypi
grpcio                    1.53.0                   pypi_0    pypi
h11                       0.14.0                   pypi_0    pypi
h2                        4.1.0              pyhd8ed1ab_1    conda-forge
hpack                     4.0.0              pyhd8ed1ab_1    conda-forge
httpcore                  1.0.7                    pypi_0    pypi
httpx                     0.28.0                   pypi_0    pypi
huggingface-hub           0.26.3                   pypi_0    pypi
hyperframe                6.0.1              pyhd8ed1ab_1    conda-forge
identify                  2.6.3                    pypi_0    pypi
idna                      3.10               pyhd8ed1ab_1    conda-forge
importlib-metadata        8.5.0              pyha770c72_1    conda-forge
importlib_resources       6.4.5              pyhd8ed1ab_1    conda-forge
iniconfig                 2.0.0                    pypi_0    pypi
jaraco.classes            3.4.0              pyhd8ed1ab_2    conda-forge
jeepney                   0.8.0              pyhd8ed1ab_0    conda-forge
jinja2                    3.1.4                    pypi_0    pypi
jiter                     0.8.0                    pypi_0    pypi
joblib                    1.4.2                    pypi_0    pypi
jsonpatch                 1.33                     pypi_0    pypi
jsonpointer               3.0.0                    pypi_0    pypi
jsonschema                4.23.0                   pypi_0    pypi
jsonschema-specifications 2024.10.1                pypi_0    pypi
keyring                   24.3.1             pyha804496_1    conda-forge
kiwisolver                1.4.7                    pypi_0    pypi
langchain                 0.2.17                   pypi_0    pypi
langchain-anthropic       0.1.23                   pypi_0    pypi
langchain-community       0.2.19                   pypi_0    pypi
langchain-core            0.2.43                   pypi_0    pypi
langchain-openai          0.1.20                   pypi_0    pypi
langchain-text-splitters  0.2.4                    pypi_0    pypi
langgraph                 0.1.19                   pypi_0    pypi
langsmith                 0.1.147                  pypi_0    pypi
ld_impl_linux-64          2.43                 h712a8e2_2    conda-forge
libexpat                  2.6.4                h5888daf_0    conda-forge
libffi                    3.4.2                h7f98852_5    conda-forge
libgcc                    14.2.0               h77fa898_1    conda-forge
libgcc-ng                 14.2.0               h69a702a_1    conda-forge
libglib                   2.82.2               h2ff4ddf_0    conda-forge
libgomp                   14.2.0               h77fa898_1    conda-forge
libiconv                  1.17                 hd590300_2    conda-forge
liblzma                   5.6.3                hb9d3cd8_1    conda-forge
liblzma-devel             5.6.3                hb9d3cd8_1    conda-forge
libnsl                    2.0.1                hd590300_0    conda-forge
libsqlite                 3.47.2               hee588c1_0    conda-forge
libstdcxx                 14.2.0               hc0a3c3a_1    conda-forge
libstdcxx-ng              14.2.0               h4852527_1    conda-forge
libuuid                   2.38.1               h0b41bf4_0    conda-forge
libxcrypt                 4.4.36               hd590300_1    conda-forge
libzlib                   1.3.1                hb9d3cd8_2    conda-forge
markdown                  3.7                      pypi_0    pypi
markdown-it-py            3.0.0                    pypi_0    pypi
markupsafe                2.1.5                    pypi_0    pypi
marshmallow               3.23.1                   pypi_0    pypi
matplotlib                3.9.3                    pypi_0    pypi
mdurl                     0.1.2                    pypi_0    pypi
mergedeep                 1.3.4                    pypi_0    pypi
mkdocs                    1.6.1                    pypi_0    pypi
mkdocs-autorefs           1.2.0                    pypi_0    pypi
mkdocs-get-deps           0.2.0                    pypi_0    pypi
mkdocs-material-extensions 1.3.1                    pypi_0    pypi
mkdocs-redirects          1.2.2                    pypi_0    pypi
mkdocs-table-reader-plugin 2.2.2                    pypi_0    pypi
mkdocstrings              0.24.3                   pypi_0    pypi
mkdocstrings-python       1.10.0                   pypi_0    pypi
modelscope                1.21.0                   pypi_0    pypi
more-itertools            10.5.0             pyhd8ed1ab_1    conda-forge
mpmath                    1.3.0                    pypi_0    pypi
msgpack-python            1.1.0           py311hd18a35c_0    conda-forge
multidict                 6.1.0                    pypi_0    pypi
multiprocess              0.70.15                  pypi_0    pypi
mypy-extensions           1.0.0                    pypi_0    pypi
narwhals                  1.17.0                   pypi_0    pypi
ncurses                   6.5                  he02047a_1    conda-forge
neo4j                     4.4.12                   pypi_0    pypi
neo4j-utils               0.0.7                    pypi_0    pypi
networkx                  3.4.2                    pypi_0    pypi
nltk                      3.9.1                    pypi_0    pypi
nodeenv                   1.9.1                    pypi_0    pypi
numpy                     1.26.4                   pypi_0    pypi
nvidia-cublas-cu11        11.11.3.6                pypi_0    pypi
nvidia-cublas-cu12        12.4.5.8                 pypi_0    pypi
nvidia-cuda-cupti-cu11    11.8.87                  pypi_0    pypi
nvidia-cuda-cupti-cu12    12.4.127                 pypi_0    pypi
nvidia-cuda-nvrtc-cu11    11.8.89                  pypi_0    pypi
nvidia-cuda-nvrtc-cu12    12.4.127                 pypi_0    pypi
nvidia-cuda-runtime-cu11  11.8.89                  pypi_0    pypi
nvidia-cuda-runtime-cu12  12.4.127                 pypi_0    pypi
nvidia-cudnn-cu11         9.1.0.70                 pypi_0    pypi
nvidia-cudnn-cu12         9.1.0.70                 pypi_0    pypi
nvidia-cufft-cu11         10.9.0.58                pypi_0    pypi
nvidia-cufft-cu12         11.2.1.3                 pypi_0    pypi
nvidia-curand-cu11        10.3.0.86                pypi_0    pypi
nvidia-curand-cu12        10.3.5.147               pypi_0    pypi
nvidia-cusolver-cu11      11.4.1.48                pypi_0    pypi
nvidia-cusolver-cu12      11.6.1.9                 pypi_0    pypi
nvidia-cusparse-cu11      11.7.5.86                pypi_0    pypi
nvidia-cusparse-cu12      12.3.1.170               pypi_0    pypi
nvidia-ml-py              12.560.30                pypi_0    pypi
nvidia-nccl-cu11          2.21.5                   pypi_0    pypi
nvidia-nccl-cu12          2.21.5                   pypi_0    pypi
nvidia-nvjitlink-cu12     12.4.127                 pypi_0    pypi
nvidia-nvtx-cu11          11.8.86                  pypi_0    pypi
nvidia-nvtx-cu12          12.4.127                 pypi_0    pypi
openai                    1.39.0                   pypi_0    pypi
openssl                   3.4.0                hb9d3cd8_0    conda-forge
orjson                    3.10.12                  pypi_0    pypi
packaging                 24.2               pyhd8ed1ab_2    conda-forge
paginate                  0.5.7                    pypi_0    pypi
pandas                    2.2.3                    pypi_0    pypi
passlib                   1.7.4                    pypi_0    pypi
pathspec                  0.12.1                   pypi_0    pypi
pcre2                     10.44                hba22ea6_2    conda-forge
pdf2image                 1.17.0                   pypi_0    pypi
peft                      0.14.0                   pypi_0    pypi
pexpect                   4.9.0              pyhd8ed1ab_1    conda-forge
pillow                    10.4.0                   pypi_0    pypi
pip                       24.3.1             pyh8b19718_0    conda-forge
pkginfo                   1.12.0             pyhd8ed1ab_1    conda-forge
platformdirs              4.3.6              pyhd8ed1ab_1    conda-forge
pluggy                    1.5.0                    pypi_0    pypi
poetry                    1.8.5              pyha804496_0    conda-forge
poetry-core               1.9.1              pyhd8ed1ab_1    conda-forge
poetry-plugin-export      1.8.0              pyhd8ed1ab_1    conda-forge
pre-commit                4.0.1                    pypi_0    pypi
propcache                 0.2.1                    pypi_0    pypi
protobuf                  5.29.0                   pypi_0    pypi
psutil                    6.1.0                    pypi_0    pypi
ptyprocess                0.7.0              pyhd8ed1ab_1    conda-forge
py                        1.11.0                   pypi_0    pypi
pyarrow                   18.1.0                   pypi_0    pypi
pyasn1                    0.6.1                    pypi_0    pypi
pycparser                 2.22               pyh29332c3_1    conda-forge
pydantic                  2.10.2                   pypi_0    pypi
pydantic-core             2.27.1                   pypi_0    pypi
pydub                     0.25.1                   pypi_0    pypi
pygments                  2.18.0                   pypi_0    pypi
pymdown-extensions        10.12                    pypi_0    pypi
pymilvus                  2.2.8                    pypi_0    pypi
pymupdf                   1.25.0                   pypi_0    pypi
pynvml                    12.0.0                   pypi_0    pypi
pyparsing                 3.2.0                    pypi_0    pypi
pyproject_hooks           1.2.0              pyhd8ed1ab_1    conda-forge
pysocks                   1.7.1              pyha55dd90_7    conda-forge
pytest                    7.4.4                    pypi_0    pypi
python                    3.11.11         h9e4cc4f_1_cpython    conda-forge
python-build              1.2.2.post1        pyhff2d567_1    conda-forge
python-dateutil           2.9.0.post0              pypi_0    pypi
python-dotenv             1.0.1                    pypi_0    pypi
python-fastjsonschema     2.21.1             pyhd8ed1ab_0    conda-forge
python-installer          0.7.0              pyhff2d567_1    conda-forge
python-jose               3.3.0                    pypi_0    pypi
python-multipart          0.0.19                   pypi_0    pypi
python_abi                3.11                    5_cp311    conda-forge
pytz                      2024.2                   pypi_0    pypi
pyyaml                    6.0.2                    pypi_0    pypi
pyyaml-env-tag            0.1                      pypi_0    pypi
quantile-python           1.1                      pypi_0    pypi
readline                  8.2                  h8228510_1    conda-forge
redis                     4.6.0                    pypi_0    pypi
referencing               0.35.1                   pypi_0    pypi
regex                     2024.11.6                pypi_0    pypi
requests                  2.32.3             pyhd8ed1ab_1    conda-forge
requests-toolbelt         1.0.0              pyhd8ed1ab_1    conda-forge
retry                     0.9.2                    pypi_0    pypi
rich                      13.9.4                   pypi_0    pypi
rouge-score               0.1.2                    pypi_0    pypi
rpds-py                   0.22.3                   pypi_0    pypi
rsa                       4.9                      pypi_0    pypi
ruff                      0.8.2                    pypi_0    pypi
safetensors               0.4.5                    pypi_0    pypi
scipy                     1.14.1                   pypi_0    pypi
seaborn                   0.13.2                   pypi_0    pypi
secretstorage             3.3.3           py311h38be061_3    conda-forge
semantic-version          2.10.0                   pypi_0    pypi
setuptools                75.6.0             pyhff2d567_1    conda-forge
shellingham               1.5.4              pyhd8ed1ab_1    conda-forge
shortuuid                 1.0.13                   pypi_0    pypi
six                       1.16.0                   pypi_0    pypi
sniffio                   1.3.1                    pypi_0    pypi
sqlalchemy                2.0.36                   pypi_0    pypi
sse-starlette             2.1.3                    pypi_0    pypi
starlette                 0.37.2                   pypi_0    pypi
stringcase                1.2.0                    pypi_0    pypi
sympy                     1.13.1                   pypi_0    pypi
tabulate                  0.9.0                    pypi_0    pypi
tblib                     3.0.0                    pypi_0    pypi
tenacity                  8.5.0                    pypi_0    pypi
tiktoken                  0.7.0                    pypi_0    pypi
timm                      1.0.12                   pypi_0    pypi
tinycss2                  1.4.0                    pypi_0    pypi
tk                        8.6.13          noxft_h4845f30_101    conda-forge
tokenizers                0.20.3                   pypi_0    pypi
toml                      0.10.2                   pypi_0    pypi
tomli                     2.2.1              pyhd8ed1ab_1    conda-forge
tomlkit                   0.12.0                   pypi_0    pypi
torch                     2.5.1+cu118              pypi_0    pypi
torchaudio                2.5.1+cu118              pypi_0    pypi
torchvision               0.20.1+cu118             pypi_0    pypi
tqdm                      4.67.1                   pypi_0    pypi
transformers              4.46.3                   pypi_0    pypi
triton                    3.1.0                    pypi_0    pypi
trove-classifiers         2024.10.21.16      pyhd8ed1ab_1    conda-forge
typer                     0.11.1                   pypi_0    pypi
typing-extensions         4.12.2                   pypi_0    pypi
typing-inspect            0.9.0                    pypi_0    pypi
tzdata                    2024.2                   pypi_0    pypi
ujson                     5.10.0                   pypi_0    pypi
urllib3                   2.2.3              pyhd8ed1ab_1    conda-forge
uvicorn                   0.32.1                   pypi_0    pypi
uvloop                    0.21.0                   pypi_0    pypi
virtualenv                20.28.0            pyhd8ed1ab_0    conda-forge
watchdog                  6.0.0                    pypi_0    pypi
webencodings              0.5.1                    pypi_0    pypi
websockets                11.0.3                   pypi_0    pypi
wheel                     0.45.1             pyhd8ed1ab_1    conda-forge
xinference                0.14.4.post1             pypi_0    pypi
xoscar                    0.4.5                    pypi_0    pypi
xxhash                    3.5.0                    pypi_0    pypi
xz                        5.6.3                hbcc6ac9_1    conda-forge
xz-gpl-tools              5.6.3                hbcc6ac9_1    conda-forge
xz-tools                  5.6.3                hb9d3cd8_1    conda-forge
yarl                      1.18.3                   pypi_0    pypi
zipp                      3.21.0             pyhd8ed1ab_1    conda-forge
zstandard                 0.23.0          py311hbc35293_1    conda-forge
zstd                      1.5.6                ha6fb4c9_0    conda-forge

Additional context
Using biochatter behind the corporate proxy (DKFZ).

@stefanches7 stefanches7 added the bug Something isn't working label Dec 12, 2024
@stefanches7 stefanches7 changed the title [Bug] Client.init() got an unexpected keyword argument 'proxies' Dec 12, 2024
@slobentanzer
Copy link
Contributor

slobentanzer commented Dec 12, 2024

Hi @stefanches7,
this is an issue related to dependencies, specifically, openai changed dependency on httpx, but are not actually compatible with 0.28. We have fixes in branches, but not in a state where we can merge into main. I recommend you downgrade httpx to 0.27.2 in whichever package manager you use (e.g., manually define httpx = "0.27.2" in pyproject.toml and rerun poetry lock).

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

2 participants