'Custom NER using openai
How to do Custom NER using openai. Here are my code. Not sure how to add 'tags' and test 'text' on which prediction may happen
import openai
openai.api_key = '<key>'
txt = 'India has 30 states. Karnataka and Tamilnadu is one of them.\n\n###\n\n '
tags = '\n\"country\": \"India\",\n\"state\": \"Karnataka\",\n\"state\": \"Tamilnadu\"\n"'
response = openai.Completion.create(
engine="text-davinci-002",
prompt="Extract keywords from this text:\n\n " + txt,
#completion = tags,
temperature=0,
max_tokens=1000,
top_p=1 #, frequency_penalty=0.8, presence_penalty=0
)
print(response['choices'][0]['text'])
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
