Mbonea commited on
Commit
39f9575
1 Parent(s): 13a3a04
Files changed (1) hide show
  1. App/Generate/utils/GroqInstruct.py +45 -0
App/Generate/utils/GroqInstruct.py CHANGED
@@ -55,3 +55,48 @@ def chatbot(prompt: str, model: str = "llama3-70b-8192"):
55
  ],
56
  )
57
  return response.dict()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  ],
56
  )
57
  return response.dict()
58
+
59
+
60
+ def tagger(
61
+ narration: str, response_model: BaseModel, model: str = "mixtral-8x7b-32768"
62
+ ):
63
+
64
+ response: response_model = client.chat.completions.create(
65
+ model=model,
66
+ max_tokens=5000,
67
+ response_model=response_model,
68
+ messages=[
69
+ {
70
+ "role": "user",
71
+ "content": f"Given the following narration {narration} extract the data",
72
+ },
73
+ ],
74
+ )
75
+ return response
76
+
77
+
78
+ # x = tagger(
79
+ # narration=""" In a quaint village nestled between rolling hills and emerald forests, there lived a young woman named Elara. With her radiant ruby eyes, sprinkled with freckles, and a smile that could light up the darkest night, she was the heart and soul of her village. Elara had short, chestnut hair that framed her face perfectly, and she always adorned herself with dark makeup that accentuated her striking features.
80
+
81
+ # Elara's days were spent wandering the lush meadows, picking wildflowers, and capturing the beauty of nature with her old, trusty camera. She had a gift for photography, a talent passed down from her mother, who had been the village's historian. Elara's photographs were more than just images; they were stories, each one capturing the essence of the moment and the soul of her subjects.
82
+
83
+ # One misty morning, as the soft light of dawn painted the sky in hues of pink and gold, Elara ventured into the forest, her camera slung over her shoulder. She had heard whispers of an ancient tree deep within the woods, a tree that was said to grant wishes to those who found it. Intrigued and driven by her insatiable curiosity, she set out on her journey.
84
+
85
+ # The forest was a mystical place, with towering trees and a carpet of moss that muffled her footsteps. As she walked, she could feel the magic in the air, a palpable energy that made her heart race with excitement. After hours of wandering, Elara stumbled upon a clearing, and there it stood—the ancient tree, its gnarled branches reaching out like welcoming arms.
86
+
87
+ # Elara approached the tree with reverence, her breath catching in her throat. She placed her hand on the rough bark and closed her eyes, making a silent wish. In that moment, the forest seemed to hold its breath, and a gentle breeze rustled the leaves, as if acknowledging her presence.
88
+
89
+ # When Elara opened her eyes, she saw a small, delicate flower blooming at the base of the tree, its petals shimmering with an ethereal light. She knelt down and carefully picked the flower, feeling a sense of peace wash over her. As she stood, she noticed a figure emerging from the shadows—a young man with kind eyes and a warm smile.
90
+
91
+ # He introduced himself as Aric, a wanderer and a storyteller. He had been searching for the ancient tree as well, drawn by the same legends that had brought Elara there. The two quickly became friends, sharing stories and dreams as they made their way back to the village.
92
+
93
+ # Days turned into weeks, and Elara and Aric grew inseparable. Together, they explored the beauty of their world, capturing moments with Elara's camera and weaving tales with Aric's words. Their bond blossomed into a deep and abiding love, one that was as timeless as the ancient tree that had brought them together.
94
+
95
+ # Years later, as they stood hand in hand beneath the tree's sprawling branches, they made a new wish—for a lifetime of adventures, love, and stories yet to be told. And as the wind whispered through the leaves, it seemed to carry their wishes to the heavens, sealing their fate with the magic of the forest.
96
+
97
+ # Elara and Aric's love story became a legend in their village, a tale of serendipity, dreams, and the enduring power of love. And though the years passed and the world changed, the ancient tree stood as a testament to their timeless bond, a symbol of hope and the beauty of wishes fulfilled.""",
98
+ # response_model=YouTubeUploadTask,
99
+ # )
100
+
101
+
102
+ # print(x)