Skip to content

started with interactive tutorial but it failing on very first example : Client.__init__() got an unexpected keyword argument 'proxies' #91

@recursivezero

Description

@recursivezero

clone the repo and started to run first tutorials in vscode after setting the anthropic API KEY on place but it keep faling ; tried to get help from github copilot and it changes some lines of code but still failing ;although I am not mucyh aware of python so can you help us

  • vscode v 1.101
  • ubuntu 24.04
  • python v 3.12

here is output


---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[14], line 3
      1 import anthropic
----> 3 client = anthropic.Anthropic(api_key=API_KEY)
      5 def get_completion(prompt: str):
      6     message = client.messages.create(
      7         model=MODEL_NAME,
      8         max_tokens=2000,
   (...)     12         ]
     13     )

File /xtra/work/courses/prompt_engineering_interactive_tutorial/.venv/lib/python3.12/site-packages/anthropic/_client.py:119, in Anthropic.__init__(self, api_key, auth_token, base_url, timeout, max_retries, default_headers, default_query, http_client, transport, proxies, connection_pool_limits, _strict_response_validation)
    116 if base_url is None:
    117     base_url = f"https://api.anthropic.com"
--> 119 super().__init__(
    120     version=__version__,
    121     base_url=base_url,
    122     max_retries=max_retries,
    123     timeout=timeout,
    124     http_client=http_client,
    125     transport=transport,
    126     proxies=proxies,
    127     limits=connection_pool_limits,
    128     custom_headers=default_headers,
    129     custom_query=default_query,
    130     _strict_response_validation=_strict_response_validation,
    131 )
    133 self._default_stream_cls = Stream
    135 self.completions = resources.Completions(self)

File /xtra/work/courses/prompt_engineering_interactive_tutorial/.venv/lib/python3.12/site-packages/anthropic/_base_client.py:801, in SyncAPIClient.__init__(self, version, base_url, max_retries, timeout, transport, proxies, limits, http_client, custom_headers, custom_query, _strict_response_validation)
    784     raise TypeError(
    785         f"Invalid `http_client` argument; Expected an instance of `httpx.Client` but got {type(http_client)}"
    786     )
    788 super().__init__(
    789     version=version,
    790     limits=limits,
   (...)    799     _strict_response_validation=_strict_response_validation,
    800 )
--> 801 self._client = http_client or SyncHttpxClientWrapper(
    802     base_url=base_url,
    803     # cast to a valid type because mypy doesn't understand our type narrowing
    804     timeout=cast(Timeout, timeout),
    805     proxies=proxies,
    806     transport=transport,
    807     limits=limits,
    808     follow_redirects=True,
    809 )

TypeError: Client.__init__() got an unexpected keyword argument 'proxies'

and this is screenshot

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions