Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Getting a random letter, number or words on Gemini responses

We need help on this one. So we are trying this Gemini Pro to be incorporated on our chatbot, and I'm using the Rest API. Then upon testing we are getting some random words/punctuations but on the second try it will give us the correct response. What's the reason of these issue? How can we handle this one?geminiIssue.png

This is the body that I'm passing to the API: { "contents" : [{"role": "user", "parts":[{ "text":${userCurrentInput}}]}], "safetySettings": [ { "category": "HARM_CATEGORY_HARASSMENT", "threshold": "BLOCK_NONE" }, { "category": "HARM_CATEGORY_HATE_SPEECH", "threshold": "BLOCK_NONE" }, { "category": "HARM_CATEGORY_DANGEROUS_CONTENT", "threshold": "BLOCK_NONE" }, { "category": "HARM_CATEGORY_SEXUALLY_EXPLICIT", "threshold": "BLOCK_NONE" } ]}


For the value of ${userCurrentInput}:

[ { "role": "user", "parts": [ { "text": "Hi" } ] }, { "role": "model", "parts": [ { "text": "Hello! I'm Gemini, a multimodal AI model, developed by Google. How may I assist you today?" } ] }, { "role": "user", "parts": [ { "text": "How is electricity generated?" } ] } ]

Result: "parts": [ { "text": ",pade??? lustigeAlterFieldgrounded" } ]


{ "role": "user", "parts": [ { "text": "Hi" } ] }

Result: "parts": [ { "text": "?datasource\n ?? ???SafeMath SafeMathSafeMathSafeMathSafeMathSafeMath ??? OVER/SafeMathSafeMathSafeMathSafeMathSafeMath SafeMath SafeMath SafeMath SafeMathSafeMathSafeMath SafeMathSafeMath SafeMath SafeMath SafeMath SafeMath SafeMath SafeMath SafeMathSafeMath SafeMath SafeMath" } ]

1 0 605
0 REPLIES 0