-
-
Notifications
You must be signed in to change notification settings - Fork 104
Closed
Labels
Description
Whatever I do, I can't use Anthropic's claude with spacy-llm. I tried both spacy.Claude-instant-1.v1
and spacy.Claude-2.v1
.
I am getting the following error during nlp = assemble(config_file_path)
:
...
File ~/miniconda3/envs/_my_env_/lib/python3.9/site-packages/requests/models.py:1021, in Response.raise_for_status(self)
1020 if http_error_msg:
-> 1021 raise HTTPError(http_error_msg, response=self)
HTTPError: 400 Client Error: Bad Request for url: https://api.anthropic.com/v1/complete
...
...
File ~/miniconda3/envs/_my_env_/lib/python3.9/site-packages/spacy_llm/models/rest/anthropic/model.py:80, in Anthropic.__call__.<locals>._request(json_data)
78 if error["type"] == "not_found_error":
79 error_msg += f". Ensure that the selected model ({self._name}) is supported by the API."
---> 80 raise ValueError(error_msg) from ex
81 response = r.json()
83 # c.f. https://console.anthropic.com/docs/api/errors
ValueError: Request to Anthropic API failed: {'type': 'invalid_request_error', 'message': 'anthropic-version header is required'}
Here is my config file:
[nlp]
lang = "en"
pipeline = ["llm"]
[components]
[components.llm]
factory = "llm"
[components.llm.model]
@llm_models = "spacy.Claude-instant-1.v1"
name = "claude-instant-1"
max_request_time = 5000
max_tries = 10
interval = 3
# config = {"temperature": 0.0}
[components.llm.task]
@llm_tasks = "spacy.TextCat.v3"
labels = ["MY_LABEL"]
exclusive_classes = True