In the recent years, NLP models like ChatGPT have gained significant attention for their ability to generate human-like responses. One important aspect of leveraging these models effectively is understanding and utilizing prompts.
Among the various prompt styles, the “ACT LIKE” prompt has emerged as a powerful technique to guide the model”s behavior. This article explores the concept of ACT LIKE prompts, provides examples, and highlights their applications in different scenarios.
Understanding ACT LIKE Prompts
-
Definition − An ACT LIKE prompt instructs the model to generate responses as if it were a specific character, person, or entity.
-
Role-Playing − ACT LIKE prompts enable users to interact with the model in a more immersive and engaging way by assuming different personas.
-
Influencing Responses − By specifying a character or persona, users can direct the model”s behavior, language style, tone, and knowledge base to align with the chosen identity.
Examples of ACT LIKE Prompts
Acting as a Historical Figure
-
Prompt − “ACT LIKE Albert Einstein and explain the theory of relativity.”
-
Response − The model generates a response as if it were Albert Einstein, providing an explanation of the theory of relativity in his style.
Impersonating a Fictional Character
-
Prompt − “ACT LIKE Sherlock Holmes and solve this mystery.”
-
Response − The model adopts the persona of Sherlock Holmes and crafts a response showcasing deductive reasoning and detective skills.
Simulating an Expert
-
Prompt − “ACT LIKE a NASA scientist and explain the process of space exploration.”
-
Response − The model takes on the role of a NASA scientist, offering insights and technical knowledge about space exploration.
Applications of ACT LIKE Prompts
-
Storytelling and Writing − Writers can employ ACT LIKE prompts to generate dialogue or scenes in the voice of specific characters, adding depth and authenticity to their stories.
-
Learning and Education − Students can utilize ACT LIKE prompts to interact with the model as renowned historical figures, enhancing their understanding of different subjects through immersive conversations.
-
Entertainment and Games − ACT LIKE prompts can be employed in chat-based games or virtual assistants to provide interactive experiences, where users can engage with virtual characters.
Example
Take a look at the following example −
import openai # Set up your OpenAI API credentials openai.api_key = ''Your OpenAI Key'' # Define the ACT LIKE prompt prompt = """ ACT LIKE Sherlock Holmes and solve the following mystery: You are called to investigate a crime scene where a valuable diamond necklace has been stolen from a locked room. The room has no windows, and the only entrance is a solid wooden door. The door was locked from the inside, and there are no signs of forced entry. The owner of the necklace claims that nobody else had access to the room. How did the thief manage to steal the necklace? """ # Generate a response from the model response = openai.Completion.create( engine=''text-davinci-003'', prompt=prompt, max_tokens=100, n=1, stop=None, temperature=0.7 ) # Print the model''s response print(response.choices[0].text.strip())
In this case, we got the following response −
The most likely explanation is that the thief used a lock-picking device to gain entry to the room. Lock-picking devices are small tools that can be used to open locks without leaving any signs of forced entry. Therefore, it is likely that the thief used a lock-picking device to gain access to the room and then took the necklace.
Note that the system may produce a different response on your system, when you use the same code with your OpenAI key.
Conclusion
ACT LIKE prompts serve as a powerful tool for engaging with ChatGPT models, allowing users to assume different roles, characters, or expertise. By leveraging this prompt style, individuals can create rich and immersive conversations, enhance storytelling, foster learning experiences, and create interactive entertainment.
Understanding the potential of ACT LIKE prompts opens up a wide range of possibilities for exploring the capabilities of natural language processing models and making interactions more dynamic and engaging.