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 vertex specific count token request #171

Closed
wants to merge 2 commits into from

Conversation

davidmotson
Copy link
Collaborator

No description provided.

@davidmotson davidmotson requested a review from rlazo June 3, 2024 19:27
@@ -41,3 +41,11 @@ data class GenerateContentRequest(
@Serializable
data class CountTokensRequest(@Transient val model: String? = null, val contents: List<Content>) :
Request

@Serializable
Copy link
Collaborator

Choose a reason for hiding this comment

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

An alternative that reduces code changes is this:

  1. Make CountTokenRequest contain the superset of fields
  2. Add two builder methods, one for generativeai that only accepts GenerateContentRequest and one for vertex that only accepts the fields supported by Vertex.
  3. When creating the field, only fill the right fields

Since fields not included are not encoded, then nothing else in the code needs to change.

davidmotson pushed a commit that referenced this pull request Jun 4, 2024
@davidmotson davidmotson closed this Jun 4, 2024
@davidmotson davidmotson deleted the davidmotson.count_tokens_vertex branch June 4, 2024 17:20
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.

2 participants