-
Notifications
You must be signed in to change notification settings - Fork 189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Google Gemini doesn't work with QueryTool
#1572
Comments
Can be simplified to: from griptape.drivers import GooglePromptDriver
from griptape.structures import Agent
from griptape.tools import QueryTool
agent = Agent(
prompt_driver=GooglePromptDriver(model="gemini-1.5-pro"), tools=[QueryTool()]
)
agent.run() It's not an issue with |
off_prompt=True
QueryTool
It looks like Google Gemini does not support from __future__ import annotations
from attrs import define
from griptape.artifacts import ErrorArtifact, ListArtifact
from griptape.drivers import GooglePromptDriver
from griptape.structures import Agent
from griptape.tools import QueryTool
from griptape.utils.decorators import activity
from schema import Literal, Schema
@define(kw_only=True)
class GeminiQueryTool(QueryTool):
@activity(
config={
"description": "Can be used to search through textual content.",
"schema": Schema(
{
Literal(
"query", description="A natural language search query"
): str,
Literal("content"): Schema(
{
"memory_name": str,
"artifact_namespace": str,
}
),
}
),
},
)
def query(self, params: dict) -> ListArtifact | ErrorArtifact:
return super().query(params)
agent = Agent(
prompt_driver=GooglePromptDriver(model="gemini-1.5-flash"),
tools=[GeminiQueryTool()],
)
agent.run() |
yeeks. :) I can fix that if I'm using it on my own, but would rather not try and fix it in comfyUI where our customer is hitting it. Is there another fix that we can use for the framework, or is this a biggie? |
The issue boils down to this tool using schema.Or which turns into |
I'm giving it a try - but I'm getting this error: Traceback (most recent call last):
File "C:\Users\jason\Documents\GitHub\ComfyUI\.venv\Lib\site-packages\griptape\tools\base_tool.py", line 136, in run
output = self.try_run(activity, subtask, action, output)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jason\Documents\GitHub\ComfyUI\.venv\Lib\site-packages\griptape\common\decorators.py", line 18, in decorator
Observability.observe(
File "C:\Users\jason\Documents\GitHub\ComfyUI\.venv\Lib\site-packages\griptape\observability\observability.py", line 36, in observe
return driver.observe(call)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jason\Documents\GitHub\ComfyUI\.venv\Lib\site-packages\griptape\drivers\observability\no_op_observability_driver.py", line 16, in observe
return call()
^^^^^^
File "C:\Users\jason\Documents\GitHub\ComfyUI\.venv\Lib\site-packages\griptape\common\observable.py", line 19, in __call__
return self.func(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jason\Documents\GitHub\ComfyUI\.venv\Lib\site-packages\griptape\tools\base_tool.py", line 158, in try_run
activity_result = activity(deepcopy(value))
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jason\Documents\GitHub\ComfyUI\.venv\Lib\site-packages\griptape\utils\decorators.py", line 31, in wrapper
return func(self, **_build_kwargs(func, params))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\jason\Documents\GitHub\ComfyUI\custom_nodes\ComfyUI-Griptape\nodes\patches\gemini_query_tool.py", line 31, in query
return super().query(params)
^^^^^^^^^^^^^
TypeError: super(type, obj): obj must be an instance or subtype of type Will keep poking around unless you know a quick fix :) |
resolved it by copying the def query(self, params: dict) -> ListArtifact | ErrorArtifact:
return super().query(params) |
When using GoogleDriversConfig and
off_prompt=True
I'm getting an error -Unknown field for Schema: anyOf
Here's the error:
The text was updated successfully, but these errors were encountered: