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

Add Flow API to generate #126

Open
DumiJDev opened this issue Dec 1, 2024 · 0 comments
Open

Add Flow API to generate #126

DumiJDev opened this issue Dec 1, 2024 · 0 comments

Comments

@DumiJDev
Copy link
Contributor

DumiJDev commented Dec 1, 2024

Hi!, @tjake

A method with many params can be verbose, flow API is more flexible and params can be passed calling the setter method, like:

Old method (verbose):

    Generator.Response r = m.generate(UUID.randomUUID(), ctx, 0.0f, 256, (s, f) -> {});

Flow API:

Generator.Response r = m.generateBuilder()
            .session(UUID.randomUUID()) //By default, UUID.randomUUID()
            .promptContext(ctx)
            .ntokens(256) //By default, 256
            .temperature(0.0f) //By default, 0.0f
            .onTokenWithTimings((s, aFloat) -> {}) //By default, (s, aFloat) -> {}, nothing
            .generate();
Generator.Response r = m.generateBuilder()
            .promptContext(ctx) //Required or can use prompt(String)
            .generate();

In first time, it appears verbose, but is very flexible, some params has a default value.

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

No branches or pull requests

1 participant