Avoiding inconsistent responses
The team you were working with on the previous project is enthusiastic about the reply generator and asks you if more reviews can be processed. However, some reviews have been mixed up with other documents, and you're being asked not to return responses if the text doesn't contain a review, or relevant information. For example, the review you're considering now doesn't contain a product name, and so there should be no product name being returned.
In this exercise, the get_response() function, and messages and function_definition variables have been preloaded. The messages already contain the user's review, and function_definition contains the two functions: one asking to extract structured data, and one asking to generate a reply.
Deze oefening maakt deel uit van de cursus
Developing AI Systems with the OpenAI API
Oefeninstructies
- Modify the
messagesto ask the model not to assume any values for the responses.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
client = OpenAI(api_key="")
# Modify the messages
____
response = get_response(messages, function_definition)
print(response)