Folks,
I just started to try and evaluate Gemini API and its embeddings feature. However it spins and I got error below. Google’d it and some mentioned to disable certificate verification in code, but I cannot find how to do it. Could you help give some ideas?
gemini_api_key = os.getenv(“GEMINI_API_KEY”)
if not gemini_api_key:
raise ValueError(“Gemini API Key not provided. Please provide GEMINI_API_KEY”)
genai.configure(api_key=gemini_api_key)
for m in genai.list_models():
if ‘embedContent’ in m.supported_generation_methods:
print(m.name)
Kind of. I use my company MacOS computer, which has Ivanti Security Access.
Do I need to setup some proxy or else?
However the quick test appears ok.
curl
-H ‘Content-Type: application/json’
-d ‘{“contents”:[{“parts”:[{“text”:“Write a story about a magic backpack”}]}]}’
-X POST ‘https://generativelanguage.googleapis.com/v1beta/models/gemini-pro:generateContent?key=******’
{
“candidates”: [
{
“content”: {
“parts”: [
{
“text”: “In the bustling town of Willow Creek, nestled amidst towering trees and whispering winds, there lived an ordinary boy named Ethan. Ethan was known for his imagination and his love of all things mystical. One ordinary day, as Ethan ambled home from school, a peculiar sight caught his eye. In the window of an antique shop, gleaming under the golden rays of the setting sun, was a backpack unlike any he had ever seen.\n\nIts rich emerald fabric shimmered with an otherworldly glow, and intricate silver runes adorned its surface. Ethan couldn’t resist the allure of the unknown and stepped inside the shop. As he approached the counter, the air crackled with anticipation. The backpack seemed to hum with a faint energy, drawing him closer. With trembling hands, he reached out and unzipped its main compartment.\n\nTo Ethan’s astonishment, the backpack’s interior was a vast, shimmering void. It was as if an entire universe was contained within its enchanted confines. Ethan gasped in wonder as he realized the true nature of his newfound treasure. This was no ordinary backpack; it was a magic backpack, capable of holding anything he could imagine.\n\nOverjoyed, Ethan bid farewell to the antique shop and set off for home, his magic backpack slung over his shoulder. As he walked, he couldn’t help but experiment with its wondrous abilities. With a thought, he summoned a delicious sandwich that magically appeared before him. He marveled at the towering bookshelf that emerged when he imagined his favorite stories.\n\nNews of Ethan’s magic backpack spread like wildfire through Willow Creek. Children and adults alike flocked to see the wonders it could perform. Ethan shared his magic with others, filling their backpacks with laughter, toys, and the spark of imagination.\n\nBut with great power came great responsibility. Ethan learned that the magic backpack could be used for both good and evil. He vowed to wield its power wisely, using it to brighten the lives of others and to make the world a more enchanting place.\n\nAnd so, Ethan and his magic backpack became the heart of Willow Creek, a symbol of hope, wonder, and the endless possibilities of imagination. And as the years passed, the legend of the magical backpack continued to be told, inspiring generations of children to dream and believe in the extraordinary.”
}
],
“role”: “model”
},
“finishReason”: “STOP”,
“index”: 0,
“safetyRatings”: [
{
“category”: “HARM_CATEGORY_SEXUALLY_EXPLICIT”,
“probability”: “NEGLIGIBLE”
},
{
“category”: “HARM_CATEGORY_HATE_SPEECH”,
“probability”: “NEGLIGIBLE”
},
{
“category”: “HARM_CATEGORY_HARASSMENT”,
“probability”: “NEGLIGIBLE”
},
{
“category”: “HARM_CATEGORY_DANGEROUS_CONTENT”,
“probability”: “NEGLIGIBLE”
}
]
}
]
}
I’d recommend checking if there are any specific proxy configurations required for Python scripts since your environment includes a security access tool.