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] improve API #523

Merged
merged 2 commits into from
Jul 2, 2024
Merged

[Go] improve API #523

merged 2 commits into from
Jul 2, 2024

Conversation

jba
Copy link
Contributor

@jba jba commented Jul 2, 2024

This PR consists solely of refactoring. There are no behavior changes.

Address the following warts on the API:

  • Although flows are a key concept in Genkit, and the genkit package
    includes a DefineFlow function, the Flow type itself lived in the core
    package.

  • The core package contained several exported methods that were intended
    only to be called by the genkit package, a clear sign that something
    is off in the API design.

The actual visible changes to achieve this are small, but a lot of
code was moved. Most of the changes involve moving unexported symbols
into internal packages so they could be used by other packages.

The main API changes are:

  • Flow is now in the genkit package.

  • There are no more InternalXXX symbols in core.

There are some other minor changes, like the removal of the NoStream
type.

This PR consists solely of refactoring. There are no behavior changes.

Address the following warts on the API:

- Although flows are a key concept in Genkit, and the genkit package
  includes a DefineFlow function, the Flow type itself lived in the core
  package.

- The core package contained several exported methods that were intended
  only to be called by the genkit package, a clear sign that something
  is off in the API design.

The actual visible changes to achieve this are small, but a lot of
code was moved. Most of the changes involve moving unexported symbols
into internal packages so they could be used by other packages.

The main API changes are:

- Flow is now in the genkit package.

- There are no more InternalXXX symbols in core.

There are some other minor changes, like the removal of the NoStream
type.
Copy link
Collaborator

@apascal07 apascal07 left a comment

Choose a reason for hiding this comment

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

Looks good overall!

go/internal/registry/registry.go Show resolved Hide resolved
go/internal/registry/registry.go Show resolved Hide resolved
go/ai/generate.go Show resolved Hide resolved
go/genkit/flow.go Show resolved Hide resolved
go/genkit/flow.go Outdated Show resolved Hide resolved
go/genkit/servers.go Outdated Show resolved Hide resolved
@jba jba merged commit 1afa05d into main Jul 2, 2024
5 checks passed
@jba jba deleted the jba/genkit-flow branch July 2, 2024 21:47
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