





















The coder comment on the from_callable method in FunctionDeclaration class reads:
"""Converts a Callable to a FunctionDeclaration based on the client.
Note: For best results prefer
[Google-style
docstring](https://google.github.io/styleguide/pyguide.html#383-functions-and-methods)
when describing arguments. This function does **not** parse argument
descriptions into the property description slots of the resulting structure.
Instead it sends the whole docstring in the top-level function description.
Google-style docstring are closest to what the model is trained on.
"""
Hey @medaminezghal, so several tests fail when trying to install 1.55 or modifying your script to 1.57. At least a couple of these are tests that require one to set up a google AI API. See:
ERROR google/genai/tests/interactions/test_paths.py::test_interactions_paths[True-tests/interactions/paths-None] - google.auth.exceptions.DefaultCredentialsError: Your default credentials were not found. To set up Application Default Credentials, see https://cloud.google.com/docs/authentication/external/set-up-adc for more information.
ERROR google/genai/tests/interactions/test_paths.py::test_interactions_paths[False-tests/interactions/paths-None] - ValueError: Missing key inputs argument! To use the Google AI API, provide (api_key) arguments. To use the Google Cloud API, provide (vertexai, project & location) arguments.
ERROR google/genai/tests/interactions/test_paths.py::test_async_interactions_paths[True-tests/interactions/paths-None] - google.auth.exceptions.DefaultCredentialsError: Your default credentials were not found. To set up Application Default Credentials, see https://cloud.google.com/docs/authentication/external/set-up-adc for more information.
ERROR google/genai/tests/interactions/test_paths.py::test_async_interactions_paths[False-tests/interactions/paths-None] - ValueError: Missing key inputs argument! To use the Google AI API, provide (api_key) arguments. To use the Google Cloud API, provide (vertexai, project & location) arguments.
And the rest are some sort of typing errors (and these are the only ones that show up in 1.55):
But even the typing errors seem like they might depend on APIs or at least API specific functions (without looking more deeply at the code than I have), since the output of FunctionDeclaration from_collable method being called on the test input depends on these APIs to structure them.
google/genai/tests/types/test_types.py::test_type_union_with_default_value_all_py_versions
actual_schema_vertex = types.FunctionDeclaration.from_callable(
client=vertex_client, callable=func_under_test
)
assert actual_schema_vertex == expected_schema
E AssertionError: assert FunctionDeclaration(\n description='test generic alias complex array with default value.',\n name='func_under_test',\n parameters=Schema(\n properties={\n 'a': Schema(\n default=[\n 1,\n 'a',\n 1.1,\n True,\n ],\n items=Schema(\n any_of=[\n Schema(\n type=<... Max depth ...>\n ),\n Schema(\n type=<... Max depth ...>\n ),\n Schema(\n type=<... Max depth ...>\n ),\n Schema(\n type=<... Max depth ...>\n ),\n ]\n ),\n type=<Type.ARRAY: 'ARRAY'>\n ),\n 'b': Schema(\n default=[\n 11,\n 'aa',\n 1.11,\n False,\n ],\n items=Schema(\n any_of=[\n Schema(\n type=<... Max depth ...>\n ),\n Schema(\n type=<... Max depth ...>\n ),\n Schema(\n type=<... Max depth ...>\n ),\n Schema(\n type=<... Max depth ...>\n ),\n ]\n ),\n type=<Type.ARRAY: 'ARRAY'>\n ),\n 'c': Schema(\n default=[\n [\n 1,\n ],\n 2,\n ],\n items=Schema(\n any_of=[\n Schema(\n items=<... Max depth ...>,\n type=<... Max depth ...>\n ),\n Schema(\n type=<... Max depth ...>\n ),\n ]\n ),\n type=<Type.ARRAY: 'ARRAY'>\n )\n },\n required=[],\n type=<Type.OBJECT: 'OBJECT'>\n )\n) == FunctionDeclaration(\n description='test generic alias complex array with default value.',\n name='func_under_test',\n parameters=Schema(\n properties={\n 'a': Schema(\n default=[\n 1,\n 'a',\n 1.1,\n True,\n ],\n items=Schema(\n any_of=[\n Schema(\n type=<... Max depth ...>\n ),\n Schema(\n type=<... Max depth ...>\n ),\n Schema(\n type=<... Max depth ...>\n ),\n Schema(\n type=<... Max depth ...>\n ),\n ],\n type=<Type.OBJECT: 'OBJECT'>\n ),\n type=<Type.ARRAY: 'ARRAY'>\n ),\n 'b': Schema(\n default=[\n 11,\n 'aa',\n 1.11,\n False,\n ],\n items=Schema(\n any_of=[\n Schema(\n type=<... Max depth ...>\n ),\n
Hi @medaminezghal, would you mind adding python-pytest-xdist to checkdepends as @gwuensch has suggested?
This breaks downstream packages such as aider-chat, so it would be super helpful if you fixed this error.
Missing check dependency python-pytest-xdist for the -n auto option:
==> Starting check()...
ERROR: usage: pytest [options] [file_or_dir] [file_or_dir] [...]
pytest: error: unrecognized arguments: -n --dist=loadscope google/genai/tests
This no longer builds for me.
FAILED google/genai/tests/live/test_live.py::test_websocket_base_url_no_auth_with_custom_base_url - AssertionError: assert 'wss://test-api-gateway-proxy.com' == 'https://test-api-gateway-proxy.com'
- https://test-api-gateway-proxy.com
? ^^^^
+ wss://test-api-gateway-proxy.com
? ^^
================================= 1 failed, 867 passed, 1 skipped, 158 deselected, 62 warnings in 51.23s ==================================
==> ERROR: A failure occurred in check().
Aborting...
-> error making: python-google-genai-exit status 4
-> Failed to install the following packages. Manual intervention is required:
python-google-genai - exit status 4
@Jawzper if you are on CachyOS then I asked the repo maintainers to rebuild sentencepiece with the new protobuf 32.0 version. Which fixed this issue.
Make sure you install python-pytokens as it is also now required!
BTW, if you are NOT on CachyOS like me, then you need to get in contact with whoever is your repo maintainer and ask them to rebuild it. (or if you want to you can build it with the new protobuf 32.0 yourself)
I'm getting this error, can anyone help? I already have protobuf and python-protobuf packages installed.
====================================================== ERRORS ======================================================
___________________ ERROR collecting google/genai/tests/local_tokenizer/test_local_tokenizer.py ____________________
ImportError while importing test module '/home/jazz/.cache/yay/python-google-genai/src/python-genai-1.36.0/google/genai/tests/local_tokenizer/test_local_tokenizer.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.13/site-packages/_pytest/python.py:498: in importtestmodule
mod = import_path(
/usr/lib/python3.13/site-packages/_pytest/pathlib.py:587: in import_path
importlib.import_module(module_name)
/usr/lib/python3.13/importlib/__init__.py:88: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
<frozen importlib._bootstrap>:1387: in _gcd_import
???
<frozen importlib._bootstrap>:1360: in _find_and_load
???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:935: in _load_unlocked
???
/usr/lib/python3.13/site-packages/_pytest/assertion/rewrite.py:186: in exec_module
exec(co, module.__dict__)
google/genai/tests/local_tokenizer/test_local_tokenizer.py:19: in <module>
from sentencepiece import sentencepiece_model_pb2
/usr/lib/python3.13/site-packages/sentencepiece/__init__.py:10: in <module>
from . import _sentencepiece
E ImportError: libprotobuf-lite.so.31.1.0: cannot open shared object file: No such file or directory
________________ ERROR collecting google/genai/tests/local_tokenizer/test_local_tokenizer_loader.py ________________
ImportError while importing test module '/home/jazz/.cache/yay/python-google-genai/src/python-genai-1.36.0/google/genai/tests/local_tokenizer/test_local_tokenizer_loader.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/usr/lib/python3.13/site-packages/_pytest/python.py:498: in importtestmodule
mod = import_path(
/usr/lib/python3.13/site-packages/_pytest/pathlib.py:587: in import_path
importlib.import_module(module_name)
/usr/lib/python3.13/importlib/__init__.py:88: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
<frozen importlib._bootstrap>:1387: in _gcd_import
???
<frozen importlib._bootstrap>:1360: in _find_and_load
???
<frozen importlib._bootstrap>:1331: in _find_and_load_unlocked
???
<frozen importlib._bootstrap>:935: in _load_unlocked
???
/usr/lib/python3.13/site-packages/_pytest/assertion/rewrite.py:186: in exec_module
exec(co, module.__dict__)
google/genai/tests/local_tokenizer/test_local_tokenizer_loader.py:19: in <module>
import sentencepiece as spm
/usr/lib/python3.13/site-packages/sentencepiece/__init__.py:10: in <module>
from . import _sentencepiece
E ImportError: libprotobuf-lite.so.31.1.0: cannot open shared object file: No such file or directory
================================================= warnings summary =================================================
../../../../../../../usr/lib/python3.13/site-packages/_hypothesis_pytestplugin.py:450
/usr/lib/python3.13/site-packages/_hypothesis_pytestplugin.py:450: PytestRemovedIn9Warning: Marks applied to fixtures have no effect
See docs: https://docs.pytest.org/en/stable/deprecations.html#applying-a-mark-to-a-fixture-function
return _orig_call(self, function)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
============================================= short test summary info ==============================================
ERROR google/genai/tests/local_tokenizer/test_local_tokenizer.py
ERROR google/genai/tests/local_tokenizer/test_local_tokenizer_loader.py
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 2 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=================================== 172 deselected, 1 warning, 2 errors in 0.94s ===================================
==> ERROR: A failure occurred in check().
Aborting...
-> error making: python-google-genai-exit status 4
I believe pgpkeys are only relevant when using a signed source. In this case, makepkg has nothing to verify without an associated .sig
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。
This fixed the failing
test_websocket_base_url_no_auth_with_custom_base_urltest for me: