-
Couldn't load subscription status.
- Fork 543
refactor(plugins/googleai): migrate to v2 #3749
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
base: main
Are you sure you want to change the base?
Conversation
| debugTraces: options?.experimental_debugTraces, | ||
| }) | ||
| actions.push( | ||
| defineGoogleAIModel({ |
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.
does the original defineGoogleAIModel overwrite different version, same name? or do we get both versions registered?
Can apiVersions include both, and then do we end up with different behaviour in v2 now, where we have both actions?
Need to confirm what's going on here so we don't change expected behaviour i think
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.
Worth double checking.
| debugTraces: options?.experimental_debugTraces, | ||
| }) | ||
| actions.push( | ||
| defineGoogleAIModel({ |
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.
Q: does this always return an action, or can it return undefined or something?
do we need to do some kind of filtering here maybe?
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.
It returns ModelAction, but can throw an error if API key not set
| ); | ||
| } | ||
| if (apiVersions.includes('v1')) { | ||
| Object.keys(SUPPORTED_GEMINI_MODELS).forEach((name) => |
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.
on this occasion i'd actually prefer a map and spread now maybe:
actions.push(
...Object.keys(SUPPORTED_GEMINI_MODELS).map((name) =>
defineGoogleAIModel({ ... })
)
);
forEach is clean for the previous code where we're just doing side effects, but now we're actually interested in the actions returned.
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.
I agree.
| // If debugTraces is enable, we wrap the actual model call with a span, add raw | ||
| // API params as for input. | ||
| return debugTraces | ||
| return debugTraces && registry |
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.
Is this definitely correct? Without checking out code it's hard to verify that you can destructure registry like this.
google-genai is using some experimental flag, see:
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.
I'd go with what's in google-genai, as I've just realised the current runInNewSpan function where you pass in the registry is deprecated.
Resolves #3443
Plugin migration guide
Notable Changes
Testing
Checked that at least one Imagen model works consistent with pre-migration on the UI.
Checked that at least one Veo model works consistent with pre-migration on the UI.
Can't see any load in, even before migration.
Checked that at least one Gemma model works consistent with pre-migration on the UI.
'pluginName/modelName'), checked using a flow works consistent with pre-migration.'pluginName/embedderName'), checked using a flow works consistent with pre-migration..list