import pathlib
import textwrap
import os, sys
import google.generativeai as genai
sys.stdin.reconfigure(encoding='utf-8')
sys.stdout.reconfigure(encoding='utf-8')
from IPython.display import display
from IPython.display import Markdown
# Configure API key for genai
genai.configure(api_key='A*****************************************A')
# Ensure UTF-8 encoding is used for output
reset_color = "\033[0m"
black = "\033[30m"
messages = []
def multiply(a: float, b: float):
"""Returns the product of two numbers."""
return a * b
calculator = {
'function_declarations': [
{
'name': 'multiply',
'description': 'Returns the product of two numbers.',
'parameters': {
'type_': 'OBJECT',
'properties': {
'a': {'type_': 'NUMBER'},
'b': {'type_': 'NUMBER'}
},
'required': ['a', 'b']
}
}
]
}
model = genai.GenerativeModel(
system_instruction="You are a helpful assistant",
model_name='gemini-1.5-pro-latest',
safety_settings={'HARASSMENT': 'block_none'},
tools=[calculator]
)
chat1 = model.start_chat(history=[])
while True:
user_input = input("user input: ")
response = chat1.send_message(user_input)
print(response.text)
1 how the function from response would be called?
2. I am getting strange marks in responses :Example :user input: how are you?
I am a helpful assistant. đź�Š How can I help you today? đź�Š<— what is this . some kind of utf issue?