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

[BUG-python/deployment] Argilla==2.0.0rc1, TypeError: __init__() got an unexpected keyword argument 'extra_headers' #5098

Closed
MoritzLaurer opened this issue Jun 23, 2024 · 3 comments · Fixed by #5100 or #5094
Assignees
Milestone

Comments

@MoritzLaurer
Copy link
Contributor

Describe the bug

I'm following the quickstart guide for Argilla 2.0 here.

!pip install argilla==2.0.0rc1 

import argilla as rg

client = rg.Argilla(
    api_url="https://moritzlaurer-argilla-template-space-with-oauth-2.hf.space",
    api_key="owner.apikey",  # "owner.apikey", "admin.apikey"
    extra_headers={"Authorization": f"Bearer {huggingface_hub.get_token()}"},
)

user = client.me
user

This leads to the following error:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[6], line 1
----> 1 user = client.me
      2 user

File ~/miniconda/lib/python3.9/site-packages/argilla/client.py:80, in Argilla.me(self)
     77 """The current user."""
     78 from argilla import User
---> 80 return User(client=self, _model=self.api.users.get_me())

File ~/miniconda/lib/python3.9/site-packages/argilla/_api/_client.py:126, in APIClient.api(self)
    124 @property
    125 def api(self) -> "ArgillaAPI":
--> 126     return ArgillaAPI(http_client=self.http_client)

File ~/miniconda/lib/python3.9/site-packages/argilla/_api/_client.py:118, in APIClient.http_client(self)
    116 @property
    117 def http_client(self) -> httpx.Client:
--> 118     return create_http_client(
    119         api_url=self.api_url,  # type: ignore
    120         api_key=self.api_key,  # type: ignore
    121         **self._http_client_args,
    122     )

File ~/miniconda/lib/python3.9/site-packages/argilla/_api/_http/_client.py:44, in create_http_client(api_url, api_key, **client_args)
     41 headers = client_args.pop("headers", {})
     42 headers["X-Argilla-Api-Key"] = api_key
---> 44 return httpx.Client(base_url=api_url, headers=headers, **client_args)

TypeError: __init__() got an unexpected keyword argument 'extra_headers'

Expected behavior

No error message, being able to connect to private space with HF token

Environment:
Argilla 2.0 and trying to connect to a private duplicate of this space: https://huggingface.co/spaces/argilla/argilla-template-space-with-oauth

!python -m argilla info
/home/user/miniconda/bin/python: No module named argilla.__main__; 'argilla' is a package and cannot be directly executed

Additional context

@davidberenstein1957
Copy link
Member

@MoritzLaurer thanks for all of the issues :)

@burtenshaw
Copy link
Contributor

Hi @MoritzLaurer

I realised that the mistake is actually in the documentation in the app UI. It should be this:

client = rg.Argilla(
    api_url="https://burtenshaw-argilla-private.hf.space",
    api_key="owner.apikey",  # "owner.apikey", "admin.apikey"
    headers={"Authorization": f"Bearer {hf.get_token()}"},
)

user = client.me
user

@burtenshaw burtenshaw linked a pull request Jun 24, 2024 that will close this issue
4 tasks
@davidberenstein1957 davidberenstein1957 added this to the v2.0.0 milestone Jun 25, 2024
@frascuchon frascuchon mentioned this issue Jun 25, 2024
4 tasks
@MoritzLaurer
Copy link
Contributor Author

FYI, the wrong keyword argument is also still present in the default screen people see when opening an empty argilla space.

Screenshot 2024-06-27 at 12 38 40

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants