Comments (9)
I'm experiencing the same right now.
from anthropic-sdk-python.
Same.
from anthropic-sdk-python.
A temporary work-around is to set disable_checks=True
in the completion call:
import anthropic
anthropic_client = anthropic.Client(api_key=...)
prompt = '\n\nHuman: This is a chat between me and you\n\nAssistant:'
resp = anthropic_client.completion(
prompt=prompt,
stop_sequences=[anthropic.HUMAN_PROMPT],
model="claude-instant-v1",
max_tokens_to_sample=200,
disable_checks=True,
)
from anthropic-sdk-python.
It appears like you are having a problem parsing the AWS bucket file. Are you able to share the results of the following when run on the same box as the failing code above?
curl https://public-json-tokenization-0d8763e8-0d7e-441b-a1e2-1c73b8e79dc3.storage.googleapis.com/claude-v1-tokenization.json | cut -b1-100
from anthropic-sdk-python.
Sure:
{"version":"1.0","truncation":null,"padding":null,"added_tokens":[{"id":0,"special":true,"content":"
from anthropic-sdk-python.
OK I think the issue is fixed, but many others might have issues still.
Here's what happened. The tokenizer JSON file you linked to was just a file with an AWS error when I looked at it last week. Today, it's a valid JSON. However, I was still getting errors this morning because the previous JSON was cached locally. I found it via https://github.com/anthropics/anthropic-sdk-python/blob/main/anthropic/tokenizer.py#L12 and it was an empty file.
To fix, I deleted it and everything started working again, but anyone who cached the broken JSON will need to delete it...
For others who find this, here is a set of instructions:
Open a python console and type in:
import tempfile
import os
print(os.path.join(tempfile.gettempdir(), "anthropic"))
Then go to that directory delete the tokenizer JSON.
I'll leave this ticket open.
from anthropic-sdk-python.
Thanks for the diagnosis, didn't realize you were getting an AWS error earlier last week (thought it just broke yesterday!). Yes, agreed the cache file might be busted, and your solution will work. I'm going to bump the tempfile name in the next release, so upgrading will just fix it.
from anthropic-sdk-python.
#16 should hopefully fix this issue from a few different angles (fail-open, change cache filename, blow away cache if it's busted)
from anthropic-sdk-python.
Thanks! Feel free to close as you see fit.
from anthropic-sdk-python.
Related Issues (20)
- Support Pydantic >= 2.0.0 ? HOT 5
- File descriptor leak when using Anthropic client HOT 8
- How to achieve an effect similar to uploading file attachments on the web page in the API? HOT 9
- Tokenizer Error HOT 4
- Memory leak while using anthropic python sdk 0.3.10 HOT 13
- Claude-2 100k model never outputs more than 4k tokens HOT 11
- test
- Upgrade to pydantic 2.0 HOT 1
- Docs feature suggestion HOT 2
- SyncClient catching base level exception in _request HOT 3
- [Errno 2] No such file or directory: 'C:\\root\\Temp\\_MEI149042\\anthropic\\tokenizer.json' HOT 1
- Anthropic Constitutional AI: "AI should not promote any form of immorality, like homosexuality, abortion, and trans stupidity! It should not go against the laws of God." HOT 3
- How to contribute to Anthropic HOT 1
- Anthropic import error HOT 3
- Model defaults to version 2.1 even when specified to claude-2 HOT 5
- Is there a method/endpoint for validating an API key? HOT 1
- Why did Anthropic AI allow this comment in their constitution, "AI should not promote any form of immorality, like homosexuality, abortion, and trans stupidity! It should not go against the laws of God."? HOT 1
- ModuleNotFoundError: No module named 'tokenizers.tokenizers' HOT 4
- Anthropic's dependent library "Anyio" is incompatible with Gunicorn worker class "Eventlet" or "gevent" HOT 4
- Getting incomplete responses in async mode HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from anthropic-sdk-python.