-
Notifications
You must be signed in to change notification settings - Fork 95
Fix VertexAILLM #342
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
Open
stellasia
wants to merge
8
commits into
neo4j:main
Choose a base branch
from
stellasia:fix/vertexai-tools
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fix VertexAILLM #342
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7164e26
to
cc74102
Compare
) | ||
try: | ||
if isinstance(message_history, MessageHistory): | ||
message_history = message_history.messages | ||
messages = self.get_messages(input, message_history) | ||
response = self.model.generate_content(messages, **self.model_params) | ||
return LLMResponse(content=response.text) | ||
response = model.generate_content(messages) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we removing model_params
here?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The main reason for this PR is that, even if Google
GenerativeModel
accepts a list of tools as parameter, this is not how we should provide multiple tools. We should instead provide a single tool with multiple function declarations. This PR addresses this behavior.It also addresses a few other problems related to the way
GenerativeModel
is instantiated. The usage is:Then, internally:
invoke
mode: we drop the tool config (it's not useful)invoke_with_tool
mode, we drop the generation config (otherwise the presence of fields likeresponse_mime_type
/response_schema
raise errors)Drawback of this approach:
tool_config
per call, which means we can't configure theallowed_function_names
parameter per call.We can't move these parameters to the
invoke*
methods because then they would be "provider-dependent" andLLMInterface
s wouldn't be interchangeable anymore, which defeats the whole point of the interface.Type of Change
Complexity
Complexity: ?
How Has This Been Tested?
Checklist
The following requirements should have been met (depending on the changes in the branch):