explosion / explosion/spacy-llm

None of the models that spaCy-llm supports for Anthropic is working.

Open
#503 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
110
PR merge metrics
No merged PRs in 30d

Description

Hello,

I've been testing code to classify text using Antropic models and I'm getting the error shown below. I've tried all the models that the spacy-llm component reports for Anthropic, and they all produce the same error.

ValueError: Request to Anthropic API failed: {'type': 'invalid_request_error', 'message': 'The /v1/complete endpoint has been deprecated. Please use the /v1/messages endpoint instead. See https://docs.anthropic.com/en/api/messages for details.'}

These are the models I have tried:
spacy.Claude-1-0.v1, spacy.Claude-1-0.v2, spacy.Claude-1-2.v1, spacy.Claude-1-2.v2, spacy.Claude-1-3.v1, spacy.Claude-1-3.v2, spacy.Claude-1.v1, spacy.Claude-1.v2, spacy.Claude-2.v1, spacy.Claude-2.v2, spacy.Claude-instant-1-1.v1, spacy.Claude-instant-1-1.v2, spacy.Claude-instant-1.v1, spacy.Claude-instant-1.v2

below the code I am testing:

import os
from spacy_llm.util import assemble

# Set your Anthropic API credential
os.environ["ANTHROPIC_API_KEY"] = "......."

# Assemble the pipeline from your local config.cfg file
nlp = assemble("config.cfg")

# Process text through your newly configured Claude model
doc = nlp("Silicon Valley Investors Flexed Their Muscles in Uber Fight.")

print(doc.cats)

Below the config.cfg file content:

[nlp]
lang = "en"
pipeline = ["llm"]

[components]

[components.llm]
factory = "llm"

[components.llm.task]
@llm_tasks = "spacy.TextCat.v3"
labels = ["Technology", "Politics", "Economy", "Entertainment"]

[components.llm.model]
@llm_models = "spacy.Claude-instant-1.v2"

I would appreciate any help...
Thank you very much in advance!

José.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.