Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
Change-Id: Ib052095b489a28ca5a2fc7338c8fefd5ac0adbc5
  • Loading branch information
MarkDaoust committed Jun 28, 2024
1 parent 67eefd2 commit 98e465d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions google/generativeai/types/content_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,8 @@ def _schema_for_function(
)
]
schema = dict(name=f.__name__, description=f.__doc__)
if parameters['properties']:
schema['parameters'] = parameters
if parameters["properties"]:
schema["parameters"] = parameters

return schema

Expand Down
3 changes: 2 additions & 1 deletion samples/function_calling.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def stop_lights():
light_controls = [enable_lights, set_light_color, stop_lights]
instruction = (
"You are a helpful lighting system bot. You can turn lights on and off, "
"and you can set the color. Do not perform any other tasks.")
"and you can set the color. Do not perform any other tasks."
)
model = genai.GenerativeModel(
"models/gemini-1.5-pro", tools=light_controls, system_instruction=instruction
)
Expand Down
6 changes: 2 additions & 4 deletions tests/test_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,14 +380,12 @@ def test_to_tools(self, tools):

def test_empty_function(self):
def no_args():
print('hello')
print("hello")

fd = content_types.to_function_library(no_args).to_proto()[0]
fd = type(fd).to_dict(fd, including_default_value_fields=False)
# parameters are not set.
self.assertEqual({'function_declarations': [{'name': 'no_args'}]}, fd)


self.assertEqual({"function_declarations": [{"name": "no_args"}]}, fd)

@parameterized.named_parameters(
["string", "code_execution"],
Expand Down

0 comments on commit 98e465d

Please sign in to comment.