Extracting the response
The data analytics AI assistant must return clean and readable responses to users, and the company has asked you to extract only the relevant text from the model's response.
Extract and print only the generated text from the pre-imported Llama's response.
Deze oefening maakt deel uit van de cursus
Working with Llama 3
Oefeninstructies
- Extract the
"text"from the first element of the"choices"list inresponseand store it inextracted. - Print
extracted.
Praktische interactieve oefening
Probeer deze oefening eens door deze voorbeeldcode in te vullen.
# Extract the first choice and generated text
extracted = response["choices"]____
# Print the extracted text
print(____)