I am using the Gemini API, and need some help. When I ran my code that I got from the docs it returned:
<google.generativeai.types.generation_types.GenerateContentResponse>
.
Here is my code
import pathlib
import textwrap
import google.generativeai as genai
from IPython.display import display
from IPython.display import Markdown
def to_markdown(text):
text = text.replace('•', ' *')
return Markdown(textwrap.indent(text, '> ', predicate=lambda _: True))
genai.configure(api_key='AN API KEY WAS HERE')
model = genai.GenerativeModel('gemini-pro')
response = model.generate_content("What is the meaning of life?")
print(response)
I ran this, and got the response above.
That's a google object of the response you are getting. You need to mention as response.text to get the actual text.
Like this:
print(response.text)