Coder Social home page Coder Social logo

Comments (9)

moelllerniklas avatar moelllerniklas commented on June 15, 2024

I'm experiencing the same right now.

from anthropic-sdk-python.

Kolufs avatar Kolufs commented on June 15, 2024

Same.

from anthropic-sdk-python.

sergeyf avatar sergeyf commented on June 15, 2024

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.

mikelambert avatar mikelambert commented on June 15, 2024

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.

sergeyf avatar sergeyf commented on June 15, 2024

Sure:

{"version":"1.0","truncation":null,"padding":null,"added_tokens":[{"id":0,"special":true,"content":"

from anthropic-sdk-python.

sergeyf avatar sergeyf commented on June 15, 2024

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.

mikelambert avatar mikelambert commented on June 15, 2024

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.

mikelambert avatar mikelambert commented on June 15, 2024

#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.

sergeyf avatar sergeyf commented on June 15, 2024

Thanks! Feel free to close as you see fit.

from anthropic-sdk-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.