The following is my python code:
def generate_recipe(vegetable_dict, target_lang,recipe):
palm.configure(api_key=st.secrets['key'])
prompt = f"Create {recipe} delightful and concise recipes using the following vegetables. Each recipe should include a dish name, a list of ingredients, and cooking instructions. Numbered each recipe\n\nIngredients:\n"
for vegetable, count in vegetable_dict.items():
prompt += f"- {vegetable} ({count} {'piece' if count == 1 else 'pieces'})\n"
prompt += "\nYour recipes should only use the mentioned vegetables. Be creative, and make the instructions clear and easy to follow. These recipes should be suitable for anyone looking to enjoy quick and tasty dishes."
res = palm.generate_text(prompt=prompt)
gt = res.result.replace('*', '') # Remove asterisk marks
# Translate the generated text to the target language
translator = Translator()
translated_text = translator.translate(gt, src='en', dest=target_lang)
return translated_text.text
For every time the above code is returning the same generated answer from the palm server. Im not understanding why it is happening!! Is there any way to get different answers for same input dictionary??? Also do we have anything like "palm.set_random_seed()"