Entity Extraction in chatGPT

Hi Everyone,

I am exploring the ChatGPT API for my project for extracting entities from the utterances, currently I am using RASA in my project for entity extraction, in Rasa I am able to receive an entity array having entity_name, entity_value, confidence_scrore from the utterance (prompt in chatGPT).

Can anyone help me on how to extract entities list in chatGPT (if possible)

Thanks

just prompt the instruction (and a possible list of entities to extract). I think the confidence score wont work so well though

I don’t think chatGPT can calculate confidence scores, so might just spawn random numbers or mimic the ones in the sample, which won’t be of any use.

Currently in my project I am using RegexEntityExtractor in Rasa pipeline, I have tried to use the prompt completion in openAI but it’s not working

maybe show us what you are doing and what you are getting, that way its easier to help.

I tried this, I gave it a paragraph and asked chatGPT to extract the entities and their category from the string. Every time I asked it it extracted a different entitites and not the same number. I dont know if I was asking it incorrectly?

Here’s a simple gpt-3.5-turbo prompt that will return the intent and entities from any message as a JSON object. I pass this in as the 1st user message, not the system message:

Here's a JSON object:

{"intent": "<intent>",  "entities": [{"type": "<type>", "value": <value>, "startPos": <index>, "endPos": <index>}]}

Identify the intent and entities in users message and return a JSON object.

If I then pass in a User message of I'd like to book a flight from Seattle to Denver for 2 on 3/14/2023. Returning 2 weeks later. I get this as a response from the assistant:

{
  "intent": "book_flight",
  "entities": [
    {
      "type": "origin_city",
      "value": "Seattle",
      "startPos": 24,
      "endPos": 30
    },
    {
      "type": "destination_city",
      "value": "Denver",
      "startPos": 34,
      "endPos": 39
    },
    {
      "type": "passenger_count",
      "value": 2,
      "startPos": 44,
      "endPos": 44
    },
    {
      "type": "departure_date",
      "value": "2023-03-14",
      "startPos": 48,
      "endPos": 56
    },
    {
      "type": "return_date",
      "value": "2023-03-28",
      "startPos": 68,
      "endPos": 77
    }
  ]
}
1 Like