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

'Beta' object has no attribute 'prompt_caching'? #1

Closed
SirLaffalot opened this issue Jan 10, 2025 · 2 comments
Closed

'Beta' object has no attribute 'prompt_caching'? #1

SirLaffalot opened this issue Jan 10, 2025 · 2 comments
Assignees

Comments

@SirLaffalot
Copy link

I just fresh installed gptcmd and gptcmd-anthropic. The config file only has provider, key, and model.
I get this:
(venv) [ivan@radagast claude]$ gptcmd
Traceback (most recent call last):
File "/home/ivan/workspace/claude/venv/bin/gptcmd", line 8, in
sys.exit(main())
~~~~^^
File "/home/ivan/workspace/claude/venv/lib/python3.13/site-packages/gptcmd/cli.py", line 1273, in main
shell = Gptcmd(config=config)
File "/home/ivan/workspace/claude/venv/lib/python3.13/site-packages/gptcmd/cli.py", line 73, in init
self.config = config or ConfigManager.from_toml()
~~~~~~~~~~~~~~~~~~~~~~~^^
File "/home/ivan/workspace/claude/venv/lib/python3.13/site-packages/gptcmd/config.py", line 136, in from_toml
return cls(tomllib.load(fin))
File "/home/ivan/workspace/claude/venv/lib/python3.13/site-packages/gptcmd/config.py", line 81, in init
self.accounts = self._configure_accounts(
~~~~~~~~~~~~~~~~~~~~~~~~^
self.conf["accounts"], providers
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/home/ivan/workspace/claude/venv/lib/python3.13/site-packages/gptcmd/config.py", line 153, in _configure_accounts
res[name] = Account(name=name, provider=provider.from_config(conf))
~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/home/ivan/workspace/claude/venv/lib/python3.13/site-packages/gptcmd_anthropic/anthropic.py", line 57, in from_config
return cls(client, model=model)
File "/home/ivan/workspace/claude/venv/lib/python3.13/site-packages/gptcmd_anthropic/anthropic.py", line 37, in init
self.update_api_params(self.class.DEFAULT_API_PARAMS)
~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/ivan/workspace/claude/venv/lib/python3.13/site-packages/gptcmd/llm/init.py", line 155, in update_api_params
validated_params = self.validate_api_params(new_params)
File "/home/ivan/workspace/claude/venv/lib/python3.13/site-packages/gptcmd_anthropic/anthropic.py", line 254, in validate_api_params
self._anthropic.beta.prompt_caching.messages.create
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'Beta' object has no attribute 'prompt_caching'

What am I missing here?

@codeofdusk
Copy link
Owner

This appears to have been broken by anthropics/anthropic-sdk-python#795. I'll issue a fix, but in the meantime, do pip install anthropic==0.41.0.

@codeofdusk codeofdusk self-assigned this Jan 11, 2025
codeofdusk added a commit that referenced this issue Jan 11, 2025
Use the standard `messages.create` method since prompt caching is now generally available.

Addresses #1
@codeofdusk
Copy link
Owner

Fixed in the 1.0.1 release.

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

No branches or pull requests

2 participants