import streamlit as st import textwrap import google.generativeai as genai from IPython.display import display from IPython.display import Markdown import os def to_markdown(text): text = text.replace('•', ' *') return Markdown(textwrap.indent(text, '> ', predicate=lambda _: True)) genai.configure(api_key=os.environ.get("GEMINI_API_KEY")) # Set up the model generation_config = { "temperature": 0.2, "top_p": 1, "top_k": 1, "max_output_tokens": 2048, } safety_settings = [ { "category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_MEDIUM_AND_ABOVE" }, { "category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "BLOCK_MEDIUM_AND_ABOVE" }, { "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", "threshold": "BLOCK_MEDIUM_AND_ABOVE" }, { "category": "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold": "BLOCK_MEDIUM_AND_ABOVE" }, ] model = genai.GenerativeModel(model_name="gemini-1.0-pro", generation_config=generation_config, safety_settings=safety_settings) prompt_parts = [ "Your task is to analyze the provided input story and identify various Intellectual Humility (IH) traits exhibited within it. You should segment the story into distinct parts based on these traits and provide a summary for each part. Additionally, enumerate the specific traits observed within the story and list them inside \"$$\" at the end of your response, separating each trait with a comma. Your goal is to focus on the major traits of characters, similar to the examples provided. Avoid limiting the number of traits to 4, 5, or 10; explore a diverse range of traits instead\n\nEnsure the identified traits match those listed below precisely. Traits are enclosed within //:\n\n//List of 30 IH traits:\n\nOwning one’s Cognitive Limitations\nRevisiting One’s Beliefs\nReadiness to Correct One’s Beliefs\nMetacognition\nReflective Thinking\nSeeking Truth\nBelieving Truth\nPropagating truth\nIntellectual Tenacity\nPatience\nPursuit of Knowledge\nNeed for Cognition\nNeed for Cognitive Closure\nIntellectual Engagement\nRespect for Other’s Opinion\nBeing a Good Listener\nCollaborative and Cooperative Learning\nProper Pride\nProper Self-Assessment\nIntellectual Confidence\nIntellectual Courage\nSelf-Reflexivity\nAccurate Appraisal of One’s Intelligence\nOpenness for Experience\nLove for Learning\nNeed of Epistemic Self-Improvement\nHumility\nLack of Arrogance\nMore Attention to Epistemic Truth rather than One’s Status\nIndependence of Intellect and Ego\n//\nExamine the provided examples (\"Satyakama: The Seeker of Truth,\" \"The Satyakāma and Upakosala Conversation,\" \"The Satyakāma and Gośruti Conversation,\" \"Truth is Known When All is Seen,\" and \"The World Beyond\") for insights on how traits are identified within a story. Refer to the output format given in the examples of these stories to structure your response. Emulate the approach used in those examples to identify traits within the test story. The number of traits identified can vary from 1 to 30. Ensure the output is in plain text format without markdown, bold text, or any special formatting. Please refrain from providing answers for the example inputs; instead, focus on understanding how traits are discerned from them to apply the same methodology to the test story.", "input: Satyakama: The Seeker of Truth\nChandogya Upanishad, 4.4 – 4.8\n\nOne day a young boy came to the ashrama of Sage Haridrumata Gautama and said, “Revered Sir, I desire to live under you as a Brahmacharin. Please accept me as your student.”\n\nThe sage asked, “Dear boy, of what gotra or lineage are you?”\n\nThe boy replied, “Sir, I do not know of what gotra I am. I asked it of my mother. She said: ‘I also do not know of what gotra you are. I used to serve many people and I got you in my youth. So I am not sure of what lineage you are. However, I am Jabala by name and you are Satyakama’. So, Sir, I reveal myself to you as Satyakama Jabala.”\n\nOn hearing it, the Rishi Haridrumata Gautama smiled and said, “No one who is not a Brahmin can speak thus. Dear boy, bring the sacrificial fuel. I shall initiate you as a Brahmacharin, for you have not deviated from truth.” Thus was Satyakama Jabala initiated into the life of a Brahmacharin.\nAfter a few days, Rishi Haridrumata Gautama sorted out four hundred lean and weak cows and said to Satyakama, “Dear boy, take these cows to the forest and graze them.”\n\nSatyakama bowed down with submission and while driving the cows said, “Sir, I shall not return till these cows multiply into a thousand.”\n\nSatyakama lived in the forest and looked after the cows.\n\nYears went by. The number of cows increased to a thousand.\nOne day towards evening a bull came to Satyakama and spoke to him, “Dear boy! Now we are a thousand in number. Take us to the house of the teacher”. Also, the bull said to Satyakama,”I shall teach you one quarter of the Brahman or God. He is Prakashavan or the Radiant. He who meditates on Brahman as the Radiant, becomes radiant in this world.” Thus having spoken the bull told Satyakama that Agni, the God of fire, will teach him more later.\n\nAt dawn, Satyakama drove the cows towards his Guru’s ashrama.\n\nIn the evening when the cows came together, he kindled a fire there, added fuel to the fire, penned the cows and sat down near them behind the fire, facing east. Then the Fire addressed him and said: “Dear boy, I will teach you one quarter of the Brahman. He is Anantavan or the Endless. One who knows Him to be thus and meditates upon him as Endless, becomes endless in this world”. Then the fire told him that a swan was going to tell him about the third quarter of the Brahman.\n\nAt dawn, Satyakama continued to drive the cows towards the Guru’s ashrama. Towards evening when the cows came together, he kindled a fire there, added fuel to the fire, penned the cows and sat down near them behind the fire, facing east. All of a sudden a swan came flying and said, “Satyakama! I shall teach you the third quarter of Brahman. He is called Jyotishman or the Effulgent. One who knows him thus and meditates upon him as the Effulgent, becomes effulgent in this world.” Then the swan told him that a waterfowl would teach him the last part of the Brahman.\n\nOn the following day, once again, Satyakama drove the cows in the direction of his Guru’s ashrama.\n\nTowards evening when the cows came together, he kindled a fire there, added fuel to the fire, penned the cows and sat down near them behind the fire, facing east. Then, a waterfowl came before him and said, “Satyakama! I shall teach you the fourth and last part of Brahman. He is Ayatanavan or the All-supporting. One who knows him thus and meditates upon him as the All-supporting, becomes That in this world.”\nWhen Satyakama reached the Guru’s ashram with the thousand cows, the Guru asked him, “Dear boy, your face shines with the knowledge of Brahman. Who taught you that?”\n\nSatyakama told him about his four teachers and said, “Sir, I now request you to expound it to me personally. Because I know that the knowledge received directly from one’s own Guru becomes perfect.”\n\nThen Rishi Haridrumat Gautama, the revered teacher of Satyakama, taught him the same thing again by adding more meaning to all that Satyakama had learnt. Thus Satyakama got the full knowledge of Brahman from his Guru and later, he himself became a great teacher.", "output: 1. Propagation of truth: Satyakāma narrates the truth that he and his mother, Jābālā, are unaware of his Gotra as his mother obtained him when she was very young and was attending many guests at her husband’s home. Satyakāma Jābāla’s such narration without hesitation, guilt, or fear pleases Guru Haridrumata. Satyakāma, being not deviated from the truth, was then ordained of the Brahminical rites by Haridrumata as ‘no one else apart from the Brahmana can tell the truth’. The name Satyakāma itself refers to ‘someone who wishes only Truth’. All the three interlocutors in this story are the subscribers of truth, mother Jābālā, her son Satyakāma, and his Guru Haridrumata as they maintain and respect truthfulness. Satyakama’s adherence to the truth, his faith in his mother, and Guru’s trust in the honest disciple give us a great insight on the beginning of a spiritual journey where the Seeker of the Truth already has the highest quality of the disciple in him, and now he needed mere a direction towards the higher knowledge.\n\n2. Pursuit of Knowledge: A young Satyakāma, the seeker of the Truth, wants to acquire more knowledge about the Brahman from Guru Haridrumata of the Gautama Gotra (lineage).\n\n3. Intellectual Tenacity: After ordaining him of the Brāhmiṇical rites, Haridrumata gives him four hundred lean and weakly cows and asked him to attend those. Satyakāma passed many years in the forest to attend those till they had multiplied in the thousands. An epistemically motivated disciple, inquisitive and curious, spends an abundant amount of time of one’s prime life, in the Pursuit of Knowledge suggests a high level of Intellectual Tenacity. \n\n4. Cognitive Closure: In the forest, the four deities in the form of animals, one by one, teach the Truth to Satyakāma that the Brahman is Prakāśavān (‘the Luminous one’), Anantavān (‘the Endless one’), Jyotiṣmān (‘the Effulgent or the Radiant one’), and Āyatanavān (‘the Spacious one’, or ‘All-supporting one’, ‘the Repository’), respectively. Each deity imparted only quarter of the Truth and Satyakāmā maintains his inquisitiveness till the end to know the Truth in its entirety to attain a complete Cognitive Closure. \n\n5. Respects Others’ Opinions: It driven by the need of Epistemic Self-improvement and is maintained by an individual who Respects Others’ Opinions. Satyakāma, at every step, was inquiring for further knowledge from the deities saying “Relate it to me, Sir”. “Explain it sir, if you please”, “Relate, O Lord!”, etc. \n\n6. Proper self-assessment: This is shown by the four deities each of whom disclosed the nature of the Brahman only partially, owning their limitations into other facets of the Brahman and leaving those facets to be disclosed by the remaining deities. \n\n7. Owning His Cognitive Limitations: It is shown by the four deities each of whom disclosed the nature of the Brahman only partially, owning their limitations into other facets of the Brahman and leaving those facets to be disclosed by the remaining deities. \n\n$$\n1. Propagation of truth\n2. Pursuit of Knowledge\n3. Intellectual Tenacity\n4. Cognitive Closure\n5. Respects Others’ Opinions\n6. Proper self-assessment\n7. Owning His Cognitive Limitations\n$$", "input: The Satyakāma and Upakosala Conversation \n(The Story of Upakosala)\n\nUpakosala was the son of one Kamala. He dwelt as a brahmacharin with Satyakama Jabala, living with and studying from Satyakama for twelve years. At the end of his study, when he was about to leave the house of Satyakama he was not allowed to depart. He became very sad when he came to know that all his friends were allowed to go.\n\nThe wife of Satyakama was very kind towards Upakosala, and she pleaded with her husband to allow Upakosala to go home like the rest of his disciples, but Satyakama not only refused to do so but also went off on a journey. At this point Upakosala was so sad and sick at heart that he could not eat. The teacher’s wife treated him with tender affection, offered him food, but to no avail. She kept insisting that he must take food otherwise he would not survive. At last the boy cried out to her saying, “O mother, my heart is still so impure; I am too unhappy to eat!”\n\nSatyakama knew that Upakosala had not yet learned all that was necessary for him and was not ready to lead the life of a householder as per dharma. Upakosala too was aware that his was not an academic failure, but rather one of interior disposition. He kept saying to the wife of Satyakama that in him there were many desires which tend towards many things and he was filled with those. Upakosala understood that the desires may not be negative or foolish, yet they pull one in many directions, whirling one around and confusing one’s mind and consuming all of one’s life energies. Only when the mind is fixed on the One can the many be safely attended to. Upakosala kept aspiring for attaining this oneness with the One.\n\nOne day he heard a voice from the sacred fire Brahman or Agni saying to him, “This life is Brahman, the ka (denoting bliss/ pleasure) is Brahman, kha (denoting ākāśa/ sky )is Brahman, know thou Brahman!\n\nTo this Upakosala replied, “I know that life is Brahman, but that ka is Brahman or that kha is Brahman I do not know.”\nAgain came the voice from out the fire, this time explaining that by sky was meant the lotus of the heart, wherein dwells Brahman, and that by bliss was meant the bliss of Brahman. “Both” said the voice, “refer to Brahman”, and continuing it taught Upakosala thus, “Earth, food, fire, sun–all these that you worship–are forms of Brahman. He who is seen in the sun–that one am I. He who dwells in the east, in the north, in the west, and in the south, he who dwells in the moon, in the stars, and in water–that one am I. He who dwells in the sky and makes the lightning his home–that one also am I. Know well the true nature of the world that it may never do you harm.”\n\nThereupon the fire, which had been only an earthly fire with which to prepare sacrifices, assumed a new aspect and became the Lord himself. The earth was transformed; life was transformed; the sun, the moon, the stars, the lightning–everything was transformed, and deified. And thus it was that to Upakosala the true nature of all things was revealed.\n\nIn due time Satyakama returned home. When he saw Upakosala, he said, “My son, your face shines like one who knows Brahman. Who has taught you?” “Beings other than men” replied Upakosala. Then said Satyakama, “My son, what you have learned is true. True also is this that I teach you now. Lo, to him who knows it shall no evil cling, even as drops of water cling not to the leaf of the lotus. He who glows in the depths of your eyes– that is Brahman; that is the Self of yourself. He is the Beautiful One, he is the Luminous One. In all the worlds, forever and ever, he shines!”\n\nThus saying, Satyakama explains to Upakosala more about the Brahman and finally declares him as a worthy disciple of his.\"", "output: 1. Admitting his Cognitive Limitations: Upakosala admits that he knows the Breath is Brahman but he does not know that ka (denoting bliss/ pleasure) and kha (denoting ākāśa/ sky) are Brahman.\n\n2. Proper Pride: IH in Upakosala is characterized by the nonjudgmental and non-threatening awareness of his intellectual fallibility, and a productive way to handle it. The disposition of being curious, to be investigative and metacognitive show the critical thinking on the part of the listener, Upakosala, who had a proper self-assessment known as Proper Pride where he is consciously aware of his or her own qualities. \n\n3. Intellectual Tenacity: Upakosala had spent the life of a Vedic student under at Satyakāma Jābāla and tended his fires for twelve years. \n\n4. Need for Cognition: Upakosala had spent the life of a Vedic student under at Satyakāma Jābāla and tended his fires for twelve years. \n\n5. Respect for Others’ Opinions: Guru Satyakāma trusts the three Agnis to be authoritative to talk about Agni-vidyā, instead of himself preaching a third-person narration on it. Agnis, too, admit that the teacher only will better explain about the process further. All of them depict the virtue of Respect for Others’ Opinions, the other-oriented trait of IH, marked by a lack of pretentiousness, boastfulness, or conceit.\n\n$$\n1. Admitting his Cognitive Limitations\n2. Proper Pride\n3. Intellectual Tenacity\n4. Need for Cognition\n5. Respect for Others’ Opinions\n$$", "input: The Satyakāma and Gośruti Conversation \n(Satyakāma reveals the secret to Gośruti)\n\nGoshruti was the son of Vyaghrapada. He was a student of sacred knowledge. He stayed with the teacher, as was usual in those days, for the neces­sary period of instruction and practical training for the knowledge of Brahman. His teacher was Satyakama, who himself had gone through a long course of discipline, tapasya, in order to receive the blessings of his teacher, Haridrumata Gautama. And by the power of his celibacy, brahmacarya, and service to the guru (Satyakama could win the favour of gods who taught him several aspects of Brahman indeed. Satyakama learnt the truths by their grace and received the knowledge so well that when the teacher saw him later, he found him to be shining with the knowledge of Brahman. This Satyakama, in due course, became adept and specialized in more than one method of approach to the knowledge of Brahman. He was the teacher who initiated Upakosala, son of Kamala, into what is called Akshi-purusha Vidya that describes the being seen in the eyes as Brahman.\n\nGoshruti was one of the disciples of Satyakama who deserved special attention. When Satyakama found him to be ready for receiving the highest knowledge he initiated him to the knowl­edge of Prana Vidya. By this knowledge one could assuredly develop, to a large extent, the formative powers of Life and expression of the Spirit. Goshruti receives prana vidya with all its subtle applications and methods of sacrifice. The implications of the vidya, obviously, is the realization of the Life Spirit itself which creates everything and keeps them blooming. This vidya is brahma vidya itself. For the prana mentioned here is mukhya or principal prana, which is Brahman itself, not those which have smaller areas or planes of operation like apana, vyana, samana and udana. The prana vidya culminates in the realization of the truth expressed in statements like sarvam khalvidam brahma - all indeed is Brahman or aham brahmasmi - I am that Brahman.\n\nThis prana vidya is not to be equated with pranayama, which is concerned only with regulation or control of breath, whereas prana vidya being brahma vidya itself refers to that state of the universal, Primordial Life Force, ‘breathing without breath’. To rise to this pre-existential condition, the Upanishad formulates two stages. One is to identify onself with akasha, and other with prana. The akasha referred to here is not the grosser or elemental aspects of space, and the prana mentioned is not the mere breath. Both are to be taken as the Infinite Brahman. The akasha the Upanishads refer to is the limitless chidakasha, the Universal Consciousness, or the daharakasha, the Indwelling Consciousness i.e. Brahman itself. It is only the infinite self-existent consciousness (Brahman) which makes it possible for all the inner and the outer existents, including their revelation as existents.\n\nSimilarly the prana referred to here is the same principle which makes (it) possible (for) all life to live, being the primordial pulse, a creative dynamics behind the micro and the macro. This prana can never be other than the supreme Brahman. Kena Upanishad states it clearly when it says, ‘not by breath it lives, but by which breath makes everything live’- yat pranena na praniti yenapranahpraniyate. The individual soul, when it realizes itself to be organic with this primordial life force, rises to the level and participates in the functioning of the supra-vital or the supreme Life Principle, the All- pervasive Infinite Brahman. Thus the prana vidya taught by Satyakama to Goshruti leads to the realization of creativity natural to the state of being That, the Brahman.", "output: 1. Intellectual tenacity: Satyakāma narrates a conversation between the Breath and Speech and the rest to Gośruti Vaiyāghrapadya, the son of Vyāghrapāda, who had stayed with his teacher for the sacred knowledge. Satyakāma himself had gone through a long course of tapasyā (austerity) and brahmacarya (celibacy) to obtain knowledge from his teacher. Gośruti too depicts the Intellectual tenacity and patience that is required to pursue the Truth.\n\n2. Respect for Other’s Opinion: There is a sort of monologue by Satyakāma. The prominent virtue that is evident from the monologic method of teaching philosophy is the Respect for Other’s Opinion as depicted by the disciple. Gośruti listens to his teacher’s knowledge patiently and trusts his ability in imparting Prāṇa-vidyā. \n\n3. Pursuit of knowledge: Goshruti was a student of sacred knowledge. He stayed with the teacher for the necessary period of instruction and practical training for the knowledge of Brahman. Satyakama himself had gone through a long course of discipline to receive the blessings of his teacher. Satyakama learnt the truths by their grace and received the knowledge so well.\n\n4. Love for learning: Goshruti deserved special attention and was ready for receiving the highest knowledge. He received prana vidya with all its subtle applications and methods of sacrifice. Satyakama became adept and specialized in more than one method of approach to the knowledge of Brahman.\n\n$$\n1. Intellectual tenacity\n2. Respect for Other’s Opinion\n3. Pursuit of knowledge\n4. Love for learning\n$$", "input: Truth is Known When All is Seen\nFrom Chandogya Upanishad Section 5\n\nPrachinashila, the son of Upamanyu; Satyayajna, the son of Pulusha; Indradyumna, the son of Bhallavi; Jana, the son of Sarkaraksha; and Budila the son of Ashvatarashva, were five great married rishis, all adept in the Vedas. Once they all together conducted a discussion on: ‘Which is our Atman, Who is Brahman?’ But they failed to reach a consensus and decided to visit Rishi Uddalaka, son of Aruna and father of Shvetaketu, for clarification. They knew that Uddalaka was serious student of the knowledge of Vaishvanara Atman (the All-self).\n\nNo doubt Uddalaka was a great realized Rishi and a great teacher, but when these five sages appeared before him and requested him to teach them that knowledge, he felt a bit awkward, and very hesitant to speak of his own knowledge. It was the very nature of Uddalaka that he always wanted to add to his knowledge, and he took this as an opportunity to learn more about that very knowledge. So he requested the five sages that they all should proceed to Ashvapati, son of Kekaya, who according to Uddalaka was a more knowledgeable and authoritative person on Vaishvanara Atman.\n\nNow all these five sages, led by Uddalaka, went to the palace of king Ashvapati. On reaching the king’s palace they were individually honoured. The king informed them that a sacrifice was going to be performed and promised each one wealth equivalent to that of the officiating priest’s remuneration. The king then declared that in his kingdom there were no thieves, misers, drunks, none who did not perform sacrifices, none illiterate, no lewd persons, or adulteress (the king was establishing his good conduct for persons of high standing—like these rishis—do not accept gifts from ill-minded people. The six rishis rejected the king’s offer for wealth saying that they had come for the knowledge of Vaishvanara that he possessed.\n\nAshvapati agreed to teach them and on the next day the rishis approached the king as pupils. He instructed them in the secret and complete knowledge of the Vaishvanara Atman, and told them that this is the reality that connects the individual with the universal through sacrifice and meditation.\n\nAshvapati addressed to each of these sages separately to find out about their sadhana and then explained each of them about Vaishvanara Atman in terms of their own object of meditation. King Ashvapati told one of the disciples that the Self that he meditates upon as heaven is the good Light and that is the Head of the Vaisvanara Self. To the second disciple who meditates upon sun as the Self he says that the Self meditated upon by him is the universal form and is the eye of the Vaisvanara Self. To the third disciple who meditates upon the air as Self he says that the Self meditated upon is the variegated course and is the Prana of the Vaisvanara Self. To the fourth disciple who meditates upon akasha as the Self he confirms that the Self meditated upon is bahula or full and is the trunk of the Vaisvanara Self. The fifth disciple who meditates upon water as the Self was explained by him that his object of meditation is nothing but the Vaisvanara Self called rayi and that is the bladder of the Vasvanara Self. To the sixth disciple who meditates upon earth as the Self he explained that the object of his meditation is the Self called pratishtha and that is the feet of the Vaisvanara Self.\n\nFinally, pointing to the limitations of the knowledge of these Rishis, he said to them that it is not by meditating on parts that one can know the all. The truth is known when all is seen. Therefore realizing the whole consisting of all parts one has the experience of Vaishvanara Atman.", "output: 1. Revisiting One's Beliefs:\n- Uddalaka, despite being a great teacher, felt hesitant to share his knowledge and sought to learn more from Ashvapati.\n\n2. Readiness to Correct One's Beliefs:\n- The five sages were willing to question their own understanding of the Atman and seek clarification from Uddalaka and Ashvapati.\n\n3. Metacognition:\n- Uddalaka recognized his own limitations and sought to expand his knowledge.\n- Ashvapati tailored his teachings to the individual perspectives of the sages, demonstrating an understanding of their cognitive processes.\n\n4. Seeking Truth:\n- The five sages and Uddalaka were driven by a desire to understand the true nature of the Atman.\n- Ashvapati shared his knowledge with the sages, recognizing their genuine pursuit of truth.\n\n5. Respect for Other's Opinion:\n- The sages respected Uddalaka's hesitation and sought his guidance.\n- Ashvapati listened to the sages' perspectives and tailored his teachings accordingly.\n\n6. Intellectual Tenacity:\n- The sages persisted in their pursuit of knowledge, traveling to Ashvapati's palace and engaging in discussions.\n\n7. Patience:\n- Uddalaka and Ashvapati patiently guided the sages in their understanding of the Atman.\n\n8. Need for Cognition:\n- The sages and Uddalaka exhibited a strong desire to acquire knowledge and deepen their understanding.\n\n9. Intellectual Courage:\n- The sages were willing to question their own beliefs and seek knowledge from others.\n\n10. Proper Self-Assessment:\n- Uddalaka recognized his own limitations and sought to learn more.\n- Ashvapati tailored his teachings to the individual perspectives of the sages, demonstrating an understanding of their cognitive processes.\n\n$$\n1. Revisiting One's Beliefs\n2. Readiness to Correct One's Beliefs\n3. Metacognition\n4. Seeking Truth\n5. Respect for Other's Opinion\n6. Intellectual Tenacity\n7. Patience\n8. Need for Cognition\n9. Intellectual Courage\n10. Proper Self-Assessment \n$$", "input: The World Beyond\nFrom Chandogya Upanishad, 5.3-10\n\nShvetaketu was the son of Uddalaka Aruni. After his education from the Gurukula he was further instructed by his father at home and became much more learned than what he was before. Shvetaketu always thought himself to be the wisest among all. Once he decided to go to the assembly of the Panchala. There, in the assembly, the Kshatriya prince Pravahana addressed him saying, “Have you had your full education, my dear?” To this Shvetaketu replied, “Yes, indeed.” Then the prince started asking questions to him in the following manner:\n\nPravahana – “Do you know where all living beings go to after death?”\n\nShvetaketu – “No, revered Sir, I do not know.”\n\nPravahana – “Do you know how they return?”\n\nShvetaketu – “No, revered Sir, I do not know.”\n\nPravahana – “Do you know the two paths, the path of light (devayana) and the path of darkness (pitriyana) along which the dead ones travel?”\n\nShvetaketu – “No, revered Sir, I do not know.”\n\nPravahana – “Do you know why the other world does not become overfull though so many continue to depart from this world and enter it.?”\n\nShvetaketu – “No, revered Sir, I do not know.”\n\nPravahana – “Do you know how the fifth stage elemental matter in the oblation becomes the purursha or the living person?”\n\nShvetaketu – “No, revered Sir, I do not know.”\n\nPravahana – “Then how dare you say that your education is complete? You seem to know nothing of these subjects.”\n\nShvetaketu was distressed and felt very much humiliated at this. So he returned home and asked his father Uddalaka, “Revered father, you told me that you have instructed me well. But when prince Pravahana asked some five questions, believe me, I could not reply even one of those. How then did you say to me that I was sufficiently educated?” Saying this to his father, Shvetaketu then narrated the whole story about the five questions and his awkwardness in the assembly of the Panchalas.\n\nUddalaka, the loving father of Shvetaketu, listened everything carefully and replied: “Believe me my dear child. I myself do not know anything about any of these questions. If I had that knowledge, do you think that I have ever withheld it from you?” Saying this to his son, Uddalaka decided to go the assembly of Panchala to learn about this knowledge from prince Pravahana.\n\nIn the palace of Pravahana, Uddalaka was received with due respect. The next morning when he presented himself at the assembly, Pravahana told him respectfully, “Sir, I offer you wealth which is dear to all. You can demand as much as you please.” At this Uddalaka said, “O great prince, let the wealth remain with you. Tell me about the questions you have asked to my son. I am thirsting for the knowledge of the other world.”\n\nThe prince was perturbed and yet pleased with the attitude of the Brahmin sage. He then requested Uddalaka to stay with him for a long time. At the end of the period Pravahana said to Uddalaka, “O revered Gautama (another name of Uddalaka), prior to you this knowledge never went to any Brahmin. This knowledge has been traditionally known only to the Kshatriyas. It is only now and for the first time that a Brahmin is receiving it from a Kshatriya king.” Saying this, Pravahana started giving Uddalaka the answers to all the questions he had asked to Shvetaketu.\n\nThe essence Pravahana’s teachings to Uddalaka can be put in the following manner:\n\nThe elemental matter gets converted into life or a person gradually by going through five different stages. These five different stages represent five different sacrifices. There is the first stage where the elemental matter is the oblation offered to the fire and the sun. As a result Soma, the life-giving sap is produced. In the second offering, this Soma is poured into Parjanya, the power that brings rain. This results in the rain itself. The showering of the rain on the earth is the third sacrifice which results in food. When man consumes food it gets digested, as the fourth sacrifice, and the Retas or the vital fluid is produced. This Retas takes up a different form in man and woman, and when the Retas of the man gets united with that of the woman, as the fifth sacrifice, then the embryo is born and from this the child.\n\nThe physical body of the man dissolves into the elements which constituted it. But the destiny of the soul depends on the actions performed and the knowledge acquired. The one who has attained the real spiritual knowledge goes by the path of light and does not return to the earthly existence. The one with no knowledge or partial knowledge goes by the path of darkness and falls into the eternal cycle of birth and death and suffers. Thus, some go to the world of Brahman and never return, some go the heaven and remain there for some time and return to the earth to complete their works, and numerous others are caught up in the ever-recurring cycle of birth and death. That is why the other world is never overfull.\n\nIn short, this is the knowledge of life and its origin, of the destiny of the soul after death, imparted by Kshatriya king Pravahana to Uddalaka, the aspiring Brahmin.", "output: Owning Cognitive Limitations: Shvetaketu initially believed himself to be very knowledgeable, but later realized his limitations when Pravahana questioned him on important subjects.\nReadiness to Correct One's Beliefs: Uddalaka acknowledges that he did not know the answers to Pravahana's questions and sought to correct his understanding by seeking knowledge from Pravahana.\nMetacognition: Shvetaketu reflected on his education and realized that he lacked knowledge in certain areas.\nIntellectual Courage: Uddalaka ventured into Pravahana's assembly, despite knowing that he was less knowledgeable, in order to acquire new knowledge.\nRespect for Other's Opinions: Uddalaka considered Pravahana's wisdom to be valuable, even though Pravahana was from a different social class.\n\n$$\n1. Owning Cognitive Limitations\n2. Readiness to Correct One's Beliefs\n3. Metacognition\n4. Intellectual Courage\n5. Respect for Other's Opinions\n$$", ] def recog_ih(input_text, prompt): prompt.append(f"input: Avoid limiting the number of traits to 4, 5, or 10; explore a diverse range of traits.\n\ntest story\n {input_text}") prompt.append("output: ") response = model.generate_content(prompt_parts).text.replace('•', ' *') traits = response.split("$$") return traits[0], traits[1] st.set_page_config(page_title = "IH Traits", layout="wide") st.title("IH Trait Recogniser") col1, col2 = st.columns([1.2,2], gap = "large") col1.title("Input Story") input_text = col1.text_area("Please paste your story here", height=500) if col1.button("Run"): with st.spinner("Analysing..."): output1, output2 = recog_ih(input_text, prompt_parts) st.success("Analysis Completed") # Right side of the app col2.title("IH Results") col2_1,col2_2 = col2.columns([3.5, 1],gap="small") with col2_1: st.subheader("Summary and Analysis") if 'output1' in locals(): with st.container(): st.text(output1) with col2_2: st.subheader("Identified traits") if 'output2' in locals(): with st.container(): st.text(output2)