library(ellmer)
chat <- chat_openai(model = "gpt-4.1",
system_prompt = '
Extract the following fields from the text:
- Customer name
- Complaint category
- Date
- Product
Text: "Hi, I\'m Alex. My AC Model X-200 failed yesterday."
Output:
{ "name": "Alex", "category": "product failure", "date": "yesterday", "product": "AC Model X-200" }')