-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add vision modality to the Java LLM API
PiperOrigin-RevId: 705528226
- Loading branch information
1 parent
ad6c03e
commit 96e3a69
Showing
6 changed files
with
313 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
42 changes: 42 additions & 0 deletions
42
mediapipe/tasks/java/com/google/mediapipe/tasks/genai/llminference/GraphOptions.java
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
package com.google.mediapipe.tasks.genai.llminference; | ||
|
||
import com.google.auto.value.AutoValue; | ||
|
||
/** Configuration for the inference graph. */ | ||
@AutoValue | ||
public abstract class GraphOptions { | ||
|
||
/** | ||
* Returns whether to configure the graph to include the token cost calculator, which allows users | ||
* to only compute the cost of a prompt. | ||
*/ | ||
public abstract boolean includeTokenCostCalculator(); | ||
|
||
/** Returns whether to configure the graph to include the vision modality. */ | ||
public abstract boolean enableVisionModality(); | ||
|
||
/** Returns a new {@link Builder} instance. */ | ||
public static Builder builder() { | ||
return new AutoValue_GraphOptions.Builder() | ||
.setIncludeTokenCostCalculator(true) | ||
.setEnableVisionModality(false); | ||
} | ||
|
||
/** Builder for {@link GraphConfig}. */ | ||
@AutoValue.Builder | ||
public abstract static class Builder { | ||
/** Sets whether to configure the graph to include the token cost calculator. */ | ||
public abstract Builder setIncludeTokenCostCalculator(boolean includeTokenCostCalculator); | ||
|
||
/** Sets whether to configure the graph to include the vision modality. */ | ||
public abstract Builder setEnableVisionModality(boolean enableVisionModality); | ||
|
||
/** AutoValue generated builder method. */ | ||
abstract GraphOptions autoBuild(); | ||
|
||
/** Builds a new {@link GraphConfig} instance. */ | ||
public GraphOptions build() { | ||
return autoBuild(); | ||
} | ||
} | ||
} |
This file contains 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
This file contains 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
Oops, something went wrong.