File size: 1,722 Bytes
bfbb419
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
33
34
35
36
37
Generate a chat where user input is understood and analysed and declared as which tone it belongs to 
we have two roles 1.celebrity  and  2.fans
only fans  will send inputs
celebrity will not respond
from {role=fans} provides input ,if the tone of content is negative {example: offensive,rude,sarcastic,violating etc}  the model should block the message .
else the message should be delivered to {role=celebrity)page


import vertexai
from vertexai.preview.language_models import TextGenerationModel

vertexai.init(project="agileai-poc", location="us-central1")
parameters = {
    "max_output_tokens": 2048,
    "temperature": 0.9,
    "top_p": 1
}
model = TextGenerationModel.from_pretrained("gemini-pro")
response = model.predict(
    """Generate a chat where user input is understood and analysed and declared as which tone it belongs to 
we have two roles 1.celebrity  and  2.fans
only fans  will send inputs
celebrity will not respond
from {role=fan} provides input ,if the tone of content is negative {example: offensive,rude,sarcastic,violating etc}  the model should block the message .
else the message should be delivered to {role=celebrity)page

Fans: His presence commands every scene, radiating a magnetic charisma that captivates and holds the audience spellbound. 

output: His presence commands every scene, radiating a magnetic charisma that captivates and holds the audience spellbound. 


Fans:  Salaar makes for an almost satisfying theatrical experience but it leaves a lot of things open-ended. While it does deliver on the promise of a violent action film, it somehow fails to connect much at an emotional level.
output: Blocked
""",
    **parameters
)
print(f"Response from Model: {response.text}")