KeyError: 'data' #407
Replies: 2 comments
-
Hi @danielchang1985, I can't reproduce this. Can you access the OpenAI API by any other means, e. g. using the |
Beta Was this translation helpful? Give feedback.
0 replies
-
Hi @danielchang1985, I had the same issue, I've solved initialising the environment variable
You will see that the add of the labels will return 1, True, using the key.
You can see by setting and unsetting (put an empty string) the environment variable, the two different behaviours. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
hi all I tried to execute the codes in documentation to create an NER component and I am getting this error.
Appreciate if there's someone who knows how to troubleshoot this.
import spacy
nlp = spacy.blank("en")
llm_ner = nlp.add_pipe("llm_ner")
llm_ner.add_label("PERSON")
llm_ner.add_label("LOCATION")
nlp.initialize()
doc = nlp("Jack and Jill rode up the hill in Les Deux Alpes")
print([(ent.text, ent.label_) for ent in doc.ents])
Error
KeyError Traceback (most recent call last)
Cell In[1], line 4
1 import spacy
3 nlp = spacy.blank("en")
----> 4 llm_ner = nlp.add_pipe("llm_ner")
5 llm_ner.add_label("PERSON")
6 llm_ner.add_label("LOCATION")
File c:\Users\danie\anaconda3\envs\lymphoma\Lib\site-packages\spacy\language.py:821, in Language.add_pipe(self, factory_name, name, before, after, first, last, source, config, raw_config, validate)
817 pipe_component, factory_name = self.create_pipe_from_source(
818 factory_name, source, name=name
819 )
820 else:
--> 821 pipe_component = self.create_pipe(
822 factory_name,
823 name=name,
824 config=config,
825 raw_config=raw_config,
826 validate=validate,
827 )
828 pipe_index = self._get_pipe_index(before, after, first, last)
829 self._pipe_meta[name] = self.get_factory_meta(factory_name)
File c:\Users\danie\anaconda3\envs\lymphoma\Lib\site-packages\spacy\language.py:709, in Language.create_pipe(self, factory_name, name, config, raw_config, validate)
...
---> 70 response = r.json()["data"]
71 models = [response[i]["id"] for i in range(len(response))]
72 if self._name not in models:
KeyError: 'data'
Packages
Spacy 3.7.2
Spacy-llm 0.6.4
Beta Was this translation helpful? Give feedback.
All reactions