-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Description
I got this when trying to use querychat with Gemini
from seaborn import load_dataset
from querychat import QueryChat
titanic = load_dataset("titanic")
qc = QueryChat(titanic, "titanic", client="google/gemini-2.5-flash")
qc.app()
Warning: there are non-text parts in the response: ['function_call'], returning concatenated text result from text parts. Check the full candidates.content.parts accessor to get the full model response.
/Users/cpsievert/github/querychat/.venv/lib/python3.12/site-packages/chatlas/_chat.py:2352: ToolFailureWarning: Calling tool 'update_dashboard' led to an error: Unknown tool.
yield self._handle_tool_error_result(
NoneType: None
Traceback (most recent call last):
File "/Users/cpsievert/github/querychat/.venv/lib/python3.12/site-packages/shiny/reactive/_extended_task.py", line 131, in _execution_wrapper
return await self._func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cpsievert/github/querychat/.venv/lib/python3.12/site-packages/shinychat/_chat.py", line 875, in _stream_task
return await self._append_message_stream(message, icon=icon)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cpsievert/github/querychat/.venv/lib/python3.12/site-packages/shinychat/_chat.py", line 934, in _append_message_stream
async for msg in message:
File "/Users/cpsievert/github/querychat/.venv/lib/python3.12/site-packages/chatlas/_chat.py", line 1047, in wrapper
async for chunk in self._chat_impl_async(
File "/Users/cpsievert/github/querychat/.venv/lib/python3.12/site-packages/chatlas/_chat.py", line 2126, in _chat_impl_async
async for chunk in self._submit_turns_async(
File "/Users/cpsievert/github/querychat/.venv/lib/python3.12/site-packages/chatlas/_chat.py", line 2255, in _submit_turns_async
response = await self.provider.chat_perform_async(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cpsievert/github/querychat/.venv/lib/python3.12/site-packages/chatlas/_provider_google.py", line 275, in chat_perform_async
return await self._client.aio.models.generate_content_stream(**kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cpsievert/github/querychat/.venv/lib/python3.12/site-packages/google/genai/models.py", line 7039, in generate_content_stream
response = await self._generate_content_stream(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cpsievert/github/querychat/.venv/lib/python3.12/site-packages/google/genai/models.py", line 5782, in _generate_content_stream
response_stream = await self._api_client.async_request_streamed(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cpsievert/github/querychat/.venv/lib/python3.12/site-packages/google/genai/_api_client.py", line 1393, in async_request_streamed
response = await self._async_request(http_request=http_request, stream=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cpsievert/github/querychat/.venv/lib/python3.12/site-packages/google/genai/_api_client.py", line 1309, in _async_request
return await self._async_retry( # type: ignore[no-any-return]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cpsievert/github/querychat/.venv/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 111, in __call__
do = await self.iter(retry_state=retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cpsievert/github/querychat/.venv/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 153, in iter
result = await action(retry_state)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cpsievert/github/querychat/.venv/lib/python3.12/site-packages/tenacity/_utils.py", line 99, in inner
return call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/Users/cpsievert/github/querychat/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 420, in exc_check
raise retry_exc.reraise()
^^^^^^^^^^^^^^^^^^^
File "/Users/cpsievert/github/querychat/.venv/lib/python3.12/site-packages/tenacity/__init__.py", line 187, in reraise
raise self.last_attempt.result()
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cpsievert/.local/share/uv/python/cpython-3.12.11-macos-aarch64-none/lib/python3.12/concurrent/futures/_base.py", line 449, in result
return self.__get_result()
^^^^^^^^^^^^^^^^^^^
File "/Users/cpsievert/.local/share/uv/python/cpython-3.12.11-macos-aarch64-none/lib/python3.12/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/Users/cpsievert/github/querychat/.venv/lib/python3.12/site-packages/tenacity/asyncio/__init__.py", line 114, in __call__
result = await fn(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cpsievert/github/querychat/.venv/lib/python3.12/site-packages/google/genai/_api_client.py", line 1186, in _async_request_once
data = json.dumps(http_request.data) if http_request.data else None
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cpsievert/.local/share/uv/python/cpython-3.12.11-macos-aarch64-none/lib/python3.12/json/__init__.py", line 231, in dumps
return _default_encoder.encode(obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cpsievert/.local/share/uv/python/cpython-3.12.11-macos-aarch64-none/lib/python3.12/json/encoder.py", line 200, in encode
chunks = self.iterencode(o, _one_shot=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cpsievert/.local/share/uv/python/cpython-3.12.11-macos-aarch64-none/lib/python3.12/json/encoder.py", line 258, in iterencode
return _iterencode(o, 0)
^^^^^^^^^^^^^^^^^
File "/Users/cpsievert/.local/share/uv/python/cpython-3.12.11-macos-aarch64-none/lib/python3.12/json/encoder.py", line 180, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type RuntimeError is not JSON serializable
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/Users/cpsievert/github/querychat/.venv/lib/python3.12/site-packages/shiny/reactive/_reactives.py", line 584, in _run
await self._fn()
File "/Users/cpsievert/github/querychat/.venv/lib/python3.12/site-packages/shinychat/_chat.py", line 887, in _handle_error
await self._raise_exception(e)
File "/Users/cpsievert/github/querychat/.venv/lib/python3.12/site-packages/shinychat/_chat.py", line 406, in _raise_exception
raise NotifyException(msg, sanitize=sanitize) from e
shiny.types.NotifyException: ("Error in Chat('titanic-chat'): Object of type RuntimeError is not JSON serializable", False, False)
/Users/cpsievert/github/querychat/.venv/lib/python3.12/site-packages/shiny/reactive/_reactives.py:566: ReactiveWarning: ("Error in Chat('titanic-chat'): Object of type RuntimeError is not JSON serializable", False, False)
await self._run()
Metadata
Metadata
Assignees
Labels
No labels