From task-specific SRL to emergence with ChatGPT
We have seen that OpenAI’s ChatGPT with GPT-4 has taken LLMs further for various tasks, including SRL. Thus, general-purpose LLMs do not necessarily need to learn syntax explicitly. They don’t need to learn the rules and principles of syntax that explain how to form phrases, clauses, and sentences. They can explain sentences with and beyond SRL.
We have gone through the main aspects of SRL in this chapter with several examples. This section will focus on running GPT-4 through the API to explore its ability to perform SRL without explicitly being trained for this task.
Open Semantic_Role_Labeling_GPT-4.ipynb
in the directory of this chapter in the GitHub repository.
We will first install and import OpenAI.
1. Installing OpenAI
The program updates pip
and installs OpenAI:
!pip install --upgrade pip
#Importing openai
try:
import openai
except:
!pip install openai -qq
import openai
from openai...