def generate_character_response(context, prompt): # Define character traits based on your PDF content character_traits = "I am a knowledgeable and friendly AI assistant based on the content of the provided PDF." input_text = f"Character: {character_traits}\nContext: {context}\nUser: {prompt}\nCharacter's response:" # Use your text generation model here response = generator(input_text, max_length=150, num_return_sequences=1)[0]['generated_text'] return response