Skip to content
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

[Go] googleai: revised plugin design #326

Merged
merged 3 commits into from
Jun 7, 2024
Merged

[Go] googleai: revised plugin design #326

merged 3 commits into from
Jun 7, 2024

Conversation

jba
Copy link
Contributor

@jba jba commented Jun 5, 2024

This illustrates the new plugin design:

  • Plugins are initialized with an Init function that holds
    configuration.

  • All models and other entities are defined in Init.

  • Plugins have global state.

  • Configured values can be retrieved by top-level functions that
    take strings as arguments.

Copy link
Contributor

@ianlancetaylor ianlancetaylor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels a bit weird to me. We set up state initially and then look it up again later. Why not just return it? But I guess if this is what Genkit wants, it's not terrible.

go/plugins/googleai/googleai.go Show resolved Hide resolved
go/plugins/googleai/googleai.go Outdated Show resolved Hide resolved
go/plugins/googleai/googleai_test.go Outdated Show resolved Hide resolved
go/plugins/googleai/googleai_test.go Outdated Show resolved Hide resolved
go/plugins/googleai/googleai.go Outdated Show resolved Hide resolved
@jba
Copy link
Contributor Author

jba commented Jun 5, 2024

We set up state initially and then look it up again later. Why not just return it?

I agree with you, but the JS folks are more comfortable with action-at-a-distance than we are. They want the convenience of not having to plumb the state through the program. I can see their point of view.

jba added 3 commits June 6, 2024 15:35
This illustrates the new plugin design:

- Plugins are initialized with an Init function that holds
  configuration.

- All models and other entities are defined in Init.

- Plugins have global state.

- Configured values can be retrieved by top-level functions that
  take strings as arguments.
@jba jba merged commit 927730d into main Jun 7, 2024
5 checks passed
@jba jba deleted the jba-googleai-plugin branch June 7, 2024 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants