File size: 1,069 Bytes
2c1eba3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from groq import Groq

def mixtral(script):
    client = Groq(api_key="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")
    length = len(script)
    print("lenghth of script is", length)
    completion = client.chat.completions.create(
        model="llama3-8b-8192",
        messages=[
            {
                "role": "user",
                "content": f"""You have to translate the given text into very simple indian english or hinglish language with basic words or you can also include in just {length+10} words 

                Do not include any note.

                    here is the text.

                    

                    {script}



                    Translation =

                    """
            }
        ],
        temperature=0.3,
        max_tokens=8192,
        top_p=1,
        stream=False,
        stop=None,

    )
    print(completion.choices[0].message.content)
    print("length of response is ", len(completion.choices[0].message.content))
    return completion.choices[0].message.content