|
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}") |